Ddoc WEB function
simendsjo
simendsjo at gmail.com
Thu Oct 3 03:59:36 PDT 2013
On Thursday, 3 October 2013 at 10:46:00 UTC, Joseph Rushton
Wakeling wrote:
> On 02/10/13 21:34, Jonathan M Davis wrote:
>> It's not a bug at all. It's in
>>
>> https://github.com/D-Programming-Language/dlang.org/blob/master/std.ddoc
>>
>> ddoc is a macro language and does not at all restrict you to
>> what comes with
>> it, and the standard library uses quite a few macros that are
>> specific to it
>> (e.g. XREF for a link to another module in std). When you run
>> dmd with -D, you
>> can give it a .ddoc file which contains macros that you define
>> (or redefine), and
>> std.ddoc is the one that the standard library uses.
>
> Ahh, OK, thanks.
>
>> If you to restrict yourself to the built-in ones in your code,
>> then use the
>> ones at
>>
>> http://dlang.org/ddoc.html
>>
>> And if you want to define more, then create your own .ddoc
>> file with them in it.
>> But Phobos uses std.ddoc, and we add new macros to it when we
>> feel that it's
>> appropriate.
>
> Fair enough, but ...
>
>>> , and is there any particular reason to favour WEB over, say,
>>> LINK2 ?
>>
>> It's less verbose.
>
> ... is there any difference between WEB and LINK2 apart from
> the length? And if so, why not just include WEB among the
> built-in macros?
Doesn't WEB just add "http://" before the first parameter?
LINK2 = <a href="$1">$+</a>
WEB = <a href="http://$1">$+</a>
I don't think there should be too many predefined macros. At
least not all related to HTML. But it's possible to override
them, right?
There are probably plenty of nice-to-have macros that would be
convenient to have always available, but it's pretty trivial to
add them yourself - or just use the phobos ddoc.
More information about the Digitalmars-d-learn
mailing list