recursing ddoc macros two arguments at a time
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 16 18:39:20 PST 2015
On 1/16/2015 4:11 PM, Andrei Alexandrescu wrote:
> I thought this isn't possible: http://goo.gl/QTAUFb. This:
>
> $(TOCENTRY comparison.html, D Feature List)
> $(TOCENTRY builtin.html, Rationale for Builtins)
> $(TOCENTRY ctod.html, Converting C to D)
> $(TOCENTRY cpptod.html, Converting C++ to D)
> $(TOCENTRY pretod.html, The C Preprocessor vs D)
> $(TOCENTRY cppcontracts.html, D Contract Programming vs C++)
>
> can be simplified to this:
>
> $(TOCENTRIES
> comparison, D Feature List,
> builtin, Rationale for Builtins,
> ctod, Converting C to D,
> cpptod, Converting C++ to D,
> pretod, The C Preprocessor vs D,
> cppcontracts, D Contract Programming vs C++
> )
>
> (The .html elimination is a minor detail.)
>
> The trick is to recurse twice using $+ every time:
>
> TOCENTRIES=$(TOCENTRY $1, $2) $(TOCENTRIES_REC $+)
> TOCENTRIES_REC=$(TOCENTRIES $+)
>
> Thought this is worth sharing. We could simplify a few more things with this.
Two thoughts:
1. Need to add this to the Ddoc documentation! Or at least a tip sheet on Ddoc.
2. Why use url shorteners like http://goo.gl/QTAUFb ? I don't generally care to
click on links that I have no idea where they go. Here's the real link:
https://github.com/D-Programming-Language/dlang.org/pull/776/files#diff-582d0a2140b180aec5d08a9e6176399aR71
More information about the Digitalmars-d
mailing list