Bug 1890 – DDOC removes leading space in D_CODE macro

Status
ASSIGNED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2008-03-03T11:37:33Z
Last change time
2024-12-13T17:48:13Z
Keywords
bootcamp, ddoc, patch, pull
Assigned to
No Owner
Creator
Derek Parnell
Moved to GitHub: dmd#17678 →

Comments

Comment #0 by ddparnell — 2008-03-03T11:37:33Z
The following text ... $(D_CODE aaa bbb ccc ) generates ... <pre> aaa bbb ccc </pre> Notice: (A) That the two spaces before "aaa" have been rendered with only one space. (B) One space preceeds the </pre>. Because the definition of D_CODE is <pre>$0</pre> I expected this instead to be generated ... <pre> aaa bbb ccc </pre>
Comment #1 by samukha — 2008-03-03T12:42:39Z
From the Ddoc spec: "Macros can have arguments. Any text from the end of the identifier to the closing ')' is the $0 argument". The spec does not elaborate on where is the end of the identifier and the start of the text. According to the spec, an undefined number of whitespace characters may be skipped to get to the start of the argument, the rest of whitespace may be arbitrarily replaced with <br><br>. :) The start of the argument might have been defined as the first non-whitespace character or the first vertical space character, whichever comes first.
Comment #2 by ddparnell — 2008-03-03T15:05:34Z
I wish it was using the rule "The start of the argument might have been defined as the first non-whitespace character or the first vertical space character, whichever comes first." because then it would come out as I had expected. But it is definitely just eating the first space character and leaving the rest. Also, in my original post, point (B) is not true. I messed up the test file. Only point (A) is still at fault, IMHO.
Comment #3 by verylonglogin.reg — 2011-11-02T06:06:28Z
Ping. Isn't this bug trivial to fix? And it is an error-prone one, because us usually expects that the start of the argument is "the first non-whitespace character", but it isn't now. Worst of all it is undocumented now. `WEB` macros suffers from this bug, look at broken links to STL at http://d-programming-language.org/phobos/std_range.html#lowerBound
Comment #4 by jdrewsen — 2012-01-20T14:14:43Z
Comment #5 by dlang-bot — 2019-09-27T12:06:27Z
@RazvanN7 created dlang/dmd pull request #10444 "Fix Issue 1890 - DDOC removes leading space in D_CODE macro" fixing this issue: - Fix Issue 1890 - DDOC removes leading space in D_CODE macro https://github.com/dlang/dmd/pull/10444
Comment #6 by robert.schadek — 2024-12-13T17:48:13Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17678 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB