matusnovak/doxybook2

Member description for enums are removed from output

X-Ryl669 opened this issue · 6 comments

I have this code:

    /** The action this task should perform while notifying this task. */
    enum Action
    {
        ExitTask            =   0x01,   //!< This is only triggered when NFC usage is disabled, or after a temporary HTTP server's request
        /** Wait for a tag to enter the field and enlist it. The action is expected to follow this scheme:
            Byte: XX XX 00 02    XX XX: Timeout in millisecond for enlisting process
            You must wait at least the given timeout before reading status */
        WaitForTagPresence  =   0x02,   
        /** Try to enroll this tag. The action is expected to follow this scheme:
            Byte: XX XX YY 03    XX XX: Timeout in millisecond for enrolling process, YY: User index 
            You must wait at least the given timeout before reading status */
        EnrollTag           =   0x03,
        /** Try to forget/clean the tag. The action is expected to follow this scheme:
            Byte: XX XX 00 04    XX XX: Timeout in millisecond for cleaning process
            You must wait at least the given timeout before reading status */
        ForgetTag           =   0x04,

        // Used internally, don't use that
        RollbackTransaction =   0x05, 
    };

Doxygen generates this in xml:

<memberdef kind="enum" id="struct_n_f_c_task_1ae70acdadd1bb20de20bc88b8a5c50d18" prot="public" static="no" strong="no">
        <type></type>
        <name>Action</name>
        <enumvalue id="struct_n_f_c_task_1ae70acdadd1bb20de20bc88b8a5c50d18aad294434cc31f45658e2aae828db361f" prot="public">
          <name>ExitTask</name>
          <initializer>=   0x01</initializer>
          <briefdescription>
<para>This is only triggered when <ref refid="struct_n_f_c" kindref="compound">NFC</ref> usage is disabled, or after a temporary HTTP server&apos;s request. </para>          </briefdescription>
          <detaileddescription>
          </detaileddescription>
        </enumvalue>
        <enumvalue id="struct_n_f_c_task_1ae70acdadd1bb20de20bc88b8a5c50d18a0bc9d84ebc1b13054f19b2f9d9296c25" prot="public">
          <name>WaitForTagPresence</name>
          <initializer>=   0x02</initializer>
          <briefdescription>
<para>Wait for a tag to enter the field and enlist it. </para>          </briefdescription>
          <detaileddescription>
<para>The action is expected to follow this scheme: Byte: XX XX 00 02 XX XX: Timeout in millisecond for enlisting process You must wait at least the given timeout before reading status </para>          </detaileddescription>
        </enumvalue>
        <enumvalue id="struct_n_f_c_task_1ae70acdadd1bb20de20bc88b8a5c50d18a6aac419778030be184fc898a24f41ddf" prot="public">
          <name>EnrollTag</name>
          <initializer>=   0x03</initializer>
          <briefdescription>
<para>Try to enroll this tag. </para>          </briefdescription>
          <detaileddescription>
<para>The action is expected to follow this scheme: Byte: XX XX YY 03 XX XX: Timeout in millisecond for enrolling process, YY: User index You must wait at least the given timeout before reading status </para>          </detaileddescription>
        </enumvalue>
        <enumvalue id="struct_n_f_c_task_1ae70acdadd1bb20de20bc88b8a5c50d18ab4532440bae3ef29a7d21037494b1951" prot="public">
          <name>ForgetTag</name>
          <initializer>=   0x04</initializer>
          <briefdescription>
<para>Try to forget/clean the tag. </para>          </briefdescription>
          <detaileddescription>
<para>The action is expected to follow this scheme: Byte: XX XX 00 04 XX XX: Timeout in millisecond for cleaning process You must wait at least the given timeout before reading status </para>          </detaileddescription>
        </enumvalue>
        <enumvalue id="struct_n_f_c_task_1ae70acdadd1bb20de20bc88b8a5c50d18a9cdd4783134cada1cac9275a4b559994" prot="public">
          <name>RollbackTransaction</name>
          <initializer>=   0x05</initializer>
          <briefdescription>
          </briefdescription>
          <detaileddescription>
          </detaileddescription>
        </enumvalue>
        <briefdescription>
<para>The action this task should perform while notifying this task. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="main/NFCTask.hpp" line="93" column="1" bodyfile="main/NFCTask.hpp" bodystart="92" bodyend="110"/>
      </memberdef>

Yet, none of the documentation contains the brief description (nor detailed description) like this:

## Public Types

| Type | Name |
| ---: | :--- |
| enum  | [**Action**](struct_n_f_c_task.md#enum-action)  <br>_The action this task should perform while notifying this task._  |

[...]

## Public Types Documentation


### enum Action


```cpp
enum NFCTask::Action {
    ExitTask =   0x01,
    WaitForTagPresence =   0x02,
    EnrollTag =   0x03,
    ForgetTag =   0x04,
    RollbackTransaction =   0x05
};

Would it be possible to have the description in the enum's value (with a table instead of a block code ?)

Hi @X-Ryl669

Thanks for the detailed XML and an example. I have fixed this issue and released a new version as releases/tag/v1.0.5.

However, I had to change how enums are rendered into Markdown. Instead of code-block it now becomes a table.

Sample screenshot:

2020-04-02 18_41_07-Document

Wonderful! Thank you.
Wouldn't a 3 column layout be better ? Like this:

Enumerator Value Description
Unknown 0 Dont use this
INT_8 1<<1 8-bit signed integer

You already have enumvalues.initializer, but such initializer contains = value so = should be stripped from the string.

That makes more sense, I will add that in.

Changing this:

{% if kind == "enum" %}
| Enumerator | Description |
| ---------- | ----------- |
{% for enumvalue in enumvalues %}| {{enumvalue.name}}{% if existsIn(enumvalue, "initializer") %} {{enumvalue.initializer}}{% endif %} | {% if existsIn(enumvalue, "brief") %}{{enumvalue.brief}}{% endif %} {% if existsIn(enumvalue, "details") %}{{enumvalue.details}}{% endif %} |
{% endfor %}
{% endif %}

to this:

{% if kind == "enum" %}
| Enumerator | Value | Description |
| ---------- | ----- | ----------- |
{% for enumvalue in enumvalues %}| {{enumvalue.name}} | {% if existsIn(enumvalue, "initializer") %} {{enumvalue.initializer}}{% endif %} | {% if existsIn(enumvalue, "brief") %}{{enumvalue.brief}}{% endif %} {% if existsIn(enumvalue, "details") %}{{enumvalue.details}}{% endif %} |
{% endfor %}
{% endif %}

Also, when assigning enumvalue.initializer, you'll need to left strip any =\t\b.

@X-Ryl669

Done, released as releases/tag/v1.0.6

Example screenshot:

2020-04-05 14_08_56-Document

Thanks, that's perfect!