Skip to content

Commit

Permalink
Implement string includes for Diet templates. See #482.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Feb 11, 2014
1 parent 2e18dc0 commit 36b1363
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/vibe/templ/diet.d
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,13 @@ private struct DietCompiler {
break;
case "include": // Diet file include
assertp(next_indent_level <= level, "Child elements for 'include' are not supported.");
output.writeCodeLine("mixin(dietParser!(\""~ln[8 .. $].ctstrip()~".dt\")("~to!string(level)~"));");
auto content = ln[8 .. $].ctstrip();
if (content.startsWith("#{")) {
assertp(content.endsWith("}"), "Missing closing '}'.");
output.writeCodeLine("mixin(dietStringParser!("~content[2 .. $-1]~")("~to!string(level)~"));");
} else {
output.writeCodeLine("mixin(dietParser!(\""~content~".dt\")("~to!string(level)~"));");
}
break;
case "script":
case "style":
Expand Down

1 comment on commit 36b1363

@UplinkCoder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested with my projects ...
It's blazing fast now

Please sign in to comment.