Improving ddoc

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 1 01:47:27 PST 2015


On 1/1/15 1:39 AM, Walter Bright wrote:
> On 1/1/2015 1:19 AM, Andrei Alexandrescu wrote:
>> On 12/31/14 1:12 PM, Dicebot wrote:
>>> I don't feel like any small change in DDOC will make me like/use it.
>>
>> I'm envisioning quite an interesting possibility in which certain
>> constructs are
>> automatically converted to macros:
>>
>> `hello world` --> $(BACKQUOTED hello world)
>> "hello world" --> $(QUOTED hello world)
>> 'hello world' --> $(SQUOTED hello world)
>> _hello world_ --> $(UNDERLINED hello world)
>> *hello world* --> $(STARRED hello world)
>>
>> ... and such. Then generating nice formatting for each of these
>> constructs is
>> achieved by simply defining these macros appropriately.
>
> " and ` naturally come in pairs, but *, _ and ' do not.

Stars and underlines are popular due to markdown. There'd be 
limitations, e.g. pairs occurring across a ddoc parent won't be 
considered for expansion etc. Also the defaults can be written to be 
idempotent. (Below I am removing the single quote because indeed it's 
not fitting):

BACKQUOTED=`$0`
QUOTED="$0"
UNDERLINED=_$0_
STARRED=*$0*

So essentially we get to start 100% backward compatible and figure out 
under what circumstances the macros expand. I think we can get this working.


Andrei


More information about the Digitalmars-d mailing list