DLang Spec rewrite (?)

Jonathan M Davis jmdavisProg at gmx.com
Sun May 26 17:33:58 PDT 2013


On Sunday, May 26, 2013 13:20:41 H. S. Teoh wrote:
> On Sat, May 25, 2013 at 10:34:30PM -0700, Jonathan M Davis wrote:
> [...]
> 
> > My main complaint about ddoc is actually not a complaint about ddoc
> > but about html. I find it very annoying to have to put $(P ) around
> > every paragraph. Stuff like LaTeX does that automatically based on
> > blank lines, which is way better IMHO, but if you're targetting HTML,
> > then unfortunately, you need to mark paragraphs. The only way to fix
> > that with regards to ddoc would be to make it so that ddoc understood
> > that blank lines meant new paragraphs and inserted <p></p>
> > appropriately, when generating html, but that would make it so that
> > ddoc was less general, and there might be other negatives to that I
> > haven't thought of. So, we just get to deal with $(P ) I guess.
> 
> [...]
> 
> Wait, why not just make DDoc wrap it in $(P ) instead of <p></p>? That
> way, output formats that don't care can simply define $(P) to be the
> text followed by a line break, and you're done.

I don't follow. The issue is that right now I have to do

--------
$(P Here is my paragraph.)

$(P Here is another paragraph.)
--------

Whereas in something like latex, I'd just do

--------
Here is my paragraph.

Here is another paragraph.
--------

When ddoc is run, the $(P content) gets translated to <p>content</p> in html, 
and into my second example for latex. But what I want to be able to do is 
write the second example and have html end up with <p>content</p>. And _that_ 
doesn't work, because it would require that dmd know about <p> and insert it 
for me instead of ddoc just being pure macros. It would be simple enough to 
run a program over the .dd file before running it through dmd in order to add 
the $(P) macros were appropriate, but then I have to worry about getting the 
logic right on that, and things like code examples could screw with that (you 
wouldn't want to insert $(P) into code examples). So, while it's quite 
feasible, I'm just putting up with $(P) for now. But we can't have a general 
ddoc solution for this without changing how ddoc works in a way that makes it 
so that it's not just a macro system anymore. Without another program to 
massage the ddoc in your file first, you're stuck with $(P).

- Jonathan m Davis


More information about the Digitalmars-d mailing list