Re: New Diet template engine almost complete, ready for comments

2016-07-29 Thread Sönke Ludwig via Digitalmars-d-announce

Am 29.07.2016 um 13:28 schrieb Chris:

Talking about diets, will reShop[1] be available for Android an iOS too?
You could extend it by adding "health tips" (add fruit & veg
automatically), a calorie counter (for single items and the whole list) ;)

http://rejectedsoftware.com/products/reshop


Yeah, diet/health tips are always a hot topic, I think we even talked 
about something like that at some point ;)


Porting it to those platforms was the initial idea. But since both BB10 
and WP are more or less dead now, the main feature of providing full 
cross-platform synchronization of the lists became a moot point (there 
are plenty of solutions for Android/iOS already). And then it also 
really was just a little test project anyway.




Re: New Diet template engine almost complete, ready for comments

2016-07-29 Thread Chris via Digitalmars-d-announce
Talking about diets, will reShop[1] be available for Android an 
iOS too? You could extend it by adding "health tips" (add fruit & 
veg automatically), a calorie counter (for single items and the 
whole list) ;)


http://rejectedsoftware.com/products/reshop


Re: New Diet template engine almost complete, ready for comments

2016-07-28 Thread Sönke Ludwig via Digitalmars-d-announce

Am 28.07.2016 um 20:07 schrieb WhatMeWorry:

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 , but instead of JavaScript, all
expressions and statements are D statements,


Is "Diet template" a D/Vibe unique language? I can't find anything to
contradict that view, but just wanted to sure. Every time I try and look
it up on google, it takes me to weight loss stuff :)   Good name though.


Yes, it started out as vibe.d exclusive (now it's properly decoupled 
from it). For Google it's probably not popular enough, atm, but I've 
registered diet-lang.org, which should help a lot once it gets filled 
with content.


Re: New Diet template engine almost complete, ready for comments

2016-07-28 Thread WhatMeWorry via Digitalmars-d-announce

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 , but instead 
of JavaScript, all expressions and statements are D statements,


Is "Diet template" a D/Vibe unique language? I can't find 
anything to contradict that view, but just wanted to sure. Every 
time I try and look it up on google, it takes me to weight loss 
stuff :)   Good name though.


Re: New Diet template engine almost complete, ready for comments

2016-07-28 Thread Sönke Ludwig via Digitalmars-d-announce

Am 28.07.2016 um 15:26 schrieb Chris:

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 , 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/


Oh, dang! Thanks for mentioning this. Fortunately I copy/pasted the 
right link to the README.


Re: New Diet template engine almost complete, ready for comments

2016-07-28 Thread rikki cattermole via Digitalmars-d-announce

On 29/07/2016 1:57 AM, Rory McGuire via Digitalmars-d-announce wrote:



On Thu, Jul 28, 2016 at 3:26 PM, Chris via Digitalmars-d-announce
> wrote:

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/


Also:

Renaming jade -> pug #2184
https://github.com/pugjs/pug/issues/2184


Hehehehe, I was wondering when this would come up :)

They are only like 2.5km away from me.


Re: New Diet template engine almost complete, ready for comments

2016-07-28 Thread Rory McGuire via Digitalmars-d-announce
On Thu, Jul 28, 2016 at 3:26 PM, Chris via Digitalmars-d-announce <
digitalmars-d-announce@puremagic.com> wrote:
>
> 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/
>

Also:

Renaming jade -> pug #2184
https://github.com/pugjs/pug/issues/2184


Re: New Diet template engine almost complete, ready for comments

2016-07-28 Thread Chris via Digitalmars-d-announce

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 , 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/


Re: New Diet template engine almost complete, ready for comments

2016-07-28 Thread Sönke Ludwig via Digitalmars-d-announce

Am 26.07.2016 um 07:54 schrieb Sönke Ludwig:

However, what should work well is a combination of
https://github.com/dlang/dub/pull/446 and
https://github.com/rejectedsoftware/vibe.d/pull/1385 - I'll merge the
latter one into vibe.d master today.


I decided against putting it into vibe.d and instead re-implemented it 
for diet-ng. It is available in 1.0.0-beta.1 now. See the README section 
for a description: https://code.dlang.org/packages/diet-ng


Re: New Diet template engine almost complete, ready for comments

2016-07-26 Thread Puming via Digitalmars-d-announce

On Tuesday, 26 July 2016 at 05:54:39 UTC, Sönke Ludwig wrote:

Am 26.07.2016 um 05:22 schrieb Puming:

[...]


A real runtime solution would require a D runtime interpreter 
or JIT compiler. There would be an alternative solution based 
on compiling each template to a shared library and then 
dynamically recompiling/reloading those as required, but that 
currently doesn't work due to the alias parameter based 
interface of render!(...).


However, what should work well is a combination of 
https://github.com/dlang/dub/pull/446 and 
https://github.com/rejectedsoftware/vibe.d/pull/1385 - I'll 
merge the latter one into vibe.d master today. It will require 
to store session information and similar things in an external 
store, and on Linux the Gold linker should be used for speed, 
but then it should be almost as good as a runtime solution.


Thanks!Shared lib reloading is good. Looking forward to it fully 
working :-)


Re: New Diet template engine almost complete, ready for comments

2016-07-26 Thread Rory McGuire via Digitalmars-d-announce
On Tue, Jul 26, 2016 at 7:54 AM, Sönke Ludwig <
digitalmars-d-announce@puremagic.com> wrote:

> [snip]
>
and on Linux the Gold linker should be used for speed, but then it should
> be almost as good as a runtime solution.
>

Note on using Gold on linux. You can use lflags "-fuse-ld=gold", to get dub
to link your project using gold if you are using dmd.


Re: New Diet template engine almost complete, ready for comments

