Skip to content
JakobOvrum edited this page Feb 16, 2013 · 6 revisions

A DDoc macro is a text processing function that uses the following syntax: $(MACRONAME arg1, ..., argN). bootDoc includes a number of standard macros, documented below.

General

  • $(LPAREN) and $(RPAREN)

    • Insert an opening and closing parenthesis, respectively. Useful when parentheses are needed in macro argument lists.
  • $(LESS) and $(GREATER)

    • Insert a less-than (<) and greater-than (>) symbol, respectively. Useful when the target output format is HTML, which is the case with bootDoc.
  • $(D code)

    • Insert D code inline. Inline code is rendered in a monospace font.
  • $(BIGOH expression)

    • Insert complexity expression in big-O notation.
  • $(HTTP address, text) and $(HTTPS address, text)

    • Insert web link with custom text, using the HTTP and HTTPS protocols, respectively. Do not include the protocol prefix in address.
  • $(LUCKY searchTerm)

    • Insert link to a I'm feeling lucky Google search for the term searchTerm. The text for the link is also searchTerm.
  • $(BUGREF ticket) and $(ISSUEREF ticket)

    • Insert link to the project bug/issue tracker opened on ticket. Configured by ISSUETRACKER in settings.ddoc. The difference between them is the text used in the link; use ISSUEREF for issues that aren't bugs, such as enhancement requests.

Symbol References

The *REF[2-6] macros are used to insert references to specific symbol declarations. The prefix in the name of the macro is the root of the reference. The number suffix denotes how many sub-packages are needed to reach the reference from the root. MREF and UPREF do not have suffix versions.

  • $(MREF symbol)

    • Module reference. Insert reference to symbol from the current module.
  • $(DPREF module, symbol)

    • Default package reference. Insert reference to $(DEFAULTPACKAGE).module.symbol. DEFAULTPACKAGE is defined in settings.ddoc. This is the preferred way to insert cross references.
  • $(RREF package, module, symbol)

    • Root reference. Insert reference to package.module.symbol.
  • $(PREF module, symbol)

    • Package reference. Insert reference to $(THISPACKAGE).module.symbol. THISPACKAGE is automatically defined to be the current package when the documentation is generated using the included generation tool. Otherwise, THISPACKAGE must be defined manually.
  • $(RPREF module, symbol)

    • Root package reference. Insert reference to $(THISROOTPACKAGE).module.symbol. THISROOTPACKAGE is automatically defined to be the parent package of the current package when the documentation is generated using the included generation tool. Otherwise, THISROOTPACKAGE must be defined manually.
  • $(UPREF module, symbol)

    • Unpackaged module reference. Insert reference to module.symbol.

Module References

The *MODULE[2-6] macros are used to insert references to other modules in the project. The prefix in the name of the macro is the root of the reference. The number suffix denotes how many sub-packages are needed to reach the reference from the root. UPMODULE does not have suffix versions.

  • $(DPMODULE module)

    • Default package reference. Insert reference to $(DEFAULTPACKAGE).module. DEFAULTPACKAGE is defined in settings.ddoc.
  • $(RMODULE package, module)

    • Root reference. Insert reference to package.module.
  • $(PMODULE module)

    • Package reference. Insert reference to $(THISPACKAGE).module. THISPACKAGE is automatically defined to be the current package when the documentation is generated using the included generation tool. Otherwise, THISPACKAGE must be defined manually.
  • $(RPMODULE module)

    • Root package reference. Insert reference to $(THISROOTPACKAGE).module. THISROOTPACKAGE is automatically defined to be the parent package of the current package when the documentation is generated using the included generation tool. Otherwise, THISROOTPACKAGE must be defined manually.
  • $(UPMODULE module)

    • Unpackaged module reference. Insert reference to module.

Phobos References

The STD* macros can be used to reference the standard library documentation at dlang.org.

  • $(STDREF module, symbol)

    • Symbol reference.
  • $(STDMODULE module)

    • Module reference.
Clone this wiki locally