9
votes

I would like to create a custom command in Doxygen similar to \fn \param or \var.

For example I would like to be able to create a \option command which I would use as follows:

/**
  \option option_1 This is the first option.
  \option option_2 This is the second option.
*/

With an output like:

     Options:
          option_1 This is the first option.
          option_2 This is the second option.




A simple substitution alias does not work. For example with this alias:

ALIASES = option="\par Options:\n" 

I get the following output:

     Options:
          option_1 This is the first option.

     Options:
          option_2 This is the second option.

Which is not what I am looking for.


BOUNTY:

If any further clarification is needed, see my question: Doxygen - Create custom command

2

2 Answers

3
votes

While it is not as clean as @param, you can emulate similar behavior with the following aliases:

ALIASES += options="<dl class="params"><dt>Options</dt><dd><table class="params">"
ALIASES += option{2}="<tr><td class="paramname">\1</td><td>\2</td></tr>"
ALIASES += endoptions="</table></dd></dl>"

The aliases can be used as follows to produce the output you're looking for:

/**
 * @options
 * @option{ option_1, This is the first option. }
 * @option{ option_2, This is the second option. }
 * @endoptions
 */

Note: This is HTML-centric and likely will not produce reasonable output for other formats.

0
votes

It looks like xrefitem might do what you want as answered in this previous question: Custom tags with Doxygen