-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
170 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
{ | ||
"__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", | ||
"overview": "Partial tags are used to expand an external template into the current\ntemplate.\n\nThe tag's content MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter.\n\nThis tag's content names the partial to inject. Set Delimiter tags MUST NOT\naffect the parsing of a partial. The partial MUST be rendered against the\ncontext stack local to the tag. If the named partial cannot be found, the\nempty string SHOULD be used instead, as in interpolations.\n\nPartial tags SHOULD be treated as standalone when appropriate. If this tag\nis used standalone, any whitespace preceding the tag should treated as\nindentation, and prepended to each line of the partial before rendering.\n", | ||
"tests": [ | ||
{ | ||
"data": {}, | ||
"desc": "The greater-than operator should expand to the named partial.", | ||
"expected": "\"from partial\"", | ||
"name": "Basic Behavior", | ||
"partials": { | ||
"text": "from partial" | ||
}, | ||
"template": "\"{{>text}}\"" | ||
}, | ||
{ | ||
"data": {}, | ||
"desc": "The empty string should be used when the named partial is not found.", | ||
"expected": "\"\"", | ||
"name": "Failed Lookup", | ||
"partials": {}, | ||
"template": "\"{{>text}}\"" | ||
}, | ||
{ | ||
"data": { | ||
"text": "content" | ||
}, | ||
"desc": "The greater-than operator should operate within the current context.", | ||
"expected": "\"*content*\"", | ||
"name": "Context", | ||
"partials": { | ||
"partial": "*{{text}}*" | ||
}, | ||
"template": "\"{{>partial}}\"" | ||
}, | ||
{ | ||
"data": { | ||
"content": "X", | ||
"nodes": [ | ||
{ | ||
"content": "Y", | ||
"nodes": [] | ||
} | ||
] | ||
}, | ||
"desc": "The greater-than operator should properly recurse.", | ||
"expected": "X<Y<>>", | ||
"name": "Recursion", | ||
"partials": { | ||
"node": "{{content}}<{{#nodes}}{{>node}}{{/nodes}}>" | ||
}, | ||
"template": "{{>node}}" | ||
}, | ||
{ | ||
"data": {}, | ||
"desc": "The greater-than operator should not alter surrounding whitespace.", | ||
"expected": "| \t|\t |", | ||
"name": "Surrounding Whitespace", | ||
"partials": { | ||
"partial": "\t|\t" | ||
}, | ||
"template": "| {{>partial}} |" | ||
}, | ||
{ | ||
"data": { | ||
"data": "|" | ||
}, | ||
"desc": "Whitespace should be left untouched.", | ||
"expected": " | >\n>\n", | ||
"name": "Inline Indentation", | ||
"partials": { | ||
"partial": ">\n>" | ||
}, | ||
"template": " {{data}} {{> partial}}\n" | ||
}, | ||
{ | ||
"data": {}, | ||
"desc": "\"\\r\\n\" should be considered a newline for standalone tags.", | ||
"expected": "|\r\n>|", | ||
"name": "Standalone Line Endings", | ||
"partials": { | ||
"partial": ">" | ||
}, | ||
"template": "|\r\n{{>partial}}\r\n|" | ||
}, | ||
{ | ||
"data": {}, | ||
"desc": "Standalone tags should not require a newline to precede them.", | ||
"expected": " >\n >>", | ||
"name": "Standalone Without Previous Line", | ||
"partials": { | ||
"partial": ">\n>" | ||
}, | ||
"template": " {{>partial}}\n>" | ||
}, | ||
{ | ||
"data": {}, | ||
"desc": "Standalone tags should not require a newline to follow them.", | ||
"expected": ">\n >\n >", | ||
"name": "Standalone Without Newline", | ||
"partials": { | ||
"partial": ">\n>" | ||
}, | ||
"template": ">\n {{>partial}}" | ||
}, | ||
{ | ||
"data": { | ||
"content": "<\n->" | ||
}, | ||
"desc": "Each line of the partial should be indented before rendering.", | ||
"expected": "\\\n |\n <\n->\n |\n/\n", | ||
"name": "Standalone Indentation", | ||
"partials": { | ||
"partial": "|\n{{{content}}}\n|\n" | ||
}, | ||
"template": "\\\n {{>partial}}\n/\n" | ||
}, | ||
{ | ||
"data": { | ||
"boolean": true | ||
}, | ||
"desc": "Superfluous in-tag whitespace should be ignored.", | ||
"expected": "|[]|", | ||
"name": "Padding Whitespace", | ||
"partials": { | ||
"partial": "[]" | ||
}, | ||
"template": "|{{> partial }}|" | ||
} | ||
] | ||
} |