dlangspec.pdf?

Philippe Sigaud philippe.sigaud at gmail.com
Wed Jan 9 02:52:26 PST 2013


On Wed, Jan 9, 2013 at 12:57 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:

> Yah, though note that these macros were only necessary because I was doing
> unusual stuff subheadings for TABLE_3ROWS and multiline paragraph for
> TABLE_2ROWS. If special stuff is not required you can use TABLE2 for up to
> 10 columns.

Oh, I did not see that, that's good to know. This should cover most needs.

>> I also like your use of the `listings` package. How did you 'disable'
>> the automatic colouring DMD insert in code samples?
>
>
> I defined these guys:
>
> D_COMMENT=$0
> D_STRING=$0
> D_KEYWORD=$0

Simple and elegant :)

You introduce `listings`as a dependency. I guess it's a very common
package, that should not cause problems. Maybe syntax highlighting can
be disabled if LaTeX does not find listings.

> I reached a sort of weird conclusion that ddoc is a redoubtable
> documentation source format. (I'm not sure whether it's better than Markdown
> or not as I'm not very fluent with Markdown.) One great thing about ddoc is
> that macros are infinitely flexible, and the expansion rules are not as
> weird as other macro systems such as M4.

The thing is, markdown is just a mark-up language: it's 'passive': no
function, no expansion. I agree having some 'programmability' is nice.
LaTeX is showing its age there. Ddoc has the merit of being
wonderfully simple concerning its macro expansion algorithm.
But markdown is widely used, if only for sites like Github or StackOverflow.

I have code somewhere to produce a document using D only. That gave me
access to the entire D power, so it's the other part of the spectrum.

auto doc = document( title("A title"),
section(...),
section(...),
section(...)
);

string latex = doc.as!"LaTeX";
string html = doc.as!"HTML";

and so on. Still embryonic and not a priority for me right now.



And, I'm slowly assembling small D parsers for markdown, xml, (a very
limited subset of) LaTeX for a project I call Dialect, that would
offer limited source-to-source translation for markup languages. Ddoc
is also a target, but you just showed it can fend for itself quite
well :)


> The table use case is telling - as soon as I needed a special table form I
> could just encode that as a macro. I think with Markdown you get to generate
> one kind of table but if you want to fine-tune any particular table you just
> can't.

Exactly. It's not a programming language. Maybe people use templates for that.


More information about the Digitalmars-d mailing list