diff options
author | Pixel <pixel@nobis-crew.org> | 2011-11-29 16:46:53 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-11-29 16:46:53 -0800 |
commit | a0486e27504338dc6ce65fdecfce2cc4caabd8e1 (patch) | |
tree | a32522bb5d4d81b830499d6e317a00e73c4a2936 /includes | |
parent | 64120be7af8d2ded76cd3a3401fc69cadb96351e (diff) |
Being a bit more laxist with Mustache's values, and accepting almost anything as a variable; also adding a checkTemplate() method to assert a few things onto a template after loading it.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/SimpleMustache.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/includes/SimpleMustache.h b/includes/SimpleMustache.h index 5d0b9cf..66db3ca 100644 --- a/includes/SimpleMustache.h +++ b/includes/SimpleMustache.h @@ -80,6 +80,7 @@ class SimpleMustache { void setTemplate(const String & str) { setTemplate((const uint8_t *) str.to_charp(), str.strlen()); } void render(IO<Handle> h, Context * ctx) { Assert(ctx); render_r(h, ctx, "", m_fragments.begin(), false, -1); } void empty() { while (!m_fragments.empty()) { delete m_fragments.front(); m_fragments.pop_front(); } } + void checkTemplate() { Fragments::iterator end = checkTemplate_r(m_fragments.begin()); Assert(end == m_fragments.end()); } ~SimpleMustache() { empty(); } private: struct Fragment { @@ -99,6 +100,8 @@ class SimpleMustache { Fragments::iterator render_r(IO<Handle> h, Context * ctx, const String & endSection, Fragments::iterator begin, bool noWrite, int forceIdx); String escape(const String & s); + + Fragments::iterator checkTemplate_r(Fragments::iterator begin, const String & endSection = ""); }; }; |