www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Suggestion: __traits(ddoc)

reply James Lu <jamtlu gmail.com> writes:
DDoC is very convenient for generating HTML documentation.

Sometimes, though, we need to print documentation back, for 
example when writing a command line tool and "-h" is passed.

I suggest `__traits(ddoc, symbol)`, which would return the 
concatenated DDoC source of a symbol as an enum string.

If DMD compiler authors provide pointers (where to start, what 
methods to call) on how to do this, I will implement this myself 
and send a pull request.
May 10
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Tuesday, 11 May 2021 at 00:00:30 UTC, James Lu wrote:
 I suggest `__traits(ddoc, symbol)`, which would return the 
 concatenated DDoC source of a symbol as an enum string.
omg yes this would be SO useful for me.
May 10
prev sibling parent Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Tuesday, 11 May 2021 at 00:00:30 UTC, James Lu wrote:
 I suggest `__traits(ddoc, symbol)`, which would return the 
 concatenated DDoC source of a symbol as an enum string.
This has been proposed and implemented before, but it was not accepted into the language. See: - https://github.com/dlang/dmd/pull/3531 - https://github.com/dlang/dmd/pull/6872 - https://forum.dlang.org/post/qsnyzyrgyftpxxskrqaj forum.dlang.org
 DDoC is very convenient for generating HTML documentation.

 Sometimes, though, we need to print documentation back, for 
 example when writing a command line tool and "-h" is passed.
This is the same use case I had: https://github.com/dlang/dmd/pull/6872#issuecomment-307109065
May 10