www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Appending to ddoc macros

Does anyone know if there's a way to append to a ddoc macro instead of
replacing it?

For instance, dlang.org has the EXTRA_HEADERS macro for adding extra stuff
to the header of a web page, and it uses that with several pages defining
EXTRA_HEADERS to add headers to that specific page. I have something similar
for my own project, but I need to be able to add EXTRA_HEADERS more than
once, and redefining EXTRA_HEADERS makes it so that only one of the values
of EXTRA_HEADERS takes effect. Ideally, I would have a way to add additional
values to EXTRA_HEADERS without replacing the original values, just like
when you do something like

PATH=~/bin/:$PATH

when setting your path, but I don't know of any way to do that in ddoc. Does
anyone know of such a way? Or does a feature need to be added to ddoc to
make such a thing possible?

At the moment, the best solution I have is to just define a second macro
for the second value I need to add to EXTRA_HEADERS so that I have
EXTRA_HEADERS and EXTRA_HEADERS2, but that doesn't scale very well.

- Jonathan M Davis
Feb 16 2018