www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1890] New: DDOC removes leading space in D_CODE macro

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1890

           Summary: DDOC removes leading space in D_CODE macro
           Product: D
           Version: 2.011
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: ddparnell bigpond.com


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>


-- 
Mar 03 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1890





------- Comment #1 from samukha voliacable.com  2008-03-03 12:42 -------
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.


-- 
Mar 03 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1890





------- Comment #2 from ddparnell bigpond.com  2008-03-03 15:05 -------
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.


-- 
Mar 03 2008