Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
update macros example. Closes gh-318
Browse files Browse the repository at this point in the history
  • Loading branch information
paularmstrong committed Sep 14, 2013
1 parent 735e918 commit 34d5a6d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/macros/form.html
@@ -1,8 +1,8 @@
{% macro input type name label %}
{% macro input(type, name, label) %}
<label for="{{ name }}">{{ label }}</label>
<input type="{{ type }}" name="{{ name }}" id="{{ name }}">
{% endmacro %}

{% macro button type label %}
<button type="{{ type|default("submit") }}">{{ label|default("Submit") }}</button>
{% endmacro %}
{% endmacro %}
2 changes: 1 addition & 1 deletion examples/macros/index.html
Expand Up @@ -5,4 +5,4 @@
<li>{{ form.input("text", "age", "Your Age") }}</li>
</ul>

{{ form.button() }}
{{ form.button() }}
8 changes: 2 additions & 6 deletions examples/macros/server.js
@@ -1,13 +1,9 @@
var http = require('http'),
swig = require(__dirname + '/../../index');

swig.init({
root: __dirname
});

http.createServer(function (req, res) {
var tmpl = swig.compileFile('index.html'),
renderedHtml = tmpl.render({
var tmpl = swig.compileFile(__dirname + '/index.html'),
renderedHtml = tmpl({
people: [
{ name: 'Paul', age: 28 },
{ name: 'Jane', age: 26 },
Expand Down

0 comments on commit 34d5a6d

Please sign in to comment.