Skip to content

[Bug] Embedded code is not part of examples #24

Description

@Geod24

I took a fresh look at the docs and what DMD is doing. We currently make embedded code (aka code within ---) as belonging to the examples section where they really aren't (I've no idea why I implemented it this way to start with).

DMD is really doing the right thing here. I tried with the command dmd -c -Dffoo.html test.d debug.ddoc
debug.ddoc:

DDOC=$(BODY)
DDOC_SUMMARY=[SUMMARY $0]
DDOC_DESCRIPTION=[DESCRIPTION $0]
DDOC_THROWS=[THROWS $0]

test.d:

/**
 * Module title
 *
 * This is the description
 * ----
 * // This really is part of the description
 * ----
 * Moar description
 *
 * Throws:
 * Exception obviously
 * ---
 * auto exception = new Exception("This is part of Throws too");
 * ---
 */
module doc.test;

Output:

<!-- Generated by Ddoc from test.d -->
[SUMMARY Module title
]
[DESCRIPTION  This is the description
<pre class="d_code"><font color=green>// This really is part of the description
</font></pre>
 Moar description

]
[THROWS  Exception obviously
<pre class="d_code"><font color=blue>auto</font> exception = <font color=blue>new</font> Exception(<font color=red>"This is part of Throws too"</font>);
</pre>
]

This should hopefully simplify section parsing quite a bit. Will it have a big impact on harbored ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions