Skip to content

Commit

Permalink
Handle Diet includes as separate mixins().
Browse files Browse the repository at this point in the history
This commit prepares for support of string templates, originally proposed by Stefan Koch (Uplink_Coder) in vibe-d#482.
  • Loading branch information
s-ludwig committed Feb 11, 2014
1 parent d07984a commit 2e18dc0
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions source/vibe/templ/diet.d
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,9 @@ private bool isPartOf(string str, STRINGS...)()
private string[] extractDependencies(in Line[] lines)
{
string[] ret;
foreach( ref ln; lines ){
foreach (ref ln; lines) {
auto lnstr = ln.text.ctstrip();
if( lnstr.startsWith("extends ") ) ret ~= lnstr[8 .. $].ctstrip() ~ ".dt";
else if( lnstr.startsWith("include ") ) ret ~= lnstr[8 .. $].ctstrip() ~ ".dt";
if (lnstr.startsWith("extends ")) ret ~= lnstr[8 .. $].ctstrip() ~ ".dt";
}
return ret;
}
Expand Down Expand Up @@ -587,11 +586,7 @@ private struct DietCompiler {
break;
case "include": // Diet file include
assertp(next_indent_level <= level, "Child elements for 'include' are not supported.");
auto filename = ln[8 .. $].ctstrip() ~ ".dt";
auto file = getFile(filename);
auto includecompiler = new DietCompiler(file, m_files, m_blocks);
//includecompiler.m_blocks = m_blocks;
includecompiler.buildWriter(output, level);
output.writeCodeLine("mixin(dietParser!(\""~ln[8 .. $].ctstrip()~".dt\")("~to!string(level)~"));");
break;
case "script":
case "style":
Expand Down

0 comments on commit 2e18dc0

Please sign in to comment.