| 1 {"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.
","overview":"Interpolation tags are used to integrate dynamic content into the
template.\n\nThe tag's content MUST be a non-whitespace character sequence NOT c
ontaining\nthe current closing delimiter.\n\nThis tag's content names the data t
o replace the tag. A single period (`.`)\nindicates that the item currently sit
ting atop the context stack should be\nused; otherwise, name resolution is as fo
llows:\n 1) Split the name on periods; the first part is the name to resolve, a
ny\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 t
he context is a hash, the data is the value associated with the\n name.\n 4) I
f 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.\nData should be coerced int
o a string (and escaped, if appropriate) before\ninterpolation.\n\nThe Interpola
tion tags MUST NOT be treated as standalone.\n","tests":[{"name":"No Interpolati
on","data":{},"expected":"Hello from {Mustache}!\n","template":"Hello from {Must
ache}!\n","desc":"Mustache-free templates should render as-is."},{"name":"Basic
Interpolation","data":{"subject":"world"},"expected":"Hello, world!\n","template
":"Hello, {{subject}}!\n","desc":"Unadorned tags should interpolate content into
the template."},{"name":"HTML Escaping","data":{"forbidden":"& \" < >"},"expect
ed":"These characters should be HTML escaped: & " < >\n","templat
e":"These characters should be HTML escaped: {{forbidden}}\n","desc":"Basic inte
rpolation should be HTML escaped."},{"name":"Triple Mustache","data":{"forbidden
":"& \" < >"},"expected":"These characters should not be HTML escaped: & \" < >\
n","template":"These characters should not be HTML escaped: {{{forbidden}}}\n","
desc":"Triple mustaches should interpolate without HTML escaping."},{"name":"Amp
ersand","data":{"forbidden":"& \" < >"},"expected":"These characters should not
be HTML escaped: & \" < >\n","template":"These characters should not be HTML esc
aped: {{&forbidden}}\n","desc":"Ampersand should interpolate without HTML escapi
ng."},{"name":"Basic Integer Interpolation","data":{"mph":85},"expected":"\"85 m
iles an hour!\"","template":"\"{{mph}} miles an hour!\"","desc":"Integers should
interpolate seamlessly."},{"name":"Triple Mustache Integer Interpolation","data
":{"mph":85},"expected":"\"85 miles an hour!\"","template":"\"{{{mph}}} miles an
hour!\"","desc":"Integers should interpolate seamlessly."},{"name":"Ampersand I
nteger Interpolation","data":{"mph":85},"expected":"\"85 miles an hour!\"","temp
late":"\"{{&mph}} miles an hour!\"","desc":"Integers should interpolate seamless
ly."},{"name":"Basic Decimal Interpolation","data":{"power":1.21},"expected":"\"
1.21 jiggawatts!\"","template":"\"{{power}} jiggawatts!\"","desc":"Decimals shou
ld interpolate seamlessly with proper significance."},{"name":"Triple Mustache D
ecimal Interpolation","data":{"power":1.21},"expected":"\"1.21 jiggawatts!\"","t
emplate":"\"{{{power}}} jiggawatts!\"","desc":"Decimals should interpolate seaml
essly with proper significance."},{"name":"Ampersand Decimal Interpolation","dat
a":{"power":1.21},"expected":"\"1.21 jiggawatts!\"","template":"\"{{&power}} jig
gawatts!\"","desc":"Decimals should interpolate seamlessly with proper significa
nce."},{"name":"Basic Context Miss Interpolation","data":{},"expected":"I () be
seen!","template":"I ({{cannot}}) be seen!","desc":"Failed context lookups shoul
d default to empty strings."},{"name":"Triple Mustache Context Miss Interpolatio
n","data":{},"expected":"I () be seen!","template":"I ({{{cannot}}}) be seen!","
desc":"Failed context lookups should default to empty strings."},{"name":"Ampers
and Context Miss Interpolation","data":{},"expected":"I () be seen!","template":
"I ({{&cannot}}) be seen!","desc":"Failed context lookups should default to empt
y strings."},{"name":"Dotted Names - Basic Interpolation","data":{"person":{"nam
e":"Joe"}},"expected":"\"Joe\" == \"Joe\"","template":"\"{{person.name}}\" == \"
{{#person}}{{name}}{{/person}}\"","desc":"Dotted names should be considered a fo
rm of shorthand for sections."},{"name":"Dotted Names - Triple Mustache Interpol
ation","data":{"person":{"name":"Joe"}},"expected":"\"Joe\" == \"Joe\"","templat
e":"\"{{{person.name}}}\" == \"{{#person}}{{{name}}}{{/person}}\"","desc":"Dotte
d names should be considered a form of shorthand for sections."},{"name":"Dotted
Names - Ampersand Interpolation","data":{"person":{"name":"Joe"}},"expected":"\
"Joe\" == \"Joe\"","template":"\"{{&person.name}}\" == \"{{#person}}{{&name}}{{/
person}}\"","desc":"Dotted names should be considered a form of shorthand for se
ctions."},{"name":"Dotted Names - Arbitrary Depth","data":{"a":{"b":{"c":{"d":{"
e":{"name":"Phil"}}}}}},"expected":"\"Phil\" == \"Phil\"","template":"\"{{a.b.c.
d.e.name}}\" == \"Phil\"","desc":"Dotted names should be functional to any level
of nesting."},{"name":"Dotted Names - Broken Chains","data":{"a":{}},"expected"
:"\"\" == \"\"","template":"\"{{a.b.c}}\" == \"\"","desc":"Any falsey value prio
r to the last part of the name should yield ''."},{"name":"Dotted Names - Broken
Chain Resolution","data":{"a":{"b":{}},"c":{"name":"Jim"}},"expected":"\"\" ==
\"\"","template":"\"{{a.b.c.name}}\" == \"\"","desc":"Each part of a dotted name
should resolve only against its parent."},{"name":"Dotted Names - Initial Resol
ution","data":{"a":{"b":{"c":{"d":{"e":{"name":"Phil"}}}}},"b":{"c":{"d":{"e":{"
name":"Wrong"}}}}},"expected":"\"Phil\" == \"Phil\"","template":"\"{{#a}}{{b.c.d
.e.name}}{{/a}}\" == \"Phil\"","desc":"The first part of a dotted name should re
solve as any other name."},{"name":"Interpolation - Surrounding Whitespace","dat
a":{"string":"---"},"expected":"| --- |","template":"| {{string}} |","desc":"Int
erpolation should not alter surrounding whitespace."},{"name":"Triple Mustache -
Surrounding Whitespace","data":{"string":"---"},"expected":"| --- |","template"
:"| {{{string}}} |","desc":"Interpolation should not alter surrounding whitespac
e."},{"name":"Ampersand - Surrounding Whitespace","data":{"string":"---"},"expec
ted":"| --- |","template":"| {{&string}} |","desc":"Interpolation should not alt
er surrounding whitespace."},{"name":"Interpolation - Standalone","data":{"strin
g":"---"},"expected":" ---\n","template":" {{string}}\n","desc":"Standalone in
terpolation should not alter surrounding whitespace."},{"name":"Triple Mustache
- Standalone","data":{"string":"---"},"expected":" ---\n","template":" {{{stri
ng}}}\n","desc":"Standalone interpolation should not alter surrounding whitespac
e."},{"name":"Ampersand - Standalone","data":{"string":"---"},"expected":" ---\
n","template":" {{&string}}\n","desc":"Standalone interpolation should not alte
r surrounding whitespace."},{"name":"Interpolation With Padding","data":{"string
":"---"},"expected":"|---|","template":"|{{ string }}|","desc":"Superfluous in-t
ag whitespace should be ignored."},{"name":"Triple Mustache With Padding","data"
:{"string":"---"},"expected":"|---|","template":"|{{{ string }}}|","desc":"Super
fluous in-tag whitespace should be ignored."},{"name":"Ampersand With Padding","
data":{"string":"---"},"expected":"|---|","template":"|{{& string }}|","desc":"S
uperfluous in-tag whitespace should be ignored."}]} |