summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranomal00us <95467104+anomal00us@users.noreply.github.com>2022-07-20 21:46:35 +0200
committerroot <root@delphi.lan>2022-08-08 21:08:27 +0200
commit69487d554800a8de5bc1390e636a7290af25f015 (patch)
tree6f2875cee2ea21b4d7a916cb25fa69a4d46daf49
parentd7edba39661a134cd8bdee8d4cdc147b41a5104d (diff)
downloadmustache-spec-69487d554800a8de5bc1390e636a7290af25f015.tar.gz
Editing tag description and fixing whitespaces in tests
-rw-r--r--specs/~dynamic-names.json10
-rw-r--r--specs/~dynamic-names.yml10
2 files changed, 13 insertions, 7 deletions
diff --git a/specs/~dynamic-names.json b/specs/~dynamic-names.json
index 3f3931b..8c325d0 100644
--- a/specs/~dynamic-names.json
+++ b/specs/~dynamic-names.json
@@ -1,5 +1,5 @@
{
- "overview": "Dynamic Names are a special notation to dynamically determine a tag's content.\n\nDynamic Names MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter. A Dynamic Name consists of an asterisk,\nfollowed by a dotted name. The latter follows the same notation as in an\nInterpolation tag.\n\nThis tag's content refers to a key in the context whose value will be used in\nplace of the Dynamic Name itself as content of the tag. The name resolution is\nidentical to name resolution in Interpolation tags, as follows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object, the data is the value returned by the\n method with the given name.\n 5) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nThe resolved data should be coerced into a string before being used as\ncontent.\n\nSet Delimiter tags MUST NOT affect the resolution of a Dynamic Name. The\nDynamic Names MUST be resolved against the context stack local to the tag.\nFailed resolution of the dynamic name should result in nothing being rendered.\n\nEngines that implement Dynamic Names MUST support their use in Partial tags.\nIn engines that also implement the optional inheritance spec, Dynamic Names\ninside Parent tags should be supported as well. Dynamic Names cannot be\nresolved more than once (Dynamic Names cannot be nested).\n",
+ "overview": "Dynamic Names are a special notation to dynamically determine a tag's content.\n\nDynamic Names MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter. A Dynamic Name consists of an asterisk,\nfollowed by a dotted name. The latter follows the same notation as in an\nInterpolation tag.\n\nThis tag's dotted name, which is equal to the Dynamic Name excluding the\nleading asterisk, refers to a key in the context whose value will be used in\nplace of the Dynamic Name itself as content of the tag. The dotted name\nresolution produces the same value as an Interpolation tag and does not affect\nthe context for further processing.\n\nThis tag's content refers to a key in the context whose value will be used in\nplace of the Dynamic Name itself as content of the tag. The name resolution is\nidentical to name resolution in Interpolation tags, as follows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object, the data is the value returned by the\n method with the given name.\n 5) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nThe resolved data should be coerced into a string before being used as\ncontent.\n\nSet Delimiter tags MUST NOT affect the resolution of a Dynamic Name. The\nDynamic Names MUST be resolved against the context stack local to the tag.\nFailed resolution of the dynamic name should result in nothing being rendered.\n\nEngines that implement Dynamic Names MUST support their use in Partial tags.\nIn engines that also implement the optional inheritance spec, Dynamic Names\ninside Parent tags should be supported as well. Dynamic Names cannot be\nresolved more than once (Dynamic Names cannot be nested).\n",
"tests": [
{
"name": "Basic Behavior - Partial",
@@ -66,7 +66,7 @@
"expected": "\"*Hello, world!*\""
},
{
- "name": "Dotted Names - Failed Lookup",
+ "name": "Dotted Names - Operator Precedence",
"desc": "The dynamic partial should operate within the current context.",
"data": {
"text": "Hello, world!",
@@ -178,7 +178,7 @@
},
{
"name": "Surrounding Whitespace",
- "desc": "A dynamic partials 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",
+ "desc": "A dynamic partial should not alter surrounding whitespace; any\nwhitespace preceding the tag should be treated as indentation while any\nwhitespace succeding the tag should be left untouched.\n",
"data": {
"partial": "foobar"
},
@@ -195,7 +195,7 @@
"dynamic": "partial",
"data": "|"
},
- "template": " {{data}} {{>* dynamic}}\n",
+ "template": " {{data}} {{>*dynamic}}\n",
"partials": {
"partial": ">\n>"
},
@@ -257,7 +257,7 @@
"dynamic": "partial",
"boolean": true
},
- "template": "|{{> *dynamic }}|",
+ "template": "|{{> * dynamic }}|",
"partials": {
"partial": "[]"
},
diff --git a/specs/~dynamic-names.yml b/specs/~dynamic-names.yml
index 6c2a2d4..062fbcd 100644
--- a/specs/~dynamic-names.yml
+++ b/specs/~dynamic-names.yml
@@ -6,6 +6,12 @@ overview: |
followed by a dotted name. The latter follows the same notation as in an
Interpolation tag.
+ This tag's dotted name, which is equal to the Dynamic Name excluding the
+ leading asterisk, refers to a key in the context whose value will be used in
+ place of the Dynamic Name itself as content of the tag. The dotted name
+ resolution produces the same value as an Interpolation tag and does not affect
+ the context for further processing.
+
This tag's content refers to a key in the context whose value will be used in
place of the Dynamic Name itself as content of the tag. The name resolution is
identical to name resolution in Interpolation tags, as follows:
@@ -151,7 +157,7 @@ tests:
Whitespace should be left untouched: whitespaces preceding the tag
should be treated as indentation.
data: { dynamic: 'partial', data: '|' }
- template: " {{data}} {{>* dynamic}}\n"
+ template: " {{data}} {{>*dynamic}}\n"
partials: { partial: ">\n>" }
expected: " | >\n>\n"
@@ -201,6 +207,6 @@ tests:
- name: Padding Whitespace
desc: Superfluous in-tag whitespace should be ignored.
data: { dynamic: 'partial', boolean: true }
- template: "|{{> *dynamic }}|"
+ template: "|{{> * dynamic }}|"
partials: { partial: "[]" }
expected: '|[]|'