1 $group
2 $
3 var sect = {
4 title: 'Ittf commands'
5 };
6 section( §)
7 ittf-panel
8 title The $include command
9 ittf
10 ...
11 ${'$'}include fragment-path
12 p The node value (
13 high-code( fragment-path )
14 + ) is the relative path to the ITTF
15 \b Fragment that must be included. The folder uri of the
16 \b includer document is the base path for the path resolution
17 \b of the included documents.
18 p The fragment will be included replacing
19 + the $include command, and the JsWizzi expressions of its nodes will become part of the
20 \b evaluation scope of the includer.
21 p An $include command cannot have children nodes. The included
22 + fragment cannot have the $params node (cannot have composition parameters).
23 ittf-panel
24 title The Mix action
25 ittf
26 ...
27 $ var comma = ','
28 to-mix( fragment-path, arg-1 [${comma} arg-2 ... [${comma} arg-n]] )
29 ... optional child branch nodes
30 p A Mix action is recognized by the ITTF Parser when a node name
31 \b ends with an open parenthesis. The chars before the open parenthesis
32 \b are the relative path to the mixed ITTF Document. The folder uri of
33 \b the mixer ITTF Document is the base path.
34 \b No whitechar must separate the mixed fragment path and the open paren.
35 p The mixed fragment is inserted in the mixer document replacing
36 \b the Mix action. If the mix node has children,
37 \b by default they are appended to the root node of the mixed fragment.
38 \b But if the mixed fragment has a descendant node that is a '$hook'
39 \b command of name 'default', than the children of the mix node
40 \b will replace it.
41 ittf-panel
42 title ITTF Fragment with an $hook command
43 ittf
44 table
45 ${'$'}hook
46 p The hook-name when not declared, is assumed to be 'default'.
47 p The root node of a mixed ITTF Document can be a template
48 high-code( Mix action )
49 + . A fragment can mix its container and append nodes to its hooks:
50 ittf-panel
51 ittf
52 to-mix( mylayout, home)
53 ${'$'}append scripts
54 js dialogs.js
55 div My content
56 ittf-panel
57 title The $params command
58 ittf
59 rootnode
60 ${'$'}params param1 [,param2 [,param-n]]
61 p ITTF Fragments designed to be mixed can declare composition parameters.
62 + The `$params` node must be the first child of the root node.
63 p A parameter has format: [&]name[:type][|default]
64 table
65 tr( & , Optional. A paramater name prededed by `&` means an object passed by reference )
66 tr( name , the name of the parameter to be used in jsWizzi expressions )
67 tr( type , the parameter type)
68 p one-of: string(default), integer, float, boolean, date, object (implicit
69 + when '&' declared), macro (implicit, detected from IttfMacro delimiters
70 + contained in the default value)
71 tr( default, typed-value | @@null | @@undefined )
72 p warning! `title|null` becomes title = "null" (the quoted string null).
73 + If you want title to be null then : `title|@@null`
74 tr( string, quotes are optional, example: `title|"my way"` and `title|my way` are the same )
75 tr( boolean, true | false)
76 tr( date, yyyy/mm/dd )
77 tr( macro)
78 p an IttfMacro can be passed as a parameter to a mixin, when the parameter
79 + is referenced we have a double macro substitution
80 p This list item fragment, lia.html.ittf, ...
81 ittf-panel
82 ittf
83 li
84 ${'$'}params text, href
85 a ${'$'}{text}
86 href ${'$'}{href}
87 p .. can be mixed in this way
88 ittf-panel
89 ittf
90 ul
91 to-mix( lia, my home page, http://hello.it )
92 ittf-panel
93 title The $hook command
94 ittf
95 ...
96 ${'$'}hook name
97 p An $hook command is a named insertion point where node branches can
98 + be appended. The name is optional, when missing its value is 'default'.
99 p It has to be replaced and must not have children nodes.
100 p See the statements `Mix` and `$append`, for how to append
101 + node branches to an $hook node.
102 ittf-panel
103 title The $append command
104 ittf
105 ...
106 ${'$'}append hook-name
107 ... node branch ...
108 p An $append command is the root of a node branch that will be
109 + appended to an ancestor $hook of `hook-name`.
110 + The children nodes of $append will replace the $hook node.
111 ittf-panel
112 title The $group command
113 ittf
114 ${'$'}group empty-value
115 node branch ...
116 node branch ...
117 ...
118 p An ITTF Document must have one and only one root node.
119 p The $group command is a convenience node that may be used as the root of
120 + a fragment that must have more than one root node.
121 p The $group node has no meaningful value. It disappear in the builded mTree.
122 ittf-panel
123 title The $if, $elif, $else commands
124 ittf
125 ...
126 ${'$'}if jswizzi-expression
127 ... node branch ...
128 ${'$'}elif jswizzi-expression
129 ... node branch ...
130 ${'$'}else empty-value
131 ... node branch ...
132 p Children nodes of these commands are included/excluded from the builded mTree
133 + depending on the value of the expression.
134 ittf-panel
135 title The $foreach and $backeach commands
136 ittf
137 ...
138 ${'$'}foreach item-name in collection-name
139 ... node branch ...
140 p Descendant nodes of this command are a repeat template; item-name
141 + is user defined and collection-name is a JsWizzi expression that evaluates
142 + to an iterable javascript object, that must be in scope in the fragment or in the global
143 + jsWizziContext.
144 p The var statement that declares item-name is auto-generated.
145 p Descendant nodes are repeated having item-name as a value in scope.
146 p The $backeach command iterates the collection backword.
147 ittf-panel
148 title The $break, $continue commands
149 ittf
150 ...
151 ${'$'}break
152 ...
153 ${'$'}continue
154 p This statements have the same meaning than in javascript but operate breaking or continuing
155 + the template repetition.
156 p A label for continuation is not implemented.
157 ittf-panel
158 title the $while command
159 ittf
160 ...
161 ${'$'}while jswizzi-expression
162 ... node branch ...
163 ${'$'} jswizzi-exit-condition-change
164 p This is a repeat template statement where descendant nodes are repeated
165 + until the jswizzi-expression evaluates to false.
166 p $ or $global commands must be used to modify the context values of the exit condition.
167 + There is a limit of 10,000 iterations to guard against accidental loops, after that an exception is raised.
168 p Example
169 ittf-panel
170 ittf
171 ...
172 ${'$'} i = 0
173 ${'$'}while i < 256
174 p Item ${'$'}{i}
175 ${'$'} i++
176 ittf-panel
177 title The $ command - single line
178 ittf
179 ...
180 ${'$'} jswizzi-statement
181 ittf-panel
182 title The $ command - multi line
183 ittf
184 ${'$'}
185 jswizzi-statement
186 jswizzi-statement
187 ...
188 p Descendant nodes of this command can contain JsWizzi expressions that,
189 + during the evaluation step, are executed in the fragment scope
190 + to wich the command belongs.
191 p They may declare and modify variables that have fragment scope, and
192 + modify variables that have global scope.
193 ittf-panel
194 title The $global command - single line
195 ittf
196 ...
197 ${'$'}global jswizzi-statement
198 ittf-panel
199 title The $global command - multi line
200 ittf
201 ...
202 ${'$'}global
203 jswizzi-statement
204 jswizzi-statement
205 ...
206 p Descendant nodes of this command can contain JsWizzi expressions that,
207 + during the evaluation step, are executed in the global scope of the jsWizziContext.
208 + They may declare or modify variables in the global scope.
209 ittf-panel
210 title The text container node: ${'$'}.
211 ittf
212 ...
213 ${'$'}.
214 free content
215 free content
216 ...
217 ittf-panel
218 title The single line comment: ${'$'}${'$'}
219 ittf
220 ...
221 ul
222 ${'$'}${'$'} <rest-of-line is comment>
223 li item ${'$'}${'$'} <rest-of-line is comment>
224 ittf-panel
225 title The multiline comment: ${'$'}${'*'} ... ${'*'}${'$'}
226 ittf
227 ...
228 ${'$'}${'*'}
229 ul
230 li
231 ${'*'}${'$'}
232 ittf-panel
233 title The $raw command
234 ittf
235 ...
236 ${'$'}raw execute()
237 p The $raw command is usefull when you need to write node lines skipping the template processing.
238 \b Usually you manage the $raw tag preprocessing the mTree before the Wizzi Model Loading.
239 \b TODO explain