www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Dub documentation with an initial ddoc file

reply Conor O'Brien <conorobrien4god gmail.com> writes:
I've been trying to figure out how to generate documentation for 
my project using dub. I have found this link[1] which told me how 
I could use dub to generate docs:

     dub build --build=docs <project-name>

However, I wish to have a set of macros that are present on every 
documentation file, that would define how the resultant HTML 
document is rendered. I tried:

     dub build --build=docs <project-name> html.ddoc

But I got the following error:

     Expected one or zero arguments.
     Run "dub build -h" for more information about the "build" 
command.

How might I include `html.ddoc` with every file that has 
documentation?

[1]: 
https://stackoverflow.com/questions/29762668/using-dub-to-build-documentation
Sep 03 2017
parent Anton Fediushin <fediushin.anton yandex.ru> writes:
On Sunday, 3 September 2017 at 23:14:15 UTC, Conor O'Brien wrote:
 I've been trying to figure out how to generate documentation 
 for my project using dub. I have found this link[1] which told 
 me how I could use dub to generate docs:

     dub build --build=docs <project-name>

 However, I wish to have a set of macros that are present on 
 every documentation file, that would define how the resultant 
 HTML document is rendered. I tried:

     dub build --build=docs <project-name> html.ddoc

 But I got the following error:

     Expected one or zero arguments.
     Run "dub build -h" for more information about the "build" 
 command.

 How might I include `html.ddoc` with every file that has 
 documentation?
Add this to your dub.json: "configurations": [ { "name": "docs", "buildOptions": ["syntaxOnly"], "dflags": ["-Dddocs"], "sourceFiles": ["html.ddoc"] } ] Or if you use dub.sdl: configuration "docs" { buildOptions "syntaxOnly" dflags "-Dddocs" sourceFiles "html.ddoc" } This adds a new configuration named "docs", which can be used like this: $ dub -c docs
Sep 04 2017