summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranomal00us <95467104+anomal00us@users.noreply.github.com>2021-12-06 14:43:18 +0100
committerroot <root@delphi.lan>2022-08-08 21:07:09 +0200
commita15b333b08e3f0db5a62baf6d6d55f364f380a5a (patch)
tree294bbe585818f0856c72623b1b1932ad7c972366
parent2c585cace9264b8543df44ca3ce56257425ac41c (diff)
downloadmustache-spec-a15b333b08e3f0db5a62baf6d6d55f364f380a5a.tar.gz
Renaming dynamic partials spec
-rw-r--r--specs/~dynamic-partials.json (renamed from specs/dynamic.json)20
-rw-r--r--specs/~dynamic-partials.yml (renamed from specs/dynamic.yml)0
2 files changed, 15 insertions, 5 deletions
diff --git a/specs/dynamic.json b/specs/~dynamic-partials.json
index 8fa5cf4..f260a15 100644
--- a/specs/dynamic.json
+++ b/specs/~dynamic-partials.json
@@ -1,5 +1,5 @@
{
- "overview": "Dynamic partials tags are used to dynamically expand an external template into\nthe current template.\n\nThe tag's content MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter.\n\nThis tag's content names a key in the context whose value is the name of the\npartial that will be loaded. If the dynamically named partial cannot be found,\nthe empty string SHOULD be used instead, as in interpolations. Set Delimiter\ntags MUST NOT affect the parsing of a partial. The partial MUST be rendered\nagainst the context stack local to the tag. Failed resolutions of the key\n(context lookups) should be considered falsey and should interpolate as the\nempty string. If the partial, whose name is retrieved from the context stack,\ncannot be found, the empty string SHOULD be used instead, as in\ninterpolations.\n\nDynamic partial tags SHOULD be treated as standalone when appropriate. If\nthis tag is used standalone, any whitespace preceding the tag should treated\nas indentation, and prepended to each line of the partial before rendering.\n",
+ "overview": "Dynamic partials tags are used to dynamically expand an external template into\nthe current template.\n\nThe tag's content MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter.\n\nThis tag's content names a key in the context whose value is the name of the\npartial that will be loaded. If the dynamically named partial cannot be found,\nthe empty string SHOULD be used instead, as in interpolations. Set Delimiter\ntags MUST NOT affect the parsing of a partial. The partial MUST be rendered\nagainst the context stack local to the tag. Failed resolutions of the key\n(context lookups) should be considered falsey and should interpolate as the\nempty string. If the partial, whose name is retrieved from the context stack,\ncannot be found, the empty string SHOULD be used instead, as in\ninterpolations.\n\nDynamic partial tags SHOULD be treated as standalone when appropriate. If\nthis tag is used standalone, any whitespace preceding the tag should treated\nas indentation, and prepended to each line of the partial before rendering:\nwhitespace handling around dynamic partials SHOULD be identical to whitespace\nhandling around static (normal) partials.\n",
"tests": [
{
"name": "Basic Behavior",
@@ -22,6 +22,16 @@
"expected": "\"\""
},
{
+ "name": "Context Misses Again",
+ "desc": "Failed context lookups should be considered falsey.",
+ "data": {},
+ "template": "\"{{*missing}}\"",
+ "partials": {
+ "missing": "Hello, world!"
+ },
+ "expected": "\"\""
+ },
+ {
"name": "Failed Lookup",
"desc": "The empty string should be used when the named partial is not found.",
"data": {
@@ -52,13 +62,13 @@
"data": "{\n template: 'node',\n content: 'X',\n nodes: [ { content: 'Y', nodes: [] } ]\n}\n",
"template": "{{*template}}",
"partials": {
- "node": "{{content}}<{{#nodes}}{{>node}}{{/nodes}}>"
+ "node": "{{content}}<{{#nodes}}{{*template}}{{/nodes}}>"
},
"expected": "X<Y<>>"
},
{
"name": "Surrounding Whitespace",
- "desc": "The asterisk operator should not alter surrounding whitespace.",
+ "desc": "The asterisk operator should not alter surrounding whitespace; any\nwhitespace preceding the tag should treated as indentation while any\nwhitepsace succeding the tag should be left untouched.\n",
"data": {
"partial": "foobar"
},
@@ -70,12 +80,12 @@
},
{
"name": "Inline Indentation",
- "desc": "Whitespace should be left untouched.",
+ "desc": "Whitespace should be left untouched: whitespaces preceding the tag\nshould be treated as indentation.\n",
"data": {
"dynamic": "partial",
"data": "|"
},
- "template": " {{data}} {{* partial}}\n",
+ "template": " {{data}} {{* dynamic}}\n",
"partials": {
"partial": ">\n>"
},
diff --git a/specs/dynamic.yml b/specs/~dynamic-partials.yml
index c61113e..c61113e 100644
--- a/specs/dynamic.yml
+++ b/specs/~dynamic-partials.yml