D For A Web Developer

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 13:05:01 PDT 2014


On Wednesday, 30 April 2014 at 16:02:25 UTC, Nick Sabalausky 
wrote:
> Well, I've been using mustache-d as my main templating engine, 
> which is just a general text preprocessor (Although I'm kinda 
> eyeing that other text preprocessor that uses actual D code).

ah, I see. BTW, fun fact: dom.d can understand ASP and PHP style 
tags. You need to set a special callback or call 
enableAddingSpecialTagsToDom() before parse,  (The latter will 
also enable storing comments, <! stuff> and <?stuff>) but then it 
will work.

I did that to enable dual-use templates that have some PHP code 
too. But it might be interesting to use for template stuff too...

BTW (ok this whole post is turning out to be a series of BTWs), 
web.d also has a template function that is dom-aware which I 
think is potentially very interesting.

Like it could see <span>{$foo}</span> and be aware to add a class 
to that span or something. Or it could automatically wrap 
variables in spans iff that makes sense in the html context.

Stuff I've never really used despite writing this some time 
ago... but I still think there's some potential to all this.


> Granted there are still things I have to refrain from doing in 
> my HTML form templates because it would violate well-formedness 
> *too much* even for an ultra-relaxed HTML DOM. But those cases 
> always have other (arguably more sanitary) ways to accomplish 
> the same thing.

yea


More information about the Digitalmars-d mailing list