Implement the first and last helpers.
parent
fdecdcb53b
commit
417466d17d
@ -0,0 +1,23 @@
|
||||
{
|
||||
"people": [
|
||||
{
|
||||
"name": "Alice",
|
||||
"pet": "cat"
|
||||
},
|
||||
{
|
||||
"name": "Bob",
|
||||
"pet": "dog"
|
||||
},
|
||||
{
|
||||
"name": "Chris",
|
||||
"pet": "lizard"
|
||||
}
|
||||
],
|
||||
"toys": [
|
||||
"ball",
|
||||
"bone"
|
||||
],
|
||||
"scalar": 7,
|
||||
"name": "global name",
|
||||
"pet": "global pet"
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
Tags inside a first{~n}
|
||||
==================={~n}
|
||||
{#people}
|
||||
{name}{@first petname="fluffy"},{pet}{petname}{/first}
|
||||
{/people}{~n}
|
||||
|
||||
first inside a scalar{~n}
|
||||
====================={~n}
|
||||
{#scalar}
|
||||
{name}{@first petname="fluffy"},{pet}{petname}{/first}
|
||||
{/scalar}{~n}
|
||||
|
||||
Nested first inside another non-array section{~n}
|
||||
============================================={~n}
|
||||
{#people}
|
||||
{#toys}
|
||||
{name}'s pet {pet} plays with a {.}{@first}, {/first}
|
||||
{/toys}
|
||||
{/people}{~n}
|
||||
|
||||
Else block inside a first{~n}
|
||||
========================={~n}
|
||||
{#people}
|
||||
{name}{@first},{pet}{petname}{:else}elseblock{/first}
|
||||
{/people}{~n}
|
||||
|
||||
Sep outside any section{~n}
|
||||
======================={~n}
|
||||
{@first}first is printed outside any section{/first}
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"people": [
|
||||
{
|
||||
"name": "Alice",
|
||||
"pet": "cat"
|
||||
},
|
||||
{
|
||||
"name": "Bob",
|
||||
"pet": "dog"
|
||||
},
|
||||
{
|
||||
"name": "Chris",
|
||||
"pet": "lizard"
|
||||
}
|
||||
],
|
||||
"toys": [
|
||||
"ball",
|
||||
"bone"
|
||||
],
|
||||
"scalar": 7,
|
||||
"name": "global name",
|
||||
"pet": "global pet"
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
Tags inside a last{~n}
|
||||
=================={~n}
|
||||
{#people}
|
||||
{name}{@last petname="fluffy"},{pet}{petname}{/last}
|
||||
{/people}{~n}
|
||||
|
||||
last inside a scalar{~n}
|
||||
===================={~n}
|
||||
{#scalar}
|
||||
{name}{@last petname="fluffy"},{pet}{petname}{/last}
|
||||
{/scalar}{~n}
|
||||
|
||||
Nested last inside another non-array section{~n}
|
||||
============================================{~n}
|
||||
{#people}
|
||||
{#toys}
|
||||
{name}'s pet {pet} plays with a {.}{@last}, {/last}
|
||||
{/toys}
|
||||
{/people}{~n}
|
||||
|
||||
Else block inside a last{~n}
|
||||
========================{~n}
|
||||
{#people}
|
||||
{name}{@last},{pet}{petname}{:else}elseblock{/last}
|
||||
{/people}{~n}
|
||||
|
||||
Sep outside any section{~n}
|
||||
======================={~n}
|
||||
{@last}last is printed outside any section{/last}
|
Loading…
Reference in New Issue