rejectedsoftware / diet-ng

Compile-time indentation based, XML structured template system
MIT License
45 stars 24 forks source link

Unknown filter :javascript & :css #67

Closed Beyarz closed 5 years ago

Beyarz commented 5 years ago

It seems like compileHTMLDietFile does not support :css & :javascript

Log

▶ dub

object.Exception@../../../../.dub/packages/diet-ng-1.6.0/diet-ng/source/diet/traits.d(172): Unknown filter: javascript
----------------
source/app.d:19 pure @safe void diet.traits.filter!(strip.translateDiet().iterations).filter(const(char[]), immutable(char)[], void delegate(const(char[])) @safe) [0x1001b04ce]
source/app.d:19 @safe void diet.html.compileHTMLDietFileString!("error.dt", diet.html.compileHTMLDietFile!("error.dt", strip.translateDiet().iterations).contents, strip.translateDiet().iterations).exec!(std.stdio.File.LockingTextWriter).exec(ref std.stdio.File.LockingTextWriter) [0x1001b0395]
source/app.d:19 @safe void diet.html.compileHTMLDietFileString!("error.dt", diet.html.compileHTMLDietFile!("error.dt", strip.translateDiet().iterations).contents, strip.translateDiet().iterations).compileHTMLDietFileString!(std.stdio.File.LockingTextWriter).compileHTMLDietFileString(ref std.stdio.File.LockingTextWriter) [0x1001b030c]
source/app.d:19 void strip.translateDiet() [0x1001a7116]
source/app.d:55 _Dmain [0x1001799d8]
Program exited with code 1
schveiguy commented 5 years ago

Because vibe defines these: https://github.com/vibe-d/vibe.d/blob/f26dd28dfd487f5726f691b6ad254846ed910332/http/vibe/http/server.d#L352-L416

You need to pass that into the compiler:

import vibe.http.server
auto str = compileHTMLDietFile!(DefaultDietFilters)(parsedDoc);

Arguably, these should be in the diet-ng repository, as they are HTML related, and not http server related.

Beyarz commented 5 years ago

Arguably, these should be in the diet-ng repository, as they are HTML related, and not http server related.

Yes indeed

Beyarz commented 5 years ago

I'll close this issue for now