@@ -43,7 +43,7 @@ string parseFile(string path, in string[string] context) {
4343 return parseDdocBody (macros);
4444}
4545
46- string parseDDString (string text, string [string ] macros)
46+ string parseDDString (string text, string [string ] macros, bool removeUnknown = true )
4747{
4848 import ddoc.highlight;
4949 import std.string : strip;
@@ -64,29 +64,33 @@ string parseDDString(string text, string[string] macros)
6464 // macros["COPYRIGHT"] = copyright;
6565 text = highlight(text);
6666 auto lexer = Lexer(text, true );
67- return expand (lexer, macros);
67+ return expand (lexer, macros, removeUnknown );
6868}
6969
7070// /
7171unittest {
7272 import std.stdio , std.string ;
7373
7474 auto text = ` Ddoc
75- This file is a standalone Ddoc file. It can contain any kind of
75+ This file is a $(unknown standalone) Ddoc file. It can contain any kind of
7676 $(MAC macros), defined in the $(MAC 'Macros:' section).
7777
7878Macros:
7979 MAC=$0
8080 _=
8181` ;
8282
83- auto expected = ` This file is a standalone Ddoc file. It can contain any kind of
83+ auto expected1 = ` This file is a Ddoc file. It can contain any kind of
84+ macros, defined in the 'Macros:' section.` ;
85+ auto expected2 = ` This file is a $(unknown standalone) Ddoc file. It can contain any kind of
8486 macros, defined in the 'Macros:' section.` ;
8587
8688 auto lex = Lexer(text, true );
8789 // Whitespace and newline before / after not taken into account.
8890 auto res = parseDDString(text, null ).strip;
89- assert (res == expected, res);
91+ assert (res == expected1, res);
92+ res = parseDDString(text, null , false ).strip;
93+ assert (res == expected2, res);
9094}
9195
9296// Warning: Does not support embedded code / inlining.
0 commit comments