2016-07-26 Thread Rory McGuire via Digitalmars-d-announce
On Tue, Jul 26, 2016 at 7:54 AM, Sönke Ludwig <
digitalmars-d-announce@puremagic.com> wrote:

> Am 26.07.2016 um 05:22 schrieb Puming:
>
>> 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 , 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.
>>>
>>> [...]
>>>
>>
>> A feature I want the most for Diet is the ability to parse Diet
>> templates at RUNTIME instead of compile time with a switch, similar to
>> Regex/CtRegex.
>>
>> In this way one can do quick turnarounds in dev mode, tweaking little
>> corners of the pages, and then when a page is finished, it can be
>> switched to compile mode for faster render time.
>>
>> Do you think this is feasible?
>>
>
> A real runtime solution would require a D runtime interpreter or JIT
> compiler. There would be an alternative solution based on compiling each
> template to a shared library and then dynamically recompiling/reloading
> those as required, but that currently doesn't work due to the alias
> parameter based interface of render!(...).
>
> However, what should work well is a combination of
> https://github.com/dlang/dub/pull/446 and
> https://github.com/rejectedsoftware/vibe.d/pull/1385 - I'll merge the
> latter one into vibe.d master today. It will require to store session
> information and similar things in an external store, and on Linux the Gold
> linker should be used for speed, but then it should be almost as good as a
> runtime solution.
>

!! nice, this is going to make my work life so much easier.

Thanks Sönke!


Re: New Diet template engine almost complete, ready for comments

2016-07-25 Thread Sönke Ludwig via Digitalmars-d-announce

Am 26.07.2016 um 05:22 schrieb Puming:

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 , 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.

[...]


A feature I want the most for Diet is the ability to parse Diet
templates at RUNTIME instead of compile time with a switch, similar to
Regex/CtRegex.

In this way one can do quick turnarounds in dev mode, tweaking little
corners of the pages, and then when a page is finished, it can be
switched to compile mode for faster render time.

Do you think this is feasible?


A real runtime solution would require a D runtime interpreter or JIT 
compiler. There would be an alternative solution based on compiling each 
template to a shared library and then dynamically recompiling/reloading 
those as required, but that currently doesn't work due to the alias 
parameter based interface of render!(...).


However, what should work well is a combination of 
https://github.com/dlang/dub/pull/446 and 
https://github.com/rejectedsoftware/vibe.d/pull/1385 - I'll merge the 
latter one into vibe.d master today. It will require to store session 
information and similar things in an external store, and on Linux the 
Gold linker should be used for speed, but then it should be almost as 
good as a runtime solution.


Re: New Diet template engine almost complete, ready for comments

2016-07-25 Thread Rory McGuire via Digitalmars-d-announce
On Tue, Jul 26, 2016 at 5:22 AM, Puming via Digitalmars-d-announce <
digitalmars-d-announce@puremagic.com> wrote:

> 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.
>>
>> [...]
>>
>
> A feature I want the most for Diet is the ability to parse Diet templates
> at RUNTIME instead of compile time with a switch, similar to Regex/CtRegex.
>
> In this way one can do quick turnarounds in dev mode, tweaking little
> corners of the pages, and then when a page is finished, it can be switched
> to compile mode for faster render time.
>
> Do you think this is feasible?
>

Hi Puming,

You could use some sort of dialect of JS that is close to D, and then alter
the diet template engine so that is doesn't evaluate the code sections with
some sort of CT switch.
Or you could use my Jaded templates which is basically the same but runs at
compile time or runtime (at runtime you would again have to use a language
with an interpreter.)

I think if you took, vibe.d/diet-ng + arsd/jsvar as your compile time
stack, you could find a common denominator so that you could use (node.js +
webpack + pug) to do the fast (live) edits of the templates.


Re: New Diet template engine almost complete, ready for comments

2016-07-25 Thread Puming via Digitalmars-d-announce

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 , 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.


[...]


A feature I want the most for Diet is the ability to parse Diet 
templates at RUNTIME instead of compile time with a switch, 
similar to Regex/CtRegex.


In this way one can do quick turnarounds in dev mode, tweaking 
little corners of the pages, and then when a page is finished, it 
can be switched to compile mode for faster render time.


Do you think this is feasible?


Re: New Diet template engine almost complete, ready for comments

2016-07-25 Thread Sebastiaan Koppe via Digitalmars-d-announce

On Monday, 25 July 2016 at 20:42:51 UTC, Karabuta wrote:

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 ...



  - Supports AngularJS special attribute names


Is there a way to get react JS to work with vibe.d in 
anyway(server-side)?


Without a JS engine that is going to be pretty hard. Or ugly. 
Basically you would be duplicating a lot of stuff.


I would probably use node.js to do an initial render. And keep 
all the data/api endpoints in vibe.


Re: New Diet template engine almost complete, ready for comments

2016-07-25 Thread Karabuta via Digitalmars-d-announce

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 ...



  - Supports AngularJS special attribute names


Is there a way to get react JS to work with vibe.d in 
anyway(server-side)?






Re: New Diet template engine almost complete, ready for comments

2016-07-25 Thread lqjglkqjsg via Digitalmars-d-announce

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 , 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.

[...]
Any comments/requests regarding the feature set or API are 
highly welcome!


I think I'm gonna test it to make my GH blog. It looks perfectly 
adapted.


Re: New Diet template engine almost complete, ready for comments

2016-07-25 Thread rikki cattermole via Digitalmars-d-announce

Hmm, I wonder if it could be extended to also do json as well as xml like.


Re: New Diet template engine almost complete, ready for comments

2016-07-25 Thread Stefan Koch via Digitalmars-d-announce

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 , 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.


[...]


This is great news.
diet-ng is so much cleaner!