DDOC macros

Derek Parnell derek at psych.ward
Thu Mar 9 15:52:21 PST 2006


On Fri, 10 Mar 2006 10:31:37 +1100, Derek Parnell wrote:

> Has anyone worked out how (if at all possible) to define a macro inside a
> 'Ddoc' file? 

How embarrassing ... I just managed to work it out. All I had to do was
read the documentation again (carefully). It seems that any macros in a
Ddoc file must appear at the *end* of the file because as soon as a Macros
section is found, documentation generation stops.

Example: ============

$(SECTION Macros in DDoc files,
    The $(TYPE) section must appear at the end of the file.
)

 Macros:
   TYPE = Macros
   SECTION = <h2>$1</h2>
             <p class="section">$+</p>
==============

This will generate ...

  <h2>Macros in DDoc files</h2>
  <p class="section">The Macros section must appear at the end of the
file.</p>

The usefulness of this is that you can use it to override macros defined in
a ".ddoc" file on the command line.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
10/03/2006 10:44:54 AM



More information about the Digitalmars-d-learn mailing list