Thread overview
DDOC macros
Mar 09, 2006
Derek Parnell
Mar 09, 2006
Derek Parnell
Mar 10, 2006
Walter Bright
March 09, 2006
Has anyone worked out how (if at all possible) to define a macro inside a
'Ddoc' file?

(A Ddoc file is a file whose first line is ...

Ddoc

and has a ".d" extension. Is is used to only generate documentation and
doesn't carry any compilable code.
)

The documentation seems to be saying that you can define macros in such a file but all my attempts so far have been in vain.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
10/03/2006 10:28:52 AM
March 09, 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
March 10, 2006
"Derek Parnell" <derek@psych.ward> wrote in message news:1eipgjd3i8ryn$.12ki60dxxvx9c.dlg@40tude.net...
>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.

It had better work <g>. I use ddoc for all the new web pages I create now. It's sooo much easier than doing them by hand.