Leaflet / Leafdoc

A lightweight NaturalDocs-like LeafletJS-style documentation generator
54 stars 19 forks source link

Miniclass directive produces wrong html in some cases #29

Open CroniD opened 7 years ago

CroniD commented 7 years ago

Hi there,

I tried the following cases with the basic templates and the latest leafdoc (1.4.1).

test01.leafdoc

@miniclass MyMiniClass (MyParentClass)

A comment, lonely but its happy.

produces

<h2 id="myparentclass">MyParentClass</h2>
<h2 id="myminiclass"></h2>
A comment, lonely but its happy.

What is wrong: Name of the Miniclass is missing.

test02.leafdoc

@miniclass MyMiniClass (MyParentClass)
@section

A comment, lonely but its happy.

produces

<h2 id="myparentclass">MyParentClass</h2>
<h2 id="myminiclass"></h2>

What is wrong: Name of the Miniclass and Comment are missing.

test03.leafdoc

@miniclass MyMiniClass (MyParentClass)
@section

A comment, lonely but its happy.

@option foo : Boolean = true

produces

<h2 id="myparentclass">MyParentClass</h2>
<h2 id="myminiclass"></h2>
<h3 id="myminiclass-option">MyMiniClass</h3>
<section data-type="[object Object]">
A comment, lonely but its happy.
<table><thead>
    <tr>
        <th>Option</th>
        <th>Type</th>
        <th>Default</th>
        <th>Description</th>
    </tr>
    </thead><tbody>
    <tr id="myminiclass-foo">
        <td><code><b>foo</b></code></td>
        <td><code>Boolean</code>
        </td><td><code>true</code></td>
        <td></td>
    </tr>
</tbody></table>
</section>

What is wrong: Two headings for the Miniclass (h2 is empty, h3 is not and has the wrong string). Comment is in the wrong place (should be outside of the "section" element).

test04.leafdoc

@miniclass MyMiniClass (MyParentClass)

A comment, lonely but its happy.

@option foo : Boolean = true

produces

<h2 id="myparentclass">MyParentClass</h2>
<h2 id="myminiclass"></h2>
A comment, lonely but its happy.
<h3 id="myminiclass-option">MyMiniClass</h3>
<section data-type="[object Object]">
<table><thead>
    <tr>
        <th>Option</th>
        <th>Type</th>
        <th>Default</th>
        <th>Description</th>
    </tr>
    </thead><tbody>
    <tr id="myminiclass-foo">
        <td><code><b>foo</b></code></td>
        <td><code>Boolean</code>
        </td><td><code>true</code></td>
        <td></td>
    </tr>
</tbody></table>
</section>

What is wrong: Two headings for the Miniclass (h2 is empty, h3 is not and has the wrong string).

Also, maybe the Miniclass directive should have it's own template. And the miniclass feature is not documentated at all (README.md).

Best regards