| 1 |
Ddoc |
|---|
| 2 |
|
|---|
| 3 |
$(SPEC_S Embedded Documentation, |
|---|
| 4 |
|
|---|
| 5 |
$(P |
|---|
| 6 |
The D programming language enables embedding both contracts and test |
|---|
| 7 |
code along side the actual code, which helps to keep them all |
|---|
| 8 |
consistent with each other. One thing lacking is the documentation, |
|---|
| 9 |
as ordinary comments are usually unsuitable for automated extraction |
|---|
| 10 |
and formatting into manual pages. |
|---|
| 11 |
Embedding the user documentation into the source code has important |
|---|
| 12 |
advantages, such as not having to write the documentation twice, and |
|---|
| 13 |
the likelihood of the documentation staying consistent with the code. |
|---|
| 14 |
) |
|---|
| 15 |
|
|---|
| 16 |
$(P |
|---|
| 17 |
Some existing approaches to this are: |
|---|
| 18 |
) |
|---|
| 19 |
|
|---|
| 20 |
$(UL |
|---|
| 21 |
$(LI <a href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</a> which already has some support for D) |
|---|
| 22 |
$(LI Java's <a href="http://java.sun.com/j2se/javadoc/">Javadoc</a>, |
|---|
| 23 |
probably the most well-known) |
|---|
| 24 |
$(LI C#'s <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcoriXMLDocumentation.asp">embedded XML</a>) |
|---|
| 25 |
$(LI Other <a href="http://www.python.org/sigs/doc-sig/otherlangs.html">documentation tools</a>) |
|---|
| 26 |
) |
|---|
| 27 |
|
|---|
| 28 |
$(P |
|---|
| 29 |
D's goals for embedded documentation are: |
|---|
| 30 |
) |
|---|
| 31 |
|
|---|
| 32 |
$(OL |
|---|
| 33 |
$(LI It looks good as embedded documentation, not just after it |
|---|
| 34 |
is extracted and processed.) |
|---|
| 35 |
$(LI It's easy and natural to write, |
|---|
| 36 |
i.e. minimal reliance on <tags> and other clumsy forms one |
|---|
| 37 |
would never see in a finished document.) |
|---|
| 38 |
$(LI It does not repeat information that the compiler already |
|---|
| 39 |
knows from parsing the code.) |
|---|
| 40 |
$(LI It doesn't rely on embedded HTML, as such will impede |
|---|
| 41 |
extraction and formatting for other purposes.) |
|---|
| 42 |
$(LI It's based on existing D comment forms, so it |
|---|
| 43 |
is completely independent of parsers only interested in D code.) |
|---|
| 44 |
$(LI It should look and feel different from code, so it won't |
|---|
| 45 |
be visually confused with code.) |
|---|
| 46 |
$(LI It should be possible for the user to use Doxygen or other |
|---|
| 47 |
documentation extractor if desired.) |
|---|
| 48 |
) |
|---|
| 49 |
|
|---|
| 50 |
<h2>Specification</h2> |
|---|
| 51 |
|
|---|
| 52 |
$(P |
|---|
| 53 |
The specification for the form of embedded documentation comments only |
|---|
| 54 |
specifies how information is to be presented to the compiler. |
|---|
| 55 |
It is implementation-defined how that information is used and the form |
|---|
| 56 |
of the final presentation. Whether the final presentation form is an |
|---|
| 57 |
HTML web page, a man page, a PDF file, etc. is not specified as part of the |
|---|
| 58 |
D Programming Language. |
|---|
| 59 |
) |
|---|
| 60 |
|
|---|
| 61 |
<h3>Phases of Processing</h3> |
|---|
| 62 |
|
|---|
| 63 |
$(P |
|---|
| 64 |
Embedded documentation comments are processed in a series of phases: |
|---|
| 65 |
) |
|---|
| 66 |
|
|---|
| 67 |
$(OL |
|---|
| 68 |
$(LI Lexical - documentation comments are identified and attached |
|---|
| 69 |
to tokens.) |
|---|
| 70 |
$(LI Parsing - documentation comments are associated with |
|---|
| 71 |
specific declarations and combined.) |
|---|
| 72 |
$(LI Sections - each documentation comment is divided up into |
|---|
| 73 |
a sequence of sections.) |
|---|
| 74 |
$(LI Special sections are processed.) |
|---|
| 75 |
$(LI Highlighting of non-special sections is done.) |
|---|
| 76 |
$(LI All sections for the module are combined.) |
|---|
| 77 |
$(LI Macro text substitution is performed to produce the final result.) |
|---|
| 78 |
) |
|---|
| 79 |
|
|---|
| 80 |
<h3>Lexical</h3> |
|---|
| 81 |
|
|---|
| 82 |
$(P |
|---|
| 83 |
Embedded documentation comments are one of the following forms: |
|---|
| 84 |
) |
|---|
| 85 |
|
|---|
| 86 |
$(OL |
|---|
| 87 |
$(LI $(D_COMMENT /** ... */) The two *'s after the opening /) |
|---|
| 88 |
$(LI $(D_COMMENT /++ ... +/) The two +'s after the opening /) |
|---|
| 89 |
$(LI $(D_COMMENT ///) The three slashes) |
|---|
| 90 |
) |
|---|
| 91 |
|
|---|
| 92 |
$(P The following are all embedded documentation comments:) |
|---|
| 93 |
|
|---|
| 94 |
--------------------------- |
|---|
| 95 |
/// This is a one line documentation comment. |
|---|
| 96 |
|
|---|
| 97 |
/** So is this. */ |
|---|
| 98 |
|
|---|
| 99 |
/++ And this. +/ |
|---|
| 100 |
|
|---|
| 101 |
/** |
|---|
| 102 |
This is a brief documentation comment. |
|---|
| 103 |
*/ |
|---|
| 104 |
|
|---|
| 105 |
/** |
|---|
| 106 |
* The leading * on this line is not part of the documentation comment. |
|---|
| 107 |
*/ |
|---|
| 108 |
|
|---|
| 109 |
/********************************* |
|---|
| 110 |
The extra *'s immediately following the /** are not |
|---|
| 111 |
part of the documentation comment. |
|---|
| 112 |
*/ |
|---|
| 113 |
|
|---|
| 114 |
/++ |
|---|
| 115 |
This is a brief documentation comment. |
|---|
| 116 |
+/ |
|---|
| 117 |
|
|---|
| 118 |
/++ |
|---|
| 119 |
+ The leading + on this line is not part of the documentation comment. |
|---|
| 120 |
+/ |
|---|
| 121 |
|
|---|
| 122 |
/+++++++++++++++++++++++++++++++++ |
|---|
| 123 |
The extra +'s immediately following the / ++ are not |
|---|
| 124 |
part of the documentation comment. |
|---|
| 125 |
+/ |
|---|
| 126 |
|
|---|
| 127 |
/**************** Closing *'s are not part *****************/ |
|---|
| 128 |
--------------------------- |
|---|
| 129 |
|
|---|
| 130 |
$(P |
|---|
| 131 |
The extra *'s and +'s on the comment opening, closing and left margin are |
|---|
| 132 |
ignored and are not part |
|---|
| 133 |
of the embedded documentation. |
|---|
| 134 |
Comments not following one of those forms are not documentation comments. |
|---|
| 135 |
) |
|---|
| 136 |
|
|---|
| 137 |
<h3>Parsing</h3> |
|---|
| 138 |
|
|---|
| 139 |
$(P |
|---|
| 140 |
Each documentation comment is associated with a declaration. |
|---|
| 141 |
If the documentation comment is on a line by itself or with only whitespace |
|---|
| 142 |
to the left, it refers to the next |
|---|
| 143 |
declaration. |
|---|
| 144 |
Multiple documentation comments applying to the same declaration |
|---|
| 145 |
are concatenated. |
|---|
| 146 |
Documentation comments not associated with a declaration are ignored. |
|---|
| 147 |
Documentation comments preceding the $(I ModuleDeclaration) apply to the |
|---|
| 148 |
entire module. |
|---|
| 149 |
If the documentation comment appears on the same line to the right of a |
|---|
| 150 |
declaration, it applies to that. |
|---|
| 151 |
) |
|---|
| 152 |
|
|---|
| 153 |
$(P |
|---|
| 154 |
If a documentation comment for a declaration consists only of the |
|---|
| 155 |
identifier $(TT ditto) |
|---|
| 156 |
then the documentation comment for the previous declaration at the same |
|---|
| 157 |
declaration scope is applied to this declaration as well. |
|---|
| 158 |
) |
|---|
| 159 |
|
|---|
| 160 |
$(P |
|---|
| 161 |
If there is no documentation comment for a declaration, that declaration |
|---|
| 162 |
may not appear in the output. To ensure it does appear in the output, |
|---|
| 163 |
put an empty declaration comment for it. |
|---|
| 164 |
) |
|---|
| 165 |
|
|---|
| 166 |
------------------------------------ |
|---|
| 167 |
int a; /// documentation for a; b has no documentation |
|---|
| 168 |
int b; |
|---|
| 169 |
|
|---|
| 170 |
/** documentation for c and d */ |
|---|
| 171 |
/** more documentation for c and d */ |
|---|
| 172 |
int c; |
|---|
| 173 |
/** ditto */ |
|---|
| 174 |
int d; |
|---|
| 175 |
|
|---|
| 176 |
/** documentation for e and f */ int e; |
|---|
| 177 |
int f; /// ditto |
|---|
| 178 |
|
|---|
| 179 |
/** documentation for g */ |
|---|
| 180 |
int g; /// more documentation for g |
|---|
| 181 |
|
|---|
| 182 |
/// documentation for C and D |
|---|
| 183 |
class C { |
|---|
| 184 |
int x; /// documentation for C.x |
|---|
| 185 |
|
|---|
| 186 |
/** documentation for C.y and C.z */ |
|---|
| 187 |
int y; |
|---|
| 188 |
int z; /// ditto |
|---|
| 189 |
} |
|---|
| 190 |
|
|---|
| 191 |
/// ditto |
|---|
| 192 |
class D { } |
|---|
| 193 |
------------------------------------ |
|---|
| 194 |
|
|---|
| 195 |
<h3>Sections</h3> |
|---|
| 196 |
|
|---|
| 197 |
$(P |
|---|
| 198 |
The document comment is a series of $(I Section)s. |
|---|
| 199 |
A $(I Section) is a name that is the first non-blank character on |
|---|
| 200 |
a line immediately followed by a ':'. This name forms the section name. |
|---|
| 201 |
The section name is not case sensitive. |
|---|
| 202 |
) |
|---|
| 203 |
|
|---|
| 204 |
<h4>Summary</h4> |
|---|
| 205 |
|
|---|
| 206 |
$(P |
|---|
| 207 |
The first section is the $(I Summary), and does not have a section name. |
|---|
| 208 |
It is first paragraph, up to a blank line or a section name. |
|---|
| 209 |
While the summary can be any length, try to keep it to one line. |
|---|
| 210 |
The $(I Summary) section is optional. |
|---|
| 211 |
) |
|---|
| 212 |
|
|---|
| 213 |
<h4>Description</h4> |
|---|
| 214 |
|
|---|
| 215 |
$(P |
|---|
| 216 |
The next unnamed section is the $(I Description). |
|---|
| 217 |
It consists of all the paragraphs following the $(I Summary) until |
|---|
| 218 |
a section name is encountered or the end of the comment. |
|---|
| 219 |
) |
|---|
| 220 |
|
|---|
| 221 |
$(P |
|---|
| 222 |
While the $(I Description) section is optional, |
|---|
| 223 |
there cannot be a $(I Description) without a $(I Summary) section. |
|---|
| 224 |
) |
|---|
| 225 |
|
|---|
| 226 |
------------------------------------ |
|---|
| 227 |
/*********************************** |
|---|
| 228 |
* Brief summary of what |
|---|
| 229 |
* myfunc does, forming the summary section. |
|---|
| 230 |
* |
|---|
| 231 |
* First paragraph of synopsis description. |
|---|
| 232 |
* |
|---|
| 233 |
* Second paragraph of |
|---|
| 234 |
* synopsis description. |
|---|
| 235 |
*/ |
|---|
| 236 |
|
|---|
| 237 |
void myfunc() { } |
|---|
| 238 |
------------------------------------ |
|---|
| 239 |
|
|---|
| 240 |
$(P |
|---|
| 241 |
Named sections follow the $(I Summary) and $(I Description) unnamed sections. |
|---|
| 242 |
) |
|---|
| 243 |
|
|---|
| 244 |
<h3>Standard Sections</h3> |
|---|
| 245 |
|
|---|
| 246 |
$(P |
|---|
| 247 |
For consistency and predictability, there are several standard sections. |
|---|
| 248 |
None of these are required to be present. |
|---|
| 249 |
) |
|---|
| 250 |
|
|---|
| 251 |
<dl> |
|---|
| 252 |
|
|---|
| 253 |
<dt> $(B Authors:) |
|---|
| 254 |
<dd> Lists the author(s) of the declaration. |
|---|
| 255 |
------------------------------------ |
|---|
| 256 |
/** |
|---|
| 257 |
* Authors: Melvin D. Nerd, melvin@mailinator.com |
|---|
| 258 |
*/ |
|---|
| 259 |
------------------------------------ |
|---|
| 260 |
|
|---|
| 261 |
<dt> $(B Bugs:) |
|---|
| 262 |
<dd> Lists any known bugs. |
|---|
| 263 |
------------------------------------ |
|---|
| 264 |
/** |
|---|
| 265 |
* Bugs: Doesn't work for negative values. |
|---|
| 266 |
*/ |
|---|
| 267 |
------------------------------------ |
|---|
| 268 |
|
|---|
| 269 |
<dt> $(B Date:) |
|---|
| 270 |
<dd> Specifies the date of the current revision. The date should be in a form |
|---|
| 271 |
parseable by std.date. |
|---|
| 272 |
|
|---|
| 273 |
------------------------------------ |
|---|
| 274 |
/** |
|---|
| 275 |
* Date: March 14, 2003 |
|---|
| 276 |
*/ |
|---|
| 277 |
------------------------------------ |
|---|
| 278 |
|
|---|
| 279 |
<dt> $(B Deprecated:) |
|---|
| 280 |
<dd> Provides an explanation for and corrective action to take if the associated |
|---|
| 281 |
declaration is marked as deprecated. |
|---|
| 282 |
|
|---|
| 283 |
------------------------------------ |
|---|
| 284 |
/** |
|---|
| 285 |
* Deprecated: superseded by function bar(). |
|---|
| 286 |
*/ |
|---|
| 287 |
|
|---|
| 288 |
deprecated void foo() { ... } |
|---|
| 289 |
------------------------------------ |
|---|
| 290 |
|
|---|
| 291 |
<dt> $(B Examples:) |
|---|
| 292 |
<dd> Any usage examples |
|---|
| 293 |
------------------------------------ |
|---|
| 294 |
/** |
|---|
| 295 |
* Examples: |
|---|
| 296 |
* -------------------- |
|---|
| 297 |
* writefln("3"); // writes '3' to stdout |
|---|
| 298 |
* -------------------- |
|---|
| 299 |
*/ |
|---|
| 300 |
------------------------------------ |
|---|
| 301 |
|
|---|
| 302 |
<dt> $(B History:) |
|---|
| 303 |
<dd> Revision history. |
|---|
| 304 |
------------------------------------ |
|---|
| 305 |
/** |
|---|
| 306 |
* History: |
|---|
| 307 |
* V1 is initial version |
|---|
| 308 |
* |
|---|
| 309 |
* V2 added feature X |
|---|
| 310 |
*/ |
|---|
| 311 |
------------------------------------ |
|---|
| 312 |
|
|---|
| 313 |
<dt> $(B License:) |
|---|
| 314 |
<dd> Any license information for copyrighted code. |
|---|
| 315 |
------------------------------------ |
|---|
| 316 |
/** |
|---|
| 317 |
* License: use freely for any purpose |
|---|
| 318 |
*/ |
|---|
| 319 |
|
|---|
| 320 |
void bar() { ... } |
|---|
| 321 |
------------------------------------ |
|---|
| 322 |
|
|---|
| 323 |
<dt> $(B Returns:) |
|---|
| 324 |
<dd> Explains the return value of the function. |
|---|
| 325 |
If the function returns $(B void), don't redundantly document it. |
|---|
| 326 |
------------------------------------ |
|---|
| 327 |
/** |
|---|
| 328 |
* Read the file. |
|---|
| 329 |
* Returns: The contents of the file. |
|---|
| 330 |
*/ |
|---|
| 331 |
|
|---|
| 332 |
void[] readFile(char[] filename) { ... } |
|---|
| 333 |
------------------------------------ |
|---|
| 334 |
|
|---|
| 335 |
<dt> $(B See_Also:) |
|---|
| 336 |
<dd> List of other symbols and URL's to related items. |
|---|
| 337 |
------------------------------------ |
|---|
| 338 |
/** |
|---|
| 339 |
* See_Also: |
|---|
| 340 |
* foo, bar, http://www.digitalmars.com/d/phobos/index.html |
|---|
| 341 |
*/ |
|---|
| 342 |
------------------------------------ |
|---|
| 343 |
|
|---|
| 344 |
<dt> $(B Standards:) |
|---|
| 345 |
<dd> If this declaration is compliant with any particular standard, |
|---|
| 346 |
the description of it goes here. |
|---|
| 347 |
------------------------------------ |
|---|
| 348 |
/** |
|---|
| 349 |
* Standards: Conforms to DSPEC-1234 |
|---|
| 350 |
*/ |
|---|
| 351 |
------------------------------------ |
|---|
| 352 |
|
|---|
| 353 |
<dt> $(B Throws:) |
|---|
| 354 |
<dd> Lists exceptions thrown and under what circumstances they are thrown. |
|---|
| 355 |
------------------------------------ |
|---|
| 356 |
/** |
|---|
| 357 |
* Write the file. |
|---|
| 358 |
* Throws: WriteException on failure. |
|---|
| 359 |
*/ |
|---|
| 360 |
|
|---|
| 361 |
void writeFile(char[] filename) { ... } |
|---|
| 362 |
------------------------------------ |
|---|
| 363 |
|
|---|
| 364 |
<dt> $(B Version:) |
|---|
| 365 |
<dd> Specifies the current version of the declaration. |
|---|
| 366 |
------------------------------------ |
|---|
| 367 |
/** |
|---|
| 368 |
* Version: 1.6a |
|---|
| 369 |
*/ |
|---|
| 370 |
------------------------------------ |
|---|
| 371 |
</dl> |
|---|
| 372 |
|
|---|
| 373 |
<h3>Special Sections</h3> |
|---|
| 374 |
|
|---|
| 375 |
$(P |
|---|
| 376 |
Some sections have specialized meanings and syntax. |
|---|
| 377 |
) |
|---|
| 378 |
|
|---|
| 379 |
<dl> |
|---|
| 380 |
|
|---|
| 381 |
<dt> $(B Copyright:) |
|---|
| 382 |
<dd> This contains the copyright notice. The macro COPYRIGHT is set to |
|---|
| 383 |
the contents of the section when it documents the module declaration. |
|---|
| 384 |
The copyright section only gets this special treatment when it |
|---|
| 385 |
is for the module declaration. |
|---|
| 386 |
|
|---|
| 387 |
------------------------------------ |
|---|
| 388 |
/** Copyright: Public Domain */ |
|---|
| 389 |
|
|---|
| 390 |
module foo; |
|---|
| 391 |
------------------------------------ |
|---|
| 392 |
|
|---|
| 393 |
<dt> $(B Params:) |
|---|
| 394 |
<dd> Function parameters can be documented by listing them in a params |
|---|
| 395 |
section. Each line that starts with an identifier followed by |
|---|
| 396 |
an '=' starts a new parameter description. A description can |
|---|
| 397 |
span multiple lines. |
|---|
| 398 |
|
|---|
| 399 |
------------------------ |
|---|
| 400 |
/*********************************** |
|---|
| 401 |
* foo does this. |
|---|
| 402 |
* Params: |
|---|
| 403 |
* x = is for this |
|---|
| 404 |
* and not for that |
|---|
| 405 |
* y = is for that |
|---|
| 406 |
*/ |
|---|
| 407 |
|
|---|
| 408 |
void foo(int x, int y) |
|---|
| 409 |
{ |
|---|
| 410 |
} |
|---|
| 411 |
------------------------- |
|---|
| 412 |
|
|---|
| 413 |
<dt> $(B Macros:) </dt> |
|---|
| 414 |
<dd> The macros section follows the same syntax as the $(B Params:) section. |
|---|
| 415 |
It's a series of $(I NAME)=$(I value) pairs. |
|---|
| 416 |
The $(I NAME) is the macro name, and $(I value) is the replacement |
|---|
| 417 |
text. |
|---|
| 418 |
------------------------------------ |
|---|
| 419 |
/** |
|---|
| 420 |
* Macros: |
|---|
| 421 |
* FOO = now is the time for |
|---|
| 422 |
* all good men |
|---|
| 423 |
* BAR = bar |
|---|
| 424 |
* MAGENTA = <font color=magenta>$0</font> |
|---|
| 425 |
*/ |
|---|
| 426 |
------------------------------------ |
|---|
| 427 |
</dl> |
|---|
| 428 |
|
|---|
| 429 |
<h2>Highlighting</h2> |
|---|
| 430 |
|
|---|
| 431 |
<h4>Embedded Comments</h4> |
|---|
| 432 |
|
|---|
| 433 |
$(P |
|---|
| 434 |
The documentation comments can themselves be commented using |
|---|
| 435 |
the $(DDOC_COMMENT comment text) syntax. These comments do not |
|---|
| 436 |
nest. |
|---|
| 437 |
) |
|---|
| 438 |
|
|---|
| 439 |
<h4>Embedded Code</h4> |
|---|
| 440 |
|
|---|
| 441 |
$(P |
|---|
| 442 |
D code can be embedded using lines with at least three hyphens |
|---|
| 443 |
in them to delineate the code section: |
|---|
| 444 |
) |
|---|
| 445 |
|
|---|
| 446 |
------------------------------------ |
|---|
| 447 |
/++++++++++++++++++++++++ |
|---|
| 448 |
+ Our function. |
|---|
| 449 |
+ Example: |
|---|
| 450 |
+ -------------------------- |
|---|
| 451 |
+ import std.stdio; |
|---|
| 452 |
+ |
|---|
| 453 |
+ void foo() |
|---|
| 454 |
+ { |
|---|
| 455 |
+ writefln("foo!"); /* print the string */ |
|---|
| 456 |
+ } |
|---|
| 457 |
+ -------------------------- |
|---|
| 458 |
+/ |
|---|
| 459 |
------------------------------------ |
|---|
| 460 |
|
|---|
| 461 |
$(P |
|---|
| 462 |
Note that the documentation comment uses the $(D_COMMENT /++ ... +/) |
|---|
| 463 |
form |
|---|
| 464 |
so that $(D_COMMENT /* ... */) can be used inside the code section. |
|---|
| 465 |
) |
|---|
| 466 |
|
|---|
| 467 |
<h4>Embedded HTML</h4> |
|---|
| 468 |
|
|---|
| 469 |
$(P |
|---|
| 470 |
HTML can be embedded into the documentation comments, and it will |
|---|
| 471 |
be passed through to the HTML output unchanged. |
|---|
| 472 |
However, since it is not necessarily true that HTML will be the desired |
|---|
| 473 |
output format of the embedded documentation comment extractor, it is |
|---|
| 474 |
best to avoid using it where practical. |
|---|
| 475 |
) |
|---|
| 476 |
|
|---|
| 477 |
------------------------------------ |
|---|
| 478 |
/** Example of embedded HTML: |
|---|
| 479 |
* $(OL |
|---|
| 480 |
* <li> <a href="http://www.digitalmars.com">Digital Mars</a> </li> |
|---|
| 481 |
* <li> <a href="http://www.classicempire.com">Empire</a> </li> |
|---|
| 482 |
* ) |
|---|
| 483 |
*/ |
|---|
| 484 |
------------------------------------ |
|---|
| 485 |
|
|---|
| 486 |
<h4>Emphasis</h4> |
|---|
| 487 |
|
|---|
| 488 |
$(P |
|---|
| 489 |
Identifiers in documentation comments that are function parameters or are |
|---|
| 490 |
names that are in scope at the associated declaration are emphasized in |
|---|
| 491 |
the output. |
|---|
| 492 |
This emphasis can take the form of italics, boldface, a hyperlink, etc. |
|---|
| 493 |
How it is emphasized depends on what it is - a function parameter, type, |
|---|
| 494 |
D keyword, etc. |
|---|
| 495 |
To prevent unintended emphasis of an identifier, it can be preceded by |
|---|
| 496 |
an underscore (_). The underscore will be stripped from the output. |
|---|
| 497 |
) |
|---|
| 498 |
|
|---|
| 499 |
<h4>Character Entities</h4> |
|---|
| 500 |
|
|---|
| 501 |
$(P |
|---|
| 502 |
Some characters have special meaning |
|---|
| 503 |
to the documentation processor, to avoid confusion it can be best |
|---|
| 504 |
to replace them with their corresponding character entities: |
|---|
| 505 |
) |
|---|
| 506 |
|
|---|
| 507 |
$(TABLE2 Characters and Entities, |
|---|
| 508 |
$(TR $(TH Character) $(TH Entity)) |
|---|
| 509 |
$(TR $(TD < )$(TD &lt; )) |
|---|
| 510 |
$(TR $(TD > )$(TD &gt; )) |
|---|
| 511 |
$(TR $(TD & )$(TD &amp; )) |
|---|
| 512 |
) |
|---|
| 513 |
|
|---|
| 514 |
$(P |
|---|
| 515 |
It is not necessary to do this inside a code section, or if the |
|---|
| 516 |
special character is not immediately followed by a # or a letter. |
|---|
| 517 |
) |
|---|
| 518 |
|
|---|
| 519 |
<h4>No Documentation<h4> |
|---|
| 520 |
|
|---|
| 521 |
$(P |
|---|
| 522 |
No documentation is generated for the following constructs, |
|---|
| 523 |
even if they have a documentation comment: |
|---|
| 524 |
) |
|---|
| 525 |
|
|---|
| 526 |
$(UL |
|---|
| 527 |
$(LI Invariants) |
|---|
| 528 |
$(V2 $(LI Postblits)) |
|---|
| 529 |
$(LI Destructors) |
|---|
| 530 |
$(LI Static constructors and static destructors) |
|---|
| 531 |
$(LI Class info, type info, and module info) |
|---|
| 532 |
) |
|---|
| 533 |
|
|---|
| 534 |
<h2>Macros</h2> |
|---|
| 535 |
|
|---|
| 536 |
$(P |
|---|
| 537 |
The documentation comment processor includes a simple macro |
|---|
| 538 |
text preprocessor. |
|---|
| 539 |
When a $($(I NAME)) appears |
|---|
| 540 |
in section text it is replaced with $(I NAME)'s corresponding |
|---|
| 541 |
replacement text. |
|---|
| 542 |
The replacement text is then recursively scanned for more macros. |
|---|
| 543 |
If a macro is recursively encountered, with no argument or with |
|---|
| 544 |
the same argument text as the enclosing macro, it is replaced |
|---|
| 545 |
with no text. |
|---|
| 546 |
Macro invocations that cut across replacement text boundaries are |
|---|
| 547 |
not expanded. |
|---|
| 548 |
If the macro name is undefined, the replacement text has no characters |
|---|
| 549 |
in it. |
|---|
| 550 |
If a $(NAME) is desired to exist in the output without being |
|---|
| 551 |
macro expanded, the $ should be replaced with &#36;. |
|---|
| 552 |
) |
|---|
| 553 |
|
|---|
| 554 |
$(P |
|---|
| 555 |
Macros can have arguments. Any text from the end of the identifier |
|---|
| 556 |
to the closing $(SINGLEQUOTE $(RPAREN)) is the $0 argument. |
|---|
| 557 |
A $0 in the replacement text is |
|---|
| 558 |
replaced with the argument text. |
|---|
| 559 |
If there are commas in the argument text, $1 will represent the |
|---|
| 560 |
argument text up to the first comma, $2 from the first comma to |
|---|
| 561 |
the second comma, etc., up to $9. |
|---|
| 562 |
$+ represents the text from the first comma to the closing $(SINGLEQUOTE $(RPAREN)). |
|---|
| 563 |
The argument text can contain nested parentheses, "" or '' strings, |
|---|
| 564 |
<!-- ... --> comments, or tags. |
|---|
| 565 |
If stray, unnested parentheses are used, they can be replaced with |
|---|
| 566 |
the entity &#40; for ( and &#41; for ). |
|---|
| 567 |
) |
|---|
| 568 |
|
|---|
| 569 |
$(P |
|---|
| 570 |
Macro definitions come from the following sources, |
|---|
| 571 |
in the specified order: |
|---|
| 572 |
) |
|---|
| 573 |
|
|---|
| 574 |
$(OL |
|---|
| 575 |
$(LI Predefined macros.) |
|---|
| 576 |
$(LI Definitions from file specified by $(LINK2 dmd-windows.html#sc_ini, sc.ini)'s |
|---|
| 577 |
or $(LINK2 dmd-linux.html#dmd_conf, dmd.conf) DDOCFILE setting.) |
|---|
| 578 |
$(LI Definitions from *.ddoc files specified on the command line.) |
|---|
| 579 |
$(LI Runtime definitions generated by Ddoc.) |
|---|
| 580 |
$(LI Definitions from any Macros: sections.) |
|---|
| 581 |
) |
|---|
| 582 |
|
|---|
| 583 |
$(P |
|---|
| 584 |
Macro redefinitions replace previous definitions of the same name. |
|---|
| 585 |
This means that the sequence of macro definitions from the various |
|---|
| 586 |
sources forms a hierarchy. |
|---|
| 587 |
) |
|---|
| 588 |
|
|---|
| 589 |
$(P |
|---|
| 590 |
Macro names beginning with "D_" and "DDOC_" are reserved. |
|---|
| 591 |
) |
|---|
| 592 |
|
|---|
| 593 |
<h3>Predefined Macros</h3> |
|---|
| 594 |
|
|---|
| 595 |
$(P |
|---|
| 596 |
These are hardwired into Ddoc, and represent the |
|---|
| 597 |
minimal definitions needed by Ddoc to format and highlight |
|---|
| 598 |
the presentation. |
|---|
| 599 |
The definitions are for simple HTML. |
|---|
| 600 |
) |
|---|
| 601 |
|
|---|
| 602 |
$(DDOCCODE |
|---|
| 603 |
B = <b>$0</b> |
|---|
| 604 |
I = <i>$0</i> |
|---|
| 605 |
U = <u>$0</u> |
|---|
| 606 |
P = <p>$0</p> |
|---|
| 607 |
DL = <dl>$0</dl> |
|---|
| 608 |
DT = <dt>$0</dt> |
|---|
| 609 |
DD = <dd>$0</dd> |
|---|
| 610 |
TABLE = <table>$0</table> |
|---|
| 611 |
TR = <tr>$0</tr> |
|---|
| 612 |
TH = <th>$0</th> |
|---|
| 613 |
TD = <td>$0</td> |
|---|
| 614 |
OL = <ol>$0</ol> |
|---|
| 615 |
UL = <ul>$0</ul> |
|---|
| 616 |
LI = <li>$0</li> |
|---|
| 617 |
BIG = <big>$0</big> |
|---|
| 618 |
SMALL = <small>$0</small> |
|---|
| 619 |
BR = <br> |
|---|
| 620 |
LINK = <a href="$0">$0</a> |
|---|
| 621 |
LINK2 = <a href="$1">$+</a> |
|---|
| 622 |
LPAREN= $(LPAREN) |
|---|
| 623 |
RPAREN= $(RPAREN) |
|---|
| 624 |
|
|---|
| 625 |
RED = <font color=red>$0</font> |
|---|
| 626 |
BLUE = <font color=blue>$0</font> |
|---|
| 627 |
GREEN = <font color=green>$0</font> |
|---|
| 628 |
YELLOW =<font color=yellow>$0</font> |
|---|
| 629 |
BLACK = <font color=black>$0</font> |
|---|
| 630 |
WHITE = <font color=white>$0</font> |
|---|
| 631 |
|
|---|
| 632 |
D_CODE = <pre class="d_code">$0</pre> |
|---|
| 633 |
D_COMMENT = $(GREEN $0) |
|---|
| 634 |
D_STRING = $(RED $0) |
|---|
| 635 |
D_KEYWORD = $(BLUE $0) |
|---|
| 636 |
D_PSYMBOL = $(U $0) |
|---|
| 637 |
D_PARAM = $(I $0) |
|---|
| 638 |
|
|---|
| 639 |
DDOC = <html><head> |
|---|
| 640 |
<META http-equiv="content-type" content="text/html; charset=utf-8"> |
|---|
| 641 |
<title>$(TITLE)</title> |
|---|
| 642 |
</head><body> |
|---|
| 643 |
<h1>$(TITLE)</h1> |
|---|
| 644 |
$(BODY) |
|---|
| 645 |
</body></html> |
|---|
| 646 |
|
|---|
| 647 |
DDOC_COMMENT = <!-- $0 --> |
|---|
| 648 |
DDOC_DECL = $(DT $(BIG $0)) |
|---|
| 649 |
DDOC_DECL_DD = $(DD $0) |
|---|
| 650 |
DDOC_DITTO = $(BR)$0 |
|---|
| 651 |
DDOC_SECTIONS = $0 |
|---|
| 652 |
DDOC_SUMMARY = $0$(BR)$(BR) |
|---|
| 653 |
DDOC_DESCRIPTION = $0$(BR)$(BR) |
|---|
| 654 |
DDOC_AUTHORS = $(B Authors:)$(BR) |
|---|
| 655 |
$0$(BR)$(BR) |
|---|
| 656 |
DDOC_BUGS = $(RED BUGS:)$(BR) |
|---|
| 657 |
$0$(BR)$(BR) |
|---|
| 658 |
DDOC_COPYRIGHT = $(B Copyright:)$(BR) |
|---|
| 659 |
$0$(BR)$(BR) |
|---|
| 660 |
DDOC_DATE = $(B Date:)$(BR) |
|---|
| 661 |
$0$(BR)$(BR) |
|---|
| 662 |
DDOC_DEPRECATED = $(RED Deprecated:)$(BR) |
|---|
| 663 |
$0$(BR)$(BR) |
|---|
| 664 |
DDOC_EXAMPLES = $(B Examples:)$(BR) |
|---|
| 665 |
$0$(BR)$(BR) |
|---|
| 666 |
DDOC_HISTORY = $(B History:)$(BR) |
|---|
| 667 |
$0$(BR)$(BR) |
|---|
| 668 |
DDOC_LICENSE = $(B License:)$(BR) |
|---|
| 669 |
$0$(BR)$(BR) |
|---|
| 670 |
DDOC_RETURNS = $(B Returns:)$(BR) |
|---|
| 671 |
$0$(BR)$(BR) |
|---|
| 672 |
DDOC_SEE_ALSO = $(B See Also:)$(BR) |
|---|
| 673 |
$0$(BR)$(BR) |
|---|
| 674 |
DDOC_STANDARDS = $(B Standards:)$(BR) |
|---|
| 675 |
$0$(BR)$(BR) |
|---|
| 676 |
DDOC_THROWS = $(B Throws:)$(BR) |
|---|
| 677 |
$0$(BR)$(BR) |
|---|
| 678 |
DDOC_VERSION = $(B Version:)$(BR) |
|---|
| 679 |
$0$(BR)$(BR) |
|---|
| 680 |
DDOC_SECTION_H = $(B $0)$(BR)$(BR) |
|---|
| 681 |
DDOC_SECTION = $0$(BR)$(BR) |
|---|
| 682 |
DDOC_MEMBERS = $(DL $0) |
|---|
| 683 |
DDOC_MODULE_MEMBERS = $(DDOC_MEMBERS $0) |
|---|
| 684 |
DDOC_CLASS_MEMBERS = $(DDOC_MEMBERS $0) |
|---|
| 685 |
DDOC_STRUCT_MEMBERS = $(DDOC_MEMBERS $0) |
|---|
| 686 |
DDOC_ENUM_MEMBERS = $(DDOC_MEMBERS $0) |
|---|
| 687 |
DDOC_TEMPLATE_MEMBERS = $(DDOC_MEMBERS $0) |
|---|
| 688 |
DDOC_PARAMS = $(B Params:)$(BR)\n$(TABLE $0)$(BR) |
|---|
| 689 |
DDOC_PARAM_ROW = $(TR $0) |
|---|
| 690 |
DDOC_PARAM_ID = $(TD $0) |
|---|
| 691 |
DDOC_PARAM_DESC = $(TD $0) |
|---|
| 692 |
DDOC_BLANKLINE = $(BR)$(BR) |
|---|
| 693 |
|
|---|
| 694 |
DDOC_PSYMBOL = $(U $0) |
|---|
| 695 |
DDOC_KEYWORD = $(B $0) |
|---|
| 696 |
DDOC_PARAM = $(I $0) |
|---|
| 697 |
) |
|---|
| 698 |
|
|---|
| 699 |
$(P |
|---|
| 700 |
Ddoc does not generate HTML code. It formats into the basic |
|---|
| 701 |
formatting macros, which (in their predefined form) |
|---|
| 702 |
are then expanded into HTML. |
|---|
| 703 |
If output other than HTML is desired, then these macros |
|---|
| 704 |
need to be redefined. |
|---|
| 705 |
) |
|---|
| 706 |
|
|---|
| 707 |
$(TABLE2 Basic Formatting Macros, |
|---|
| 708 |
$(TR $(TD $(B B)) $(TD boldface the argument)) |
|---|
| 709 |
$(TR $(TD $(B I)) $(TD italicize the argument)) |
|---|
| 710 |
$(TR $(TD $(B U)) $(TD underline the argument)) |
|---|
| 711 |
$(TR $(TD $(B P)) $(TD argument is a paragraph)) |
|---|
| 712 |
$(TR $(TD $(B DL)) $(TD argument is a definition list)) |
|---|
| 713 |
$(TR $(TD $(B DT)) $(TD argument is a definition in a definition list)) |
|---|
| 714 |
$(TR $(TD $(B DD)) $(TD argument is a description of a definition)) |
|---|
| 715 |
$(TR $(TD $(B TABLE)) $(TD argument is a table)) |
|---|
| 716 |
$(TR $(TD $(B TR)) $(TD argument is a row in a table)) |
|---|
| 717 |
$(TR $(TD $(B TH)) $(TD argument is a header entry in a row)) |
|---|
| 718 |
$(TR $(TD $(B TD)) $(TD argument is a data entry in a row)) |
|---|
| 719 |
$(TR $(TD $(B OL)) $(TD argument is an ordered list)) |
|---|
| 720 |
$(TR $(TD $(B UL)) $(TD argument is an unordered list)) |
|---|
| 721 |
$(TR $(TD $(B LI)) $(TD argument is an item in a list)) |
|---|
| 722 |
$(TR $(TD $(B BIG)) $(TD argument is one font size bigger)) |
|---|
| 723 |
$(TR $(TD $(B SMALL)) $(TD argument is one font size smaller)) |
|---|
| 724 |
$(TR $(TD $(B BR)) $(TD start new line)) |
|---|
| 725 |
$(TR $(TD $(B LINK)) $(TD generate clickable link on argument)) |
|---|
| 726 |
$(TR $(TD $(B LINK2)) $(TD generate clickable link, first arg is address)) |
|---|
| 727 |
$(TR $(TD $(B RED)) $(TD argument is set to be red)) |
|---|
| 728 |
$(TR $(TD $(B BLUE)) $(TD argument is set to be blue)) |
|---|
| 729 |
$(TR $(TD $(B GREEN)) $(TD argument is set to be green)) |
|---|
| 730 |
$(TR $(TD $(B YELLOW)) $(TD argument is set to be yellow)) |
|---|
| 731 |
$(TR $(TD $(B BLACK)) $(TD argument is set to be black)) |
|---|
| 732 |
$(TR $(TD $(B WHITE)) $(TD argument is set to be white)) |
|---|
| 733 |
$(TR $(TD $(B D_CODE)) $(TD argument is D code)) |
|---|
| 734 |
$(TR $(TD $(B DDOC)) $(TD overall template for output)) |
|---|
| 735 |
) |
|---|
| 736 |
|
|---|
| 737 |
$(P |
|---|
| 738 |
$(B DDOC) is special in that it specifies the boilerplate into |
|---|
| 739 |
which the entire generated text is inserted (represented by the |
|---|
| 740 |
Ddoc generated macro $(B BODY)). For example, in order |
|---|
| 741 |
to use a style sheet, $(B DDOC) would be redefined as: |
|---|
| 742 |
) |
|---|
| 743 |
|
|---|
| 744 |
$(DDOCCODE |
|---|
| 745 |
DDOC = <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
|---|
| 746 |
<html><head> |
|---|
| 747 |
<META http-equiv="content-type" content="text/html; charset=utf-8"> |
|---|
| 748 |
<title>$(TITLE)</title> |
|---|
| 749 |
<link rel="stylesheet" type="text/css" href="$(B style.css)"> |
|---|
| 750 |
</head><body> |
|---|
| 751 |
<h1>$(TITLE)</h1> |
|---|
| 752 |
$(BODY) |
|---|
| 753 |
</body></html> |
|---|
| 754 |
) |
|---|
| 755 |
|
|---|
| 756 |
$(P |
|---|
| 757 |
$(B DDOC_COMMENT) is used to insert comments into the output |
|---|
| 758 |
file. |
|---|
| 759 |
) |
|---|
| 760 |
|
|---|
| 761 |
$(P |
|---|
| 762 |
Highlighting of D code is performed by the following macros: |
|---|
| 763 |
) |
|---|
| 764 |
|
|---|
| 765 |
$(TABLE2 D Code Formatting Macros, |
|---|
| 766 |
$(TR $(TD $(B D_COMMENT)) $(TD Highlighting of comments)) |
|---|
| 767 |
$(TR $(TD $(B D_STRING)) $(TD Highlighting of string literals)) |
|---|
| 768 |
$(TR $(TD $(B D_KEYWORD)) $(TD Highlighting of D keywords)) |
|---|
| 769 |
$(TR $(TD $(B D_PSYMBOL)) $(TD Highlighting of current declaration name)) |
|---|
| 770 |
$(TR $(TD $(B D_PARAM)) $(TD Highlighting of current function declaration parameters)) |
|---|
| 771 |
) |
|---|
| 772 |
|
|---|
| 773 |
$(P |
|---|
| 774 |
The highlighting macros start with $(B DDOC_). |
|---|
| 775 |
They control the formatting of individual parts of the presentation. |
|---|
| 776 |
) |
|---|
| 777 |
|
|---|
| 778 |
$(TABLE2 Ddoc Section Formatting Macros, |
|---|
| 779 |
$(TR $(TD $(B DDOC_DECL)) $(TD Highlighting of the declaration.)) |
|---|
| 780 |
$(TR $(TD $(B DDOC_DECL_DD)) $(TD Highlighting of the description of a declaration.)) |
|---|
| 781 |
$(TR $(TD $(B DDOC_DITTO)) $(TD Highlighting of ditto declarations.)) |
|---|
| 782 |
$(TR $(TD $(B DDOC_SECTIONS)) $(TD Highlighting of all the sections.)) |
|---|
| 783 |
$(TR $(TD $(B DDOC_SUMMARY)) $(TD Highlighting of the summary section.)) |
|---|
| 784 |
$(TR $(TD $(B DDOC_DESCRIPTION)) $(TD Highlighting of the description section.)) |
|---|
| 785 |
$(TR $(TD $(B DDOC_AUTHORS .. DDOC_VERSION)) $(TD Highlighting of the corresponding standard section.)) |
|---|
| 786 |
$(TR $(TD $(B DDOC_SECTION_H)) $(TD Highlighting of the section name of a non-standard section.)) |
|---|
| 787 |
$(TR $(TD $(B DDOC_SECTION)) $(TD Highlighting of the contents of a non-standard section.)) |
|---|
| 788 |
$(TR $(TD $(B DDOC_MEMBERS)) $(TD Default highlighting of all the members of a class, struct, etc.)) |
|---|
| 789 |
$(TR $(TD $(B DDOC_MODULE_MEMBERS)) $(TD Highlighting of all the members of a module.)) |
|---|
| 790 |
$(TR $(TD $(B DDOC_CLASS_MEMBERS)) $(TD Highlighting of all the members of a class.)) |
|---|
| 791 |
$(TR $(TD $(B DDOC_STRUCT_MEMBERS)) $(TD Highlighting of all the members of a struct.)) |
|---|
| 792 |
$(TR $(TD $(B DDOC_ENUM_MEMBERS)) $(TD Highlighting of all the members of an enum.)) |
|---|
| 793 |
$(TR $(TD $(B DDOC_TEMPLATE_MEMBERS)) $(TD Highlighting of all the members of a template.)) |
|---|
| 794 |
$(TR $(TD $(B DDOC_PARAMS)) $(TD Highlighting of a function parameter section.)) |
|---|
| 795 |
$(TR $(TD $(B DDOC_PARAM_ROW)) $(TD Highlighting of a name=value function parameter.)) |
|---|
| 796 |
$(TR $(TD $(B DDOC_PARAM_ID)) $(TD Highlighting of the parameter name.)) |
|---|
| 797 |
$(TR $(TD $(B DDOC_PARAM_DESC)) $(TD Highlighting of the parameter value.)) |
|---|
| 798 |
$(TR $(TD $(B DDOC_PSYMBOL)) $(TD Highlighting of declaration name to which a particular section is referring.)) |
|---|
| 799 |
$(TR $(TD $(B DDOC_KEYWORD)) $(TD Highlighting of D keywords.)) |
|---|
| 800 |
$(TR $(TD $(B DDOC_PARAM)) $(TD Highlighting of function parameters.)) |
|---|
| 801 |
$(TR $(TD $(B DDOC_BLANKLINE)) $(TD Inserts a blank line.)) |
|---|
| 802 |
) |
|---|
| 803 |
|
|---|
| 804 |
$(P |
|---|
| 805 |
For example, one could redefine $(B DDOC_SUMMARY): |
|---|
| 806 |
) |
|---|
| 807 |
|
|---|
| 808 |
$(DDOCCODE |
|---|
| 809 |
DDOC_SUMMARY = $(GREEN $0) |
|---|
| 810 |
) |
|---|
| 811 |
|
|---|
| 812 |
$(P |
|---|
| 813 |
And all the summary sections will now be green. |
|---|
| 814 |
) |
|---|
| 815 |
|
|---|
| 816 |
<h3>Macro Definitions from $(LINK2 dmd-windows.html#sc_ini, $(TT sc.ini))'s DDOCFILE</h3> |
|---|
| 817 |
|
|---|
| 818 |
$(P |
|---|
| 819 |
A text file of macro definitions can be created, |
|---|
| 820 |
and specified in $(TT sc.ini): |
|---|
| 821 |
) |
|---|
| 822 |
|
|---|
| 823 |
$(DDOCCODE |
|---|
| 824 |
DDOCFILE=myproject.ddoc |
|---|
| 825 |
) |
|---|
| 826 |
|
|---|
| 827 |
<h3>Macro Definitions from .ddoc Files on the Command Line</h3> |
|---|
| 828 |
|
|---|
| 829 |
$(P |
|---|
| 830 |
File names on the DMD command line with the extension |
|---|
| 831 |
.ddoc are text files that are read and processed in order. |
|---|
| 832 |
) |
|---|
| 833 |
|
|---|
| 834 |
<h3>Macro Definitions Generated by Ddoc</h3> |
|---|
| 835 |
|
|---|
| 836 |
$(TABLE2 Generated Macro Definitions, |
|---|
| 837 |
$(TR |
|---|
| 838 |
$(TH Macro Name) |
|---|
| 839 |
$(TH Contents) |
|---|
| 840 |
) |
|---|
| 841 |
$(TR |
|---|
| 842 |
$(TD $(B BODY)) |
|---|
| 843 |
$(TD Set to the generated document text.) |
|---|
| 844 |
) |
|---|
| 845 |
$(TR |
|---|
| 846 |
$(TD $(B TITLE)) |
|---|
| 847 |
$(TD Set to the module name.) |
|---|
| 848 |
) |
|---|
| 849 |
$(TR |
|---|
| 850 |
$(TD $(B DATETIME)) |
|---|
| 851 |
$(TD Set to the current date and time.) |
|---|
| 852 |
) |
|---|
| 853 |
$(TR |
|---|
| 854 |
$(TD $(B YEAR)) |
|---|
| 855 |
$(TD Set to the current year.) |
|---|
| 856 |
) |
|---|
| 857 |
$(TR |
|---|
| 858 |
$(TD $(B COPYRIGHT)) |
|---|
| 859 |
$(TD Set to the contents of any $(B Copyright:) section that is part |
|---|
| 860 |
of the module comment.) |
|---|
| 861 |
) |
|---|
| 862 |
$(TR |
|---|
| 863 |
$(TD $(B DOCFILENAME)) |
|---|
| 864 |
$(TD Set to the name of the generated output file.) |
|---|
| 865 |
) |
|---|
| 866 |
) |
|---|
| 867 |
|
|---|
| 868 |
<h2>Using Ddoc for other Documentation</h2> |
|---|
| 869 |
|
|---|
| 870 |
$(P |
|---|
| 871 |
Ddoc is primarily designed for use in producing documentation |
|---|
| 872 |
from embedded comments. It can also, however, be used for |
|---|
| 873 |
processing other general documentation. |
|---|
| 874 |
The reason for doing this would be to take advantage of the |
|---|
| 875 |
macro capability of Ddoc and the D code syntax highlighting |
|---|
| 876 |
capability. |
|---|
| 877 |
) |
|---|
| 878 |
|
|---|
| 879 |
$(P |
|---|
| 880 |
If the .d source file starts with the string "Ddoc" then it |
|---|
| 881 |
is treated as general purpose documentation, not as a D |
|---|
| 882 |
code source file. From immediately after the "Ddoc" string |
|---|
| 883 |
to the end of the file or any "Macros:" section forms |
|---|
| 884 |
the document. No automatic highlighting is done to that text, |
|---|
| 885 |
other than highlighting of D code embedded between lines |
|---|
| 886 |
delineated with --- lines. Only macro processing is done. |
|---|
| 887 |
) |
|---|
| 888 |
|
|---|
| 889 |
$(P |
|---|
| 890 |
Much of the D documentation itself is generated this way, |
|---|
| 891 |
including this page. |
|---|
| 892 |
Such documentation is marked at the bottom as being |
|---|
| 893 |
generated by Ddoc. |
|---|
| 894 |
) |
|---|
| 895 |
|
|---|
| 896 |
<h2>References</h2> |
|---|
| 897 |
|
|---|
| 898 |
$(P |
|---|
| 899 |
$(LINK2 http://www.dsource.org/projects/helix/wiki/CandyDoc, CandyDoc) |
|---|
| 900 |
is a very nice example of how |
|---|
| 901 |
one can customize the Ddoc results with macros |
|---|
| 902 |
and style sheets. |
|---|
| 903 |
) |
|---|
| 904 |
|
|---|
| 905 |
) |
|---|
| 906 |
|
|---|
| 907 |
Macros: |
|---|
| 908 |
TITLE=Documentation Generator |
|---|
| 909 |
WIKI=Ddoc |
|---|
| 910 |
RPAREN=) |
|---|