Skip to content

Commit

Permalink
Merge pull request #20 from legobear154/master
Browse files Browse the repository at this point in the history
Fixed up vibe.d support
  • Loading branch information
dymk committed Nov 27, 2014
2 parents d3793de + 63d3ff1 commit 28a58b6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
8 changes: 7 additions & 1 deletion dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
[
"Dylan Knutson"
],
"dependencies": {
"vibe-d": {
"version": "~master",
"optional": true
}
},

"targetType": "library",
"ignoredFiles": ["source/app.d"],
Expand All @@ -22,7 +28,7 @@
"dependencies": {},
"targetType": "executable",
"mainSourceFile": "src/app.d",
"versions": ["TempleUnittest"],
"versions": ["TempleUnittest", "VibeCustomMain"],
"stringImportPaths": ["test"]
},

Expand Down
1 change: 0 additions & 1 deletion src/temple/output_stream.d
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public:
}

// for vibe.d's html escape
package
void put(dchar d) {
import std.conv;
this.sink(d.to!string);
Expand Down
4 changes: 2 additions & 2 deletions src/temple/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ public:
private import vibe.core.stream : OutputStream;
private import vibe.stream.wrapper : StreamOutputRange;

void render(vibe.core.stream.OutputStream os) {
void render(vibe.core.stream.OutputStream os, TempleContext tc = null) {
static assert(isOutputRange!(vibe.core.stream.OutputStream, string));

auto sor = StreamOutputRange(os);
this.render(sor);
this.render(sor, tc);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/temple/vibe.d
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ void renderTempleFile(string file, Ctx = TempleContext)
{
mixin(SetupContext);

alias render = compile_temple_file!(file, TempleHtmlFilter);
render(res.bodyWriter, context);
auto t = compile_temple_file!(file, TempleHtmlFilter);
t.render(res.bodyWriter, context);
}

void renderTempleLayoutFile(string layout_file, string partial_file, Ctx = TempleContext)
Expand All @@ -70,10 +70,10 @@ void renderTempleLayoutFile(string layout_file, string partial_file, Ctx = Templ
{
mixin(SetupContext);

alias layout = TempleLayoutFile!(layout_file, TempleHtmlFilter);
alias partial = compile_temple_file!(partial_file, TempleHtmlFilter);

layout(res.bodyWriter, &partial, context);
auto layout = compile_temple_file!(layout_file, TempleHtmlFilter);
auto partial = compile_temple_file!(partial_file, TempleHtmlFilter);
auto composed = layout.layout(&partial);
composed.render(res.bodyWriter, context);
}

private void copyContextParams(ref TempleContext ctx, ref HTTPServerRequest req) {
Expand Down

0 comments on commit 28a58b6

Please sign in to comment.