From e35e24967e116d331e42a317a3062627bd97b5e2 Mon Sep 17 00:00:00 2001 From: noah morrison Date: Wed, 12 Nov 2014 09:51:36 -0500 Subject: [PATCH] Updated test.mustache and data.json --- data.json | 23 +++++----- test.mustache | 122 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 120 insertions(+), 25 deletions(-) diff --git a/data.json b/data.json index c6a05b4..dbcb0c6 100644 --- a/data.json +++ b/data.json @@ -1,12 +1,15 @@ { - "thing": "world", - "html_escaped": "no escape!", - "html_escaped2": "ok", - "html_escaped3": " this is escaped though ", - "show": true, - "delimiter": { - "1": "do delimiters work?", - "2": "yes they do!" - }, - "excited": "!!!" + "test": "test", + "html_escaped": "< > & \"", + "true": true, + "false": false, + "list": [ + {"i": 1, "v": "one"}, + {"i": 2, "v": "two"}, + {"i": 3, "v": "three"} + ], + + "scope": { + "test": "new test" + } } diff --git a/test.mustache b/test.mustache index dd2cdf0..0597412 100644 --- a/test.mustache +++ b/test.mustache @@ -2,28 +2,120 @@ mustache comment! }} -Hello, {{ thing }}! +variable test +=== +{{ test }} +=== +test +=== +comment test +=== +{{! + mustache comment +}} +=== +=== + +html escape test (triple brackets) +=== {{{html_escaped}}} -{{&html_escaped2}} -{{html_escaped3}} +=== +< > & " +=== -{{#show}} -Show is true! -{{/show}} +html escape test (ampersand) +=== +{{& html_escaped}} +=== +< > & " +=== -{{^show}} -Show is false! -{{/show}} +html escape test (normal) +=== +{{ html_escaped }} +=== +< > & " +=== -{{> partial}} +section test (truthy) +=== +{{# true }} +true +{{/ true }} +=== +true +=== -{{=<< >>=}} +section test (falsy) +=== +{{# false }} +ERROR +{{/ false }} +=== +=== -<> +section test (list) +=== +{{# list }} +number: {{i}} +name: {{v}} +--- +{{/ list }} +=== +number: 1 +name: one +--- +number: 2 +name: two +--- +number: 3 +name: three +--- +=== -<<={{ }}=>> +section test (scope) +=== +{{ test }} +{{# scope }} +{{ test }} +{{/ scope }} +=== +test +new test +=== -{{delimiter.2}} +inverted section test (truthy) +=== +{{^ true }} +ERROR +{{/ true }} +=== +=== + +inverted section test (falsy) +=== +{{^ false }} +false +{{/ false }} +=== +false +=== + +partial test +=== +{{> partial}} +=== +this is a partial +=== -That's all folks! +delimiter test +=== +{{=(( ))=}} +(( test )) +((={{ }}=)) +{{ test }} +=== +test +test +=== -- 2.47.3