Ddoc

Ddoc is a compiler-embedded documentation generator and associated syntax, for the D programming language, designed by Walter Bright. Its emphasis is on being able to write documentation in code comments in a natural style, minimizing the need for embedded markup and thus improving the legibility of the code comments. It is similar in concept to Doxygen and Javadoc.

Code comments are associated with symbols in the code, and Ddoc uses the semantic and syntactic information available from the D compiler to fill in routine information such as parameters and return types automatically.

The code comments and symbol table information are processed by Ddoc into an internal structured format. Each of these structures corresponds to a template expressed as a macro. The template macros convert the structured format into another set of macros that express the markup. The latter set of markup macros are expanded to produce, by default, HTML.

Both the template macros and the markup macros can be overridden by the user, and can be applied via external files analogous to HTML style sheets. The template macros can be changed to customize the high level formatting, and the markup macros can be altered to produce other output forms such as XML and XHTML.

Compiler options

Several compiler options are available to cause the dmd D compiler to output an HTML documentation file:

  • /-D generate documentation - output will be the same name as the D source file, with the ".d" extension replaced with ".html".
  • /-Dd<directory> write documentation file to directory, output filename is the same as from the -D option.
  • /-Df<filename> write documentation file to filename (does not automatically append .html extension)
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.