Max Kielland
Max Kielland

Reputation: 5841

Doxygen put HTML tag after a @snippets command

I have created an ALIAS to embedd a \snippet into a HTML <div></div>

ALIASES += "snippetLang{2}=<div id='\1' class='snippetcontent'> \snippet \2 </div>"

Then I use the alias like this:

@snippetLang{CS,ExampleForm.cs OnShow example}

The parameters expands fine but since snippet's second parameter spands to the end of the line, the </div> tag will be included.

<div id='CS' class='snippetcontent'> \snippet ExampleForm.cs OnShow example </div>

The \snippet command will now look for the reference "OnShow example </div>" instead of only the "OnShow example"

Is there any way to make doxygen expand the command where the \snippet \1 is on its own line, like this?

<div id='CS' class='snippetcontent'>
\snippet ExampleForm.cs OnShow example
</div>

The Doxygen version is 1.8.14

Upvotes: 0

Views: 189

Answers (1)

albert
albert

Reputation: 9047

From the doxygen documentation (1.8.15):

ALIASES This tag can be used to specify a number of aliases that act as commands in the documentation. An alias has the form: name=value For example adding "sideeffect=@par Side Effects:\n" will allow you to put the command \sideeffect (or @sideeffect) in the documentation, which will result in a user-defined paragraph with heading "Side Effects:". You can put \n's in the value part of an alias to insert newlines (in the resulting output). You can put ^^ in the value part of an alias to insert a newline as if a physical newline was in the original file. When you need a literal { or } or , in the value part of an alias you have to escape them by means of a backslash (), this can lead to conflicts with the commands{ and } for these it is advised to use the version @{ and @} or use a double escape (\{ and \})

The version:

ALIASES += "snippetLang{2}=<div id='\1' class='snippetcontent'> \snippet \2 ^^</div>"

will work for the version 1.8.14 and up

the version

ALIASES += "snippetLang{2}=<div id='\1' class='snippetcontent'> \snippet \2 \n</div>"

will work for the versions from before 1.8.14

Upvotes: 1

Related Questions