Skip to content

Commit 28a58b6

Browse files
committed
Merge pull request #20 from legobear154/master
Fixed up vibe.d support
2 parents d3793de + 63d3ff1 commit 28a58b6

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

dub.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
[
88
"Dylan Knutson"
99
],
10+
"dependencies": {
11+
"vibe-d": {
12+
"version": "~master",
13+
"optional": true
14+
}
15+
},
1016

1117
"targetType": "library",
1218
"ignoredFiles": ["source/app.d"],
@@ -22,7 +28,7 @@
2228
"dependencies": {},
2329
"targetType": "executable",
2430
"mainSourceFile": "src/app.d",
25-
"versions": ["TempleUnittest"],
31+
"versions": ["TempleUnittest", "VibeCustomMain"],
2632
"stringImportPaths": ["test"]
2733
},
2834

src/temple/output_stream.d

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public:
5959
}
6060

6161
// for vibe.d's html escape
62-
package
6362
void put(dchar d) {
6463
import std.conv;
6564
this.sink(d.to!string);

src/temple/package.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ public:
210210
private import vibe.core.stream : OutputStream;
211211
private import vibe.stream.wrapper : StreamOutputRange;
212212

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

216216
auto sor = StreamOutputRange(os);
217-
this.render(sor);
217+
this.render(sor, tc);
218218
}
219219
}
220220

src/temple/vibe.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ void renderTempleFile(string file, Ctx = TempleContext)
6060
{
6161
mixin(SetupContext);
6262

63-
alias render = compile_temple_file!(file, TempleHtmlFilter);
64-
render(res.bodyWriter, context);
63+
auto t = compile_temple_file!(file, TempleHtmlFilter);
64+
t.render(res.bodyWriter, context);
6565
}
6666

6767
void renderTempleLayoutFile(string layout_file, string partial_file, Ctx = TempleContext)
@@ -70,10 +70,10 @@ void renderTempleLayoutFile(string layout_file, string partial_file, Ctx = Templ
7070
{
7171
mixin(SetupContext);
7272

73-
alias layout = TempleLayoutFile!(layout_file, TempleHtmlFilter);
74-
alias partial = compile_temple_file!(partial_file, TempleHtmlFilter);
75-
76-
layout(res.bodyWriter, &partial, context);
73+
auto layout = compile_temple_file!(layout_file, TempleHtmlFilter);
74+
auto partial = compile_temple_file!(partial_file, TempleHtmlFilter);
75+
auto composed = layout.layout(&partial);
76+
composed.render(res.bodyWriter, context);
7777
}
7878

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

0 commit comments

Comments
 (0)