ddoc and CODE_HIGHLIGHT macro

Alix Pexton via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 27 01:44:51 PDT 2014


On 26/07/2014 4:31 PM, Nick Treleaven wrote:
> Hi,
> Ddoc doesn't seem to expand a macro near top of
> http://dlang.org/hash-map.html:
>
> // The $(CODE_HIGHLIGHT KeyType) is string
>
> Which is weird because it expands it for 'remove' on this line not far
> below it:
>
> b.remove("hello");
>
> Maybe a bug in dmd?

This is because the macro is used within a comment in a code section 
(between lines of hyphens). Macros are normally expanded within code 
sections, but inside comments they get ignored.

I filed an enhancement request.

https://issues.dlang.org/show_bug.cgi?id=13211

> Also, I build some dlang.org docs individually and CODE_HIGHLIGHT is
> inserting a line break in the html. I think this is because the macro
> has an empty line after it:
>
> CODE_HIGHLIGHT=$(B $(I $0))
>
> MDASH=<nobr>&#x200A;—&#x200A;</nobr>
>
> I can't tell from git blame when it was introduced, the website html
> doesn't show the line break. Is there a workaround, or just remove the
> empty line?

I've reproduced this, it seems it is related to the platform of the 
file, ie a macro with a blank line after it declared in a file with 
windows line endings (CR; + LF;) will have a line break on the end but 
one in file with single character line breaks won't.

I filed that one as a bug.

https://issues.dlang.org/show_bug.cgi?id=13212

A...




More information about the Digitalmars-d-learn mailing list