svenevs / exhale

Automatic C++ library api documentation generation: breathe doxygen in and exhale it out.
BSD 3-Clause "New" or "Revised" License
218 stars 51 forks source link

Exhale seems to eat asterisk-chars '*' #183

Open schlatterbeck opened 1 year ago

schlatterbeck commented 1 year ago

I have the following in a doxygen XML:

<simplesect kind="return"><para>None <verbatim>embed:rst:leading-asterisk

 Example
 -------

 Set the initialization routines to select a value for gene i
 uniformly randomly from the interval [0,i].  Assumes all strings
 are of the same length.

 .. code-block:: c

     PGAContext *ctx;
     int *low, *high, stringlen, i;

     stringlen = PGAGetStringLength (ctx);
     low  = malloc (stringlen * sizeof (int));
     high = malloc (stringlen * sizeof (int));
     for (i=0; i&lt;stringlen; i++) {
         low  [i] = 0;
         high [i] = i;
     }
     PGASetIntegerInitRange (ctx, low, high);</verbatim> </para>
</simplesect>

When converting this to a man page (or also when creating html) the first '*' in every line is missing:

EXAMPLE
       Set the initialization routines to select a value for gene i  uniformly
       randomly  from the interval [0,i].  Assumes all strings are of the same
       length.

       PGAContext  ctx;
       int  low, *high, stringlen, i;

       stringlen = PGAGetStringLength (ctx);
       low  = malloc (stringlen   sizeof (int));
       high = malloc (stringlen   sizeof (int));
       for (i=0; i<stringlen; i++) {
           low  [i] = 0;
           high [i] = i;
       }
       PGASetIntegerInitRange (ctx, low, high);

Note how the '*' before ctx, low and in malloc are missing.

I don't know if this is a bug in exhale or if the problem is occurring later in the toolchain. It seems that Doxygen is not at fault though.

schlatterbeck commented 1 year ago

Looks like this is caused by

ALIASES                = "rst=\verbatim embed:rst:leading-asterisk"

This has the effect that in breathe/renderer/sphinxrenderer.py around line 1694 the first asterisk in each line is removed. A questionable concept, a better implementation would only remove the first asterisk after leading whitespace? I was successful by just redefining this alias to

ALIASES                = "rst=\verbatim embed:rst"

by overriding this in my conf.py.