495
495
$(H3 $(LNAME2 inline_code, Inline Code))
496
496
497
497
$(P
498
- Inline code can be written between backtick characters ($(BACKTICK)), similarly
498
+ Inline code can be written between backtick characters (` $(BACKTICK)` ), similarly
499
499
to the syntax used on GitHub, Reddit, Stack Overflow, and other websites. Both
500
- the opening and closing $(BACKTICK) character must appear on the same line to trigger this
500
+ the opening and closing ` $(BACKTICK)` character must appear on the same line to trigger this
501
501
behavior.
502
502
)
503
503
508
508
)
509
509
510
510
$(P
511
- A literal backtick character can be output either as a non-paired $(BACKTICK) on a single
511
+ A literal backtick character can be output either as a non-paired ` $(BACKTICK)` on a single
512
512
line or by using the `$(DOLLAR)(BACKTICK)` macro.
513
513
)
514
514
@@ -913,9 +913,11 @@ $(H2 $(LNAME2 macros, Macros))
913
913
$(P
914
914
The documentation comment processor includes a simple macro
915
915
text preprocessor.
916
- When a $(DOLLAR)($(I NAME)) appears
917
- in section text it is replaced with $(I NAME)s corresponding
918
- replacement text.)
916
+ When $(D $)`(NAME)` appears
917
+ in section text it is replaced with the corresponding `NAME` macro's
918
+ replacement text.
919
+ Macros can take arguments: $(D $)`(NAME argument)`.
920
+ )
919
921
920
922
For example:
921
923
---------
@@ -934,10 +936,10 @@ $(P
934
936
---------
935
937
936
938
$(P
937
- The above would generate the following output :)
939
+ The above would generate output such as :)
938
940
939
941
------------------------------------
940
- <h1>test </h1>
942
+ <h1>math </h1>
941
943
<dl><dt><big><a name="sum"></a>int <u>sum</u>(int <i>a</i>, int <i>b</i>);
942
944
</big></dt>
943
945
<dd>This function returns the <u>sum</u> of <u><i>a</i></u> and <u><i>b</i></u>.
@@ -948,33 +950,65 @@ $(P
948
950
949
951
$(P
950
952
The replacement text is recursively scanned for more macros.
951
- If a macro is recursively encountered, with no argument or with
953
+ If found, they are expanded in turn.
954
+ If a macro already expanded is recursively encountered, with no argument or with
952
955
the same argument text as the enclosing macro, it is replaced
953
956
with no text.
957
+ )
958
+ $(UL
959
+ $(LI
954
960
Macro invocations that cut across replacement text boundaries are
955
961
not expanded.
956
- If the macro name is undefined, the replacement text has no characters
957
- in it.
958
- If a $(DOLLAR)(NAME) is desired to exist in the output without being
959
- macro expanded, the $(DOLLAR) should be $(LINK2 #punctuation_escapes,
962
+ )
963
+ $(LI
964
+ If the macro name is undefined, the replacement text will
965
+ be $(D $)`(DDOC_UNDEFINED_MACRO(NAME))`. This defaults to empty.
966
+ )
967
+ $(LI
968
+ If $(D $)`(NAME)` is required to exist in the output without being
969
+ macro expanded, the `$` can be $(RELATIVE_LINK2 punctuation_escapes,
960
970
backslash-escaped): `\$`.
971
+ )
961
972
)
962
973
974
+ $(H3 $(LNAME2 macro_arguments, Macro Arguments))
975
+
963
976
$(P
964
- Macros can have arguments. Any text from the end of the identifier
965
- to the closing $(SINGLEQUOTE $(RPAREN)) is the $(DOLLAR)0 argument.
966
- A $(DOLLAR)0 in the replacement text is
967
- replaced with the argument text.
968
- If there are commas in the argument text, $(DOLLAR)1 will represent the
969
- argument text up to the first comma, $(DOLLAR)2 from the first comma to
970
- the second comma, etc., up to $(DOLLAR)9.
971
- $(DOLLAR)+ represents the text from the first comma to the closing $(SINGLEQUOTE $(RPAREN)).
972
- The argument text can contain nested parentheses, "" or '' strings,
977
+ When invoking a macro, any text from the end of the identifier
978
+ to the closing $(SINGLEQUOTE $(RPAREN)) is passed as arguments to
979
+ the macro, and can be referred to using the
980
+ $(D $)`0` parameter inside the macro definition.
981
+ A $(D $)`0` in the replacement text is
982
+ replaced with the text of each argument, separated by commas.
983
+ )
984
+ $(P
985
+ If there are commas in the argument text, this denotes multiple arguments.
986
+ Inside a macro definition, $(D $)`1` will represent the
987
+ argument text up to the first comma, $(D $)`2` from the first comma to
988
+ the second comma, etc., up to $(D $)`9`.
989
+ $(D $)`+` represents the text from the first comma to the closing $(SINGLEQUOTE $(RPAREN)).
990
+ )
991
+ $(UL
992
+ $(LI
993
+ The argument text can contain nested parentheses, `""` or `''` strings,
973
994
$(D <)$(D !--) $(D ...) $(D --)$(D >) comments, or tags.
995
+ )
996
+ $(LI
974
997
If stray, unnested parentheses are used, they can be
975
- $(LINK2 #punctuation_escapes, backslash-escaped): `\(` or `\)`.
998
+ $(RELATIVE_LINK2 punctuation_escapes, backslash-escaped): `\(` or `\)`.
999
+ )
1000
+ $(LI
1001
+ Any literal commas not intended as an argument separator can be
1002
+ escaped when invoking a macro expecting separate arguments.
1003
+ Defining an `ARGS=`$(D $)`0` macro can be useful to handle commas -
1004
+ these are equivalent:
1005
+ * $(D $)`(FOO one, `$(D $)`(ARGS two, dwa, dos), three)`
1006
+ * $(D $)`(FOO one, two\, dwa\, dos, three)`.
1007
+ )
976
1008
)
977
1009
1010
+ $(H3 $(LNAME2 macro_definitions, Macro Definitions))
1011
+
978
1012
$(P
979
1013
Macro definitions come from the following sources,
980
1014
in the specified order:
987
1021
or $(DDSUBLINK dmd-linux, dmd_conf, dmd.conf) DDOCFILE setting.)
988
1022
$(LI Definitions from *.ddoc files specified on the command line.)
989
1023
$(LI Runtime definitions generated by Ddoc.)
990
- $(LI Definitions from any Macros: sections.)
1024
+ $(LI Definitions from any ` Macros:` sections.)
991
1025
)
992
1026
993
1027
$(P
0 commit comments