New Diet template engine almost complete, ready for comments

Chris via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Jul 28 06:26:17 PDT 2016


On Monday, 25 July 2016 at 09:29:38 UTC, Sönke Ludwig wrote:
> The Diet template language is aimed at providing a way to 
> define procedurally generated HTML/XML pages (or other output 
> formats), with minimal visual noise. Syntax and feature set are 
> heavily inspired by Jade <http://jade-lang.org/>, but instead 
> of JavaScript, all expressions and statements are D statements, 
> and everything that can be done at compile-time is done at 
> compile-time.
>
> Vibe.d still contains the original implementation, which was 
> written around the limitations of DMD's CTFE engine back years 
> ago, and is basically a monolithic parser+generator with little 
> flexibility and a number of convenience features missing, 
> because of their implementation complexity. The new 
> implementation has been rewritten cleanly, with separate 
> parser, modifier and generator modules, working on a common DOM 
> tree intermediate representation.
>
> The major new features/improvements are:
>
>   - No external dependencies other than Phobos
>   - Supports inline and nested tags syntax
>   - Supports string interpolations within filter nodes (falls 
> back to
>     runtime filters)
>   - Supports AngularJS special attribute names
>   - Extensible/configurable with traits structures
>   - Uses less memory during compilation (this one was a real 
> surprise)
>   - (Unit) tested from the start
>   - Supports arbitrary uses other than generating HTML, for 
> example we
>    use it similar to QML/XAML for our internal UI framework
>
> The API documentation can be shown ba running DUB:
>    dub fetch diet-ng --version=1.0.0-alpha.2
>    dub run diet-ng -b ddox
>
> You can try the library directly, or together with the latest 
> alpha release of vibe.d (0.7.30-alpha.3). Simply add a 
> dependency to "diet-ng", version "~>1.0.0-alpha.2". Vibe.d will 
> automatically re-route render!(...) calls to diet-ng.
>
> A small example with just the most essential features is shown 
> in the README:
> https://code.dlang.org/packages/diet-ng
>
> More complex real-world examples:
> https://github.com/rejectedsoftware/vibed.org/tree/master/views
> https://github.com/rejectedsoftware/ddox/tree/master/views
>
> Any comments/requests regarding the feature set or API are 
> highly welcome!

Great stuff! Very much appreciated. Btw, the link to 
jade-lang.org (don't click!) leads to a dodgy business homepage 
atm. The right address is

http://jade-lang.com/


More information about the Digitalmars-d-announce mailing list