-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plate (for the Django template language) seems to have matured, so ad…
…ding it back in as a handler. Includes short example.
- Loading branch information
1 parent
6afac4b
commit 7f453f4
Showing
5 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(function() { | ||
var context, plate, render_plate; | ||
context = require('../context'); | ||
plate = require('plate'); | ||
render_plate = function(req, res) { | ||
var template, vars; | ||
vars = context.find_template_variables(req.file.path); | ||
template = new plate.Template(req.file.content); | ||
return template.render(vars, function(err, html) { | ||
res.contentType('text/html'); | ||
return res.send(html); | ||
}); | ||
}; | ||
module.exports = function(app) { | ||
app.accepts.push('plate'); | ||
app.accepts.push('dtl'); | ||
app.get(/^(.*\.plate)$/, render_plate); | ||
return app.get(/^(.*\.dtl)$/, render_plate); | ||
}; | ||
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<html> | ||
<head> | ||
<link href='style.styl' rel='stylesheet' type='text/css' /> | ||
<title>{{ title }}</title> | ||
<body> | ||
<h1>{{ title }}</h1> | ||
<p>description</p> | ||
<script src='script.coffee'></script> | ||
</body> | ||
</html> |