wlang 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENCE.rdoc +25 -0
- data/README.rdoc +111 -0
- data/bin/wlang +24 -0
- data/doc/specification/about.rdoc +61 -0
- data/doc/specification/dialects.wtpl +0 -0
- data/doc/specification/examples.rb +3 -0
- data/doc/specification/glossary.wtpl +14 -0
- data/doc/specification/hosting.rdoc +0 -0
- data/doc/specification/overview.rdoc +116 -0
- data/doc/specification/rulesets.wtpl +87 -0
- data/doc/specification/specification.css +52 -0
- data/doc/specification/specification.html +1361 -0
- data/doc/specification/specification.js +8 -0
- data/doc/specification/specification.wtpl +41 -0
- data/doc/specification/specification.yml +430 -0
- data/doc/specification/symbols.wtpl +16 -0
- data/lib/wlang.rb +186 -0
- data/lib/wlang/basic_object.rb +19 -0
- data/lib/wlang/dialect.rb +230 -0
- data/lib/wlang/dialect_dsl.rb +136 -0
- data/lib/wlang/dialect_loader.rb +69 -0
- data/lib/wlang/dialects/coderay_dialect.rb +35 -0
- data/lib/wlang/dialects/plain_text_dialect.rb +75 -0
- data/lib/wlang/dialects/rdoc_dialect.rb +33 -0
- data/lib/wlang/dialects/ruby_dialect.rb +35 -0
- data/lib/wlang/dialects/sql_dialect.rb +38 -0
- data/lib/wlang/dialects/standard_dialects.rb +113 -0
- data/lib/wlang/dialects/xhtml_dialect.rb +40 -0
- data/lib/wlang/encoder.rb +66 -0
- data/lib/wlang/encoder_set.rb +117 -0
- data/lib/wlang/errors.rb +37 -0
- data/lib/wlang/intelligent_buffer.rb +94 -0
- data/lib/wlang/parser.rb +251 -0
- data/lib/wlang/parser_context.rb +146 -0
- data/lib/wlang/ruby_extensions.rb +21 -0
- data/lib/wlang/rule.rb +66 -0
- data/lib/wlang/rule_set.rb +93 -0
- data/lib/wlang/rulesets/basic_ruleset.rb +75 -0
- data/lib/wlang/rulesets/buffering_ruleset.rb +103 -0
- data/lib/wlang/rulesets/context_ruleset.rb +115 -0
- data/lib/wlang/rulesets/encoding_ruleset.rb +73 -0
- data/lib/wlang/rulesets/imperative_ruleset.rb +132 -0
- data/lib/wlang/rulesets/ruleset_utils.rb +296 -0
- data/lib/wlang/template.rb +79 -0
- data/lib/wlang/wlang_command.rb +54 -0
- data/lib/wlang/wlang_command_options.rb +158 -0
- data/test/sandbox.rb +1 -0
- data/test/test_all.rb +8 -0
- data/test/wlang/anagram_bugs_test.rb +111 -0
- data/test/wlang/basic_ruleset_test.rb +52 -0
- data/test/wlang/buffering_ruleset_test.rb +102 -0
- data/test/wlang/buffering_template1.wtpl +1 -0
- data/test/wlang/buffering_template2.wtpl +1 -0
- data/test/wlang/buffering_template3.wtpl +1 -0
- data/test/wlang/buffering_template4.wtpl +1 -0
- data/test/wlang/buffering_template5.wtpl +1 -0
- data/test/wlang/context_ruleset_test.rb +32 -0
- data/test/wlang/data.rb +3 -0
- data/test/wlang/encoder_set_test.rb +42 -0
- data/test/wlang/imperative_ruleset_test.rb +107 -0
- data/test/wlang/intelligent_buffer_test.rb +194 -0
- data/test/wlang/othersymbols_test.rb +16 -0
- data/test/wlang/parser_context_test.rb +29 -0
- data/test/wlang/parser_test.rb +89 -0
- data/test/wlang/plain_text_dialect_test.rb +21 -0
- data/test/wlang/ruby_dialect_test.rb +100 -0
- data/test/wlang/ruby_expected.rb +3 -0
- data/test/wlang/ruby_template.wrb +3 -0
- data/test/wlang/ruleset_utils_test.rb +245 -0
- data/test/wlang/specification_examples_test.rb +52 -0
- data/test/wlang/test_utils.rb +25 -0
- data/test/wlang/wlang_test.rb +80 -0
- metadata +136 -0
@@ -0,0 +1,8 @@
|
|
1
|
+
var current = 'about'
|
2
|
+
function show(who) {
|
3
|
+
document.getElementById(current).style.display = "none";
|
4
|
+
document.getElementById(current + 'focus').className = "unfocus";
|
5
|
+
document.getElementById(who).style.display = "block";
|
6
|
+
document.getElementById(who + 'focus').className = "focus";
|
7
|
+
current = who;
|
8
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<<={specification.yml as spec}
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>${spec/title} (version ${spec/version})</title>
|
7
|
+
<style type="text/css">
|
8
|
+
<<{specification.css}
|
9
|
+
</style>
|
10
|
+
<script type="text/javascript" language="JavaScript"><!--
|
11
|
+
<<{specification.js}
|
12
|
+
//--></script>
|
13
|
+
</head>
|
14
|
+
<body onload="show('about')">
|
15
|
+
<h1 id="title">${spec/title} (version ${spec/version})</h1>
|
16
|
+
<ul id="tabs">
|
17
|
+
*{spec["sections"].reverse as section}{
|
18
|
+
<li id="+{section/id}focus" onclick="show('{section/id}')">${section/name}</li>
|
19
|
+
}
|
20
|
+
</ul>
|
21
|
+
<div class="clear"></div>
|
22
|
+
*{spec/sections as section}{
|
23
|
+
<div id="{section/id}" style="display: none;">
|
24
|
+
<div class="header">
|
25
|
+
<h2>${section/name}</h2>
|
26
|
+
?{section/links}{
|
27
|
+
<ul class="links">
|
28
|
+
*{+{section/links} as link}{<li><a href="#${link/name}">${link/name}</a></li>}
|
29
|
+
</ul>
|
30
|
+
}
|
31
|
+
<div class="clear"></div>
|
32
|
+
</div>
|
33
|
+
?{/rdoc$/ =~ "{section/file}"}{
|
34
|
+
^{rdoc/div}{<<{+{section/file}}}
|
35
|
+
}{
|
36
|
+
<<+{+{section/file} with spec: spec}
|
37
|
+
}
|
38
|
+
</div>
|
39
|
+
}
|
40
|
+
</body>
|
41
|
+
</html>
|
@@ -0,0 +1,430 @@
|
|
1
|
+
---
|
2
|
+
title: WLang
|
3
|
+
version: 0.8.4
|
4
|
+
sections:
|
5
|
+
- id: about
|
6
|
+
name: About
|
7
|
+
file: about.rdoc
|
8
|
+
- id: overview
|
9
|
+
name: Overview
|
10
|
+
file: overview.rdoc
|
11
|
+
- id: rulesets
|
12
|
+
name: Rulesets
|
13
|
+
file: rulesets.wtpl
|
14
|
+
links: 'spec["rulesets"].reverse'
|
15
|
+
- id: dialects
|
16
|
+
name: Dialects
|
17
|
+
file: dialects.wtpl
|
18
|
+
- id: hosting
|
19
|
+
name: Hosting language
|
20
|
+
file: hosting.rdoc
|
21
|
+
- id: glossary
|
22
|
+
name: Glossary
|
23
|
+
file: glossary.wtpl
|
24
|
+
- id: symbols
|
25
|
+
name: Tag symbols
|
26
|
+
file: symbols.wtpl
|
27
|
+
glossary:
|
28
|
+
- term: template
|
29
|
+
definition: |-
|
30
|
+
Source code respecting the wlang grammar, and attached to a given <em>wlang
|
31
|
+
dialect</em>.
|
32
|
+
example: |-
|
33
|
+
<tt>Hello ${name}</tt>
|
34
|
+
- term: dialect
|
35
|
+
definition: |-
|
36
|
+
Basically, <em>dialect</em> is used as a synonym for (programming) <em>language</em>.
|
37
|
+
However _wlang_ uses a tree of dialects, allowing specializations: <tt>sql/sybase</tt>
|
38
|
+
for example is the qualified name of a sub-dialect 'sybase' of the 'sql' dialect.
|
39
|
+
Dialects come with associated _encoders_.
|
40
|
+
example: |-
|
41
|
+
<tt>sql/sybase</tt>
|
42
|
+
- term: wlang dialect
|
43
|
+
definition: |-
|
44
|
+
When we talk about a <em>wlang dialect</em>, we are actually refering to some
|
45
|
+
specialization of the wlang tag-based grammar: <tt>wlang/xhtml</tt> for example
|
46
|
+
is the templating language _wlang_ proposes to generate xhtml pages. An
|
47
|
+
example of source code in that dialect has been shown before.
|
48
|
+
In addition to its encoders a <em>wlang dialect</em> comes with its sets of _tags_
|
49
|
+
and associated _rules_.
|
50
|
+
example: |-
|
51
|
+
<tt>wlang/xhtml</tt>
|
52
|
+
- term: encoder
|
53
|
+
definition: |-
|
54
|
+
Text transformation (algorithm) applying some encoding conventions of a portion
|
55
|
+
of a the target language generated by a dialect. HTML entities-encoding, SQL's back-quoting
|
56
|
+
are examples of encoders. Encoders are accessible through their qualified name (dialect/encoder).
|
57
|
+
example: |-
|
58
|
+
<tt>xhtml/entities-encoding</tt><br/><tt>sql/single-quoting</tt>
|
59
|
+
- term: ruleset
|
60
|
+
definition: |-
|
61
|
+
Reusable set of <em>tags</em> associated to <em>rule</em>s.
|
62
|
+
example: |-
|
63
|
+
<tt>Imperative ruleset</tt><br/><tt>Encoding rulset</tt>
|
64
|
+
- term: wlang tag
|
65
|
+
definition: |-
|
66
|
+
Special tags in the template, starting with wlang symbols and a number of wlang
|
67
|
+
blocks. A tag is associated with a wlang rule.
|
68
|
+
example: |-
|
69
|
+
<tt>${...}</tt><br/><tt>?{...}{...}{...}</tt>
|
70
|
+
- term: rule
|
71
|
+
definition: |-
|
72
|
+
Transformation semantics of a given <em>tag</em>. When wlang instantiates a
|
73
|
+
template it simply replaces <em>wlang tags</em> by some <em>replacement value</em>
|
74
|
+
(which is always a string). This value is computed by the rule attached to
|
75
|
+
the tag. Rule definition (see Rulesets tab on top of the page)
|
76
|
+
explicitly describes the number of blocks it expects, in which dialect they
|
77
|
+
are parsed and instantiated and the way the replacement value is computed.
|
78
|
+
example: |-
|
79
|
+
<tt>^{wlang/active-string}{...}</tt><br/>
|
80
|
+
Instantiates #1, looking for an encoder qualified name. Instantiates #2 in
|
81
|
+
the current dialect. Encode #2's instantiation using encoder found in (#1)
|
82
|
+
and return the result as replacement value.
|
83
|
+
- term: context
|
84
|
+
definition: |-
|
85
|
+
Some rules allow code to be executed in the <em>hosting language</em> (the
|
86
|
+
definition explicitly announce it by putting <tt>wlang/hosted</tt> in the corresponding
|
87
|
+
block). When doing so, this code is in fact executed in a given context that
|
88
|
+
provides the execution semantics.
|
89
|
+
- term: hosting language
|
90
|
+
definition: |-
|
91
|
+
language (or framework) that executes wlang. More precisely, the hosting language
|
92
|
+
is the one that rules what is considered as an executable expression in tags that
|
93
|
+
relies on some execution semantics (like !{...} for example). See the 'Hosting language'
|
94
|
+
section to learn more.
|
95
|
+
example: |-
|
96
|
+
ruby
|
97
|
+
rulesets:
|
98
|
+
- name: Basic
|
99
|
+
description: |-
|
100
|
+
The Basic ruleset is commonly installed on any dialect and provides access to _wlang_
|
101
|
+
foundations inside your template: requesting the hosting language to execute some expression,
|
102
|
+
changing the current dialect and encoding text.
|
103
|
+
examples:
|
104
|
+
- ["wlang/active-string", "Hello !{name}", "Hello O'Neil"]
|
105
|
+
- ["wlang/active-string", "Hello %{wlang/dummy}{!{name}}", "Hello !{name}"]
|
106
|
+
- ["wlang/dummy", "Hello %{wlang/dummy}{!{name}}", "Hello %{wlang/dummy}{!{name}}"]
|
107
|
+
- ["wlang/active-string", "Hello ^{plain-text/upcase}{${name}}", "Hello O'NEIL"]
|
108
|
+
rules:
|
109
|
+
# !{wlang/hosted}
|
110
|
+
- name: "execution"
|
111
|
+
symbol: "!"
|
112
|
+
signature: "!{wlang/hosted}"
|
113
|
+
definition: |-
|
114
|
+
Instantiates #1, looking for an expression of the hosting language. Evaluates it,
|
115
|
+
looking for any object. Converts it to a string (using to_s for example if Ruby is
|
116
|
+
the hosting language) and returns the result as replacement value.
|
117
|
+
|
118
|
+
# %{wlang/active-string}{...}
|
119
|
+
- name: "modulation"
|
120
|
+
symbol: "%"
|
121
|
+
signature: "%{wlang/active-string}{...}"
|
122
|
+
definition: |-
|
123
|
+
Instantiates #1, looking for a dialect qualified name. Instantiates #2
|
124
|
+
according to the rules defined by that dialect and returns the #2's
|
125
|
+
instantiation as replacement value.
|
126
|
+
|
127
|
+
# ^{wlang/active-string}{...}
|
128
|
+
- name: "encoding"
|
129
|
+
symbol: "^"
|
130
|
+
signature: "^{wlang/active-string}{...}"
|
131
|
+
definition: |-
|
132
|
+
Instantiates #1, looking for an encoder qualified name. Instantiates #2 in
|
133
|
+
the current dialect. Encode #2's instantiation using encoder found in (#1) and
|
134
|
+
returns encoding as replacement value.
|
135
|
+
|
136
|
+
# %!{wlang/active-string using ... with ...}{...}
|
137
|
+
- name: "recursive-application"
|
138
|
+
symbol: "%!"
|
139
|
+
signature: "%!{wlang/active-string <using>? <with>?}{...}"
|
140
|
+
definition: |-
|
141
|
+
Instantiates #1, looking for a dialect qualified name. Instantiates #2
|
142
|
+
in the current dialect. Instantiates #2's instantiation in the dialect found
|
143
|
+
in #1, using context installed by 'using ...' and 'with ...'. Returns this
|
144
|
+
instantiation as replacement value (this really advanced rule allows
|
145
|
+
metaprogramming).
|
146
|
+
|
147
|
+
# ${wlang/hosted}
|
148
|
+
- name: "injection"
|
149
|
+
symbol: "$"
|
150
|
+
signature: "${wlang/hosted}"
|
151
|
+
definition: Same semantics as execution (intended to be overrided).
|
152
|
+
|
153
|
+
# +{wlang/hosted}
|
154
|
+
- name: "inclusion"
|
155
|
+
symbol: "+"
|
156
|
+
signature: "+{wlang/hosted}"
|
157
|
+
definition: Same semantics as execution (intended to be overrided).
|
158
|
+
|
159
|
+
- name: Encoding
|
160
|
+
description: |-
|
161
|
+
Almost all languages require escaping/encoding in specific situations: quoted string literals
|
162
|
+
always come with an escaping mechanism (unfortunately different from one language to another),
|
163
|
+
html requires entities-encoding, etc. The Encoding ruleset proposes shortcut tags for encoding.
|
164
|
+
Note that these shortcuts are written in such a way that they don't depend on the effective
|
165
|
+
dialect. _wlang_ hides language and vendors differences!
|
166
|
+
examples:
|
167
|
+
- ["wlang/xhtml", "Hello &{name}", "Hello name"]
|
168
|
+
- ["wlang/xhtml", "Hello &{<script>}", "Hello <script>"]
|
169
|
+
- ["wlang/xhtml", "Hello &;{<script>}", "Hello <script>"]
|
170
|
+
- ["wlang/ruby", "puts 'Hello &'{name}'", "puts 'Hello name'"]
|
171
|
+
- ["wlang/ruby", "puts 'Hello &'{!{name}}'", "puts 'Hello O\'Neil'"]
|
172
|
+
- ["wlang/ruby", "puts 'Hello ' << '{name}'", "puts 'Hello ' << 'O\'Neil'"]
|
173
|
+
- ["wlang/sql", "... WHERE name='{name}'", "... WHERE name='O\'Neil'"]
|
174
|
+
- ["wlang/sql/sybase", "... WHERE name='{name}'", "... WHERE name='O''Neil'"]
|
175
|
+
rules:
|
176
|
+
# &{...}
|
177
|
+
- name: "main-encoding"
|
178
|
+
symbol: "&"
|
179
|
+
signature: "&{...}"
|
180
|
+
definition: "<tt>^{+{@parser.current_dialect}/main-encoding}{#1}</tt>"
|
181
|
+
|
182
|
+
# &;{...}
|
183
|
+
- name: "entities-encoding"
|
184
|
+
symbol: "&;"
|
185
|
+
signature: "&;{...}"
|
186
|
+
definition: "<tt>^{+{@parser.current_dialect}/entities-encoding}{#1}</tt>"
|
187
|
+
|
188
|
+
# &'{...}
|
189
|
+
- name: "single-quoting"
|
190
|
+
symbol: "&'"
|
191
|
+
signature: "&'{...}"
|
192
|
+
definition: "<tt>^{+{@parser.current_dialect}/single-quoting}{#1}</tt>"
|
193
|
+
|
194
|
+
# &;{...}
|
195
|
+
- name: "double-quoting"
|
196
|
+
symbol: '&"'
|
197
|
+
signature: '&"{...}'
|
198
|
+
definition: "<tt>^{+{@parser.current_dialect}/double-quoting}{#1}</tt>"
|
199
|
+
|
200
|
+
# ${wlang/hosted}
|
201
|
+
- name: "injection"
|
202
|
+
symbol: "$"
|
203
|
+
signature: "${wlang/hosted}"
|
204
|
+
definition: "<tt>&{+{#1}}</tt>"
|
205
|
+
|
206
|
+
# '{wlang/hosted}
|
207
|
+
- name: "single-quoted"
|
208
|
+
symbol: "'"
|
209
|
+
signature: "'{wlang/hosted}"
|
210
|
+
definition: |-
|
211
|
+
<tt>'&'{+{#1}}</tt> (first single quote is kept in the result)
|
212
|
+
|
213
|
+
# "{wlang/hosted}
|
214
|
+
- name: "double-quoted"
|
215
|
+
symbol: '"'
|
216
|
+
signature: '"{wlang/hosted}'
|
217
|
+
definition: |-
|
218
|
+
<tt>"&"{+{#1}}</tt> (first double quote is kept in the result)
|
219
|
+
|
220
|
+
- name: Imperative
|
221
|
+
description: |-
|
222
|
+
Instantiating conditionally and iterating collection elements are common code generation tasks.
|
223
|
+
The Imperative dialect provides these features.
|
224
|
+
examples:
|
225
|
+
- ["wlang/*", '?{true}{then}{else}', 'then']
|
226
|
+
- ["wlang/*", '?{/th/ =~ "not tat"}{then}{else}', 'else']
|
227
|
+
- ["wlang/*", '?{authors.include? "blambeau"}{yes}{no}', 'yes']
|
228
|
+
- ["wlang/*", '[*{authors as a}{"{a}"}{, }]', '["blambeau", "llambeau", "ancailliau"]']
|
229
|
+
rules:
|
230
|
+
# ?{wlang/hosted}{...}{...}
|
231
|
+
- name: "conditional<br/>(third block is optional)"
|
232
|
+
symbol: "?"
|
233
|
+
signature: "?{wlang/hosted}{...}{...}"
|
234
|
+
definition: |-
|
235
|
+
Instantiates #1, looking for an expression in the hosting language.
|
236
|
+
Evaluates it, looking for a boolean value (according to boolean semantics
|
237
|
+
of the hosting language). If true, instantiates #2, otherwise instantiates
|
238
|
+
#3 if present, returning instantiation as replacement value.
|
239
|
+
|
240
|
+
# *{wlang/hosted as x}{...}{...}
|
241
|
+
- name: "enumeration<br/>(third block is optional)"
|
242
|
+
symbol: "*"
|
243
|
+
signature: "*{wlang/hosted <as x>?}{...}{...}"
|
244
|
+
definition: |-
|
245
|
+
Instantiates #1, looking for an expression in the hosting language. Evaluates
|
246
|
+
it, looking for an enumerable. Iterates all its elements, instantiating #2 for
|
247
|
+
each of them (the iterated value is set under name x in the scope). If #3 is
|
248
|
+
present, it is instantiated between elements. Replacement is the concatenation
|
249
|
+
of all these instantiations.
|
250
|
+
|
251
|
+
- name: Context
|
252
|
+
description: |-
|
253
|
+
Complex templates come with specific needs. The ability to manipulate the context and the current
|
254
|
+
scope is provided by the Context ruleset. All are variants of 'saving previous instantiations' in
|
255
|
+
scope variables...
|
256
|
+
examples:
|
257
|
+
- ["wlang/*", '={name as n}{Hello +{n}}', "Hello O'Neil"]
|
258
|
+
- ["wlang/*", '={name as n}Hello +{n}', "Hello O'Neil"]
|
259
|
+
- ["wlang/*", '#={name}{blambeau}{Hello +{name}} and +{name}', "Hello blambeau and O'Neil"]
|
260
|
+
- ["wlang/*", '#={name}{blambeau}Hello +{name} and +{name}', "Hello blambeau and blambeau"]
|
261
|
+
- ["wlang/*", '={author as name}{Hello +{name}} and +{name}', "Hello blambeau and O'Neil"]
|
262
|
+
- ["wlang/*", '={author as name}Hello +{name} and +{name}', "Hello blambeau and blambeau"]
|
263
|
+
- ["wlang/*", '%={wlang/dummy as hello}{Hello +{name}}{+{hello}}', "Hello +{name}"]
|
264
|
+
- ["wlang/*", '^={plain-text/upcase as name}{+{author}}{Hello +{name}} and +{name}', "Hello BLAMBEAU and O'Neil"]
|
265
|
+
- ["wlang/*", '^={plain-text/upcase as name}{+{author}}Hello +{name} and +{name}', "Hello BLAMBEAU and BLAMBEAU"]
|
266
|
+
|
267
|
+
rules:
|
268
|
+
# ={wlang/hosted as x}{...}
|
269
|
+
- name: "assignment<br/>(second block is optional)"
|
270
|
+
symbol: "="
|
271
|
+
signature: "={wlang/hosted <as x>}{...}"
|
272
|
+
definition: |-
|
273
|
+
Instantiates #1, looking for an expression in the hosting language. Evaluates
|
274
|
+
it, looking for any object. Without second block, expands the current scope with
|
275
|
+
'x' being bound to evaluation result. Otherwise, branches the current scope for
|
276
|
+
the second block instantiation only and bind 'x' the same way (i.e. x will not be
|
277
|
+
available outside the second block). Returns an empty string as replacement value.
|
278
|
+
# %={wlang/active-string as x}{...}{...}
|
279
|
+
- name: "modulo-assignment<br/>(third block is optional)"
|
280
|
+
symbol: "%="
|
281
|
+
signature: "%={wlang/active-string <as x>}{...}{...}"
|
282
|
+
definition: |-
|
283
|
+
Instantiates #1, looking for a dialect qualified name. Instantiates #2 according
|
284
|
+
to the rules defined by that dialect. Without third block, expands the current
|
285
|
+
scope with 'x' being bound to #2's instantiation. Otherwise, branches the current
|
286
|
+
scope for the third block instantiation only and binds 'x' the same way (i.e. x will
|
287
|
+
not be available outside the third block). Returns an empty string as replacement
|
288
|
+
value.
|
289
|
+
# #={wlang/active-string}{...}{...}
|
290
|
+
- name: "block-assignment<br/>(third block is optional)"
|
291
|
+
symbol: "="
|
292
|
+
signature: "#={wlang/active-string <as x>}{...}{...}"
|
293
|
+
definition: |-
|
294
|
+
<tt>%={+{@parser.current_dialect} as #1}{#2}{#3}</tt>
|
295
|
+
# ^={wlang/active-string as x}{...}{...}
|
296
|
+
- name: "encoding-assignment<br/>(third block is optional)"
|
297
|
+
symbol: "^="
|
298
|
+
signature: "^={wlang/active-string <as x>}{...}{...}"
|
299
|
+
definition: |-
|
300
|
+
<tt>%={+{@parser.current_dialect} as x}{^{#1}{#2}}{#3}</tt>
|
301
|
+
|
302
|
+
- name: Buffering
|
303
|
+
description: |-
|
304
|
+
The Buffering ruleset is probably one of the more useful. It allows you to load text and data files,
|
305
|
+
to change the current output buffer (for generating multiple files for example) and even to start
|
306
|
+
the instantiation on other templates.
|
307
|
+
rules:
|
308
|
+
# <<{wlang/uri}
|
309
|
+
- name: "input"
|
310
|
+
symbol: "<<"
|
311
|
+
signature: "<<{wlang/uri}"
|
312
|
+
definition: |-
|
313
|
+
Instantiates #1, looking for an uri. Returns the text content of the found
|
314
|
+
uri (#1) as replacement value.
|
315
|
+
# >>{wlang/uri}
|
316
|
+
- name: "output"
|
317
|
+
symbol: ">>"
|
318
|
+
signature: ">>{wlang/uri}{...}"
|
319
|
+
definition: |-
|
320
|
+
Instantiates #1, looking for an uri. Instantiates #2 in the current dialect,
|
321
|
+
using the file found in #1 as output buffer. Returns an empty string as replacement
|
322
|
+
value.
|
323
|
+
# <<={wlang/uri as x}{...}
|
324
|
+
- name: "data-assignment"
|
325
|
+
symbol: "<<="
|
326
|
+
signature: "<<={wlang/uri <as x>}{...}"
|
327
|
+
definition: |-
|
328
|
+
Instantiates #1, looking for an uri. Loads data provided by this uri, based on the
|
329
|
+
file extension (typically .yml or .rb). Without second block, expands the current scope
|
330
|
+
with 'x' being bound to the data. Otherwise, branches the current scope for the second
|
331
|
+
block instantiation only and binds 'x' the same way (i.e. x will not be available outside
|
332
|
+
the second block). Returns an empty string as replacement value.
|
333
|
+
# <<+{wlang/uri with ...}
|
334
|
+
- name: "input-inclusion"
|
335
|
+
symbol: "<<+"
|
336
|
+
signature: "<<+{wlang/uri <using>? <with>?}"
|
337
|
+
definition: |-
|
338
|
+
Instantiates #1, looking for an uri. Instantiates the _wlang_ template at this location
|
339
|
+
(the dialect is infered from the file extension) in a fresh new scope built from the _with_
|
340
|
+
expression. Returns this instantiation as replacement value.
|
341
|
+
|
342
|
+
symbols:
|
343
|
+
- name: exclamation mark
|
344
|
+
symbol: '!'
|
345
|
+
meaning: execution
|
346
|
+
remark: should never be overrided as single
|
347
|
+
- name: 'caret/circumflex'
|
348
|
+
symbol: '^'
|
349
|
+
meaning: explicit encoding
|
350
|
+
remark: should never be overrided as single
|
351
|
+
- name: percent
|
352
|
+
symbol: '%'
|
353
|
+
meaning: modulation
|
354
|
+
remark: should never be overrided as single
|
355
|
+
- name: double quote
|
356
|
+
symbol: '"'
|
357
|
+
meaning: double-quoting
|
358
|
+
- name: dollar
|
359
|
+
symbol: '$'
|
360
|
+
meaning: 'main-encoding'
|
361
|
+
- name: ampersand
|
362
|
+
symbol: '&'
|
363
|
+
meaning: encoding
|
364
|
+
- name: single quote
|
365
|
+
symbol: "'"
|
366
|
+
meaning: single-quoting
|
367
|
+
- name: asterisk
|
368
|
+
symbol: '*'
|
369
|
+
meaning: iteration
|
370
|
+
- name: plus
|
371
|
+
symbol: '+'
|
372
|
+
meaning: inclusion
|
373
|
+
- name: question mark
|
374
|
+
symbol: '?'
|
375
|
+
meaning: condition
|
376
|
+
- name: at symbol
|
377
|
+
symbol: '@'
|
378
|
+
meaning: linking
|
379
|
+
- name: tilde
|
380
|
+
symbol: '~'
|
381
|
+
meaning: matching
|
382
|
+
- name: number sign
|
383
|
+
symbol: '#'
|
384
|
+
- name: comma
|
385
|
+
symbol: ','
|
386
|
+
- name: minus (dash)
|
387
|
+
symbol: '-'
|
388
|
+
- name: dot
|
389
|
+
symbol: '.'
|
390
|
+
- name: forward slash
|
391
|
+
symbol: '/'
|
392
|
+
- name: colon
|
393
|
+
symbol: ':'
|
394
|
+
- name: 'semi-colon'
|
395
|
+
symbol: ';'
|
396
|
+
- name: equal sign
|
397
|
+
symbol: '='
|
398
|
+
- name: less than
|
399
|
+
symbol: '<'
|
400
|
+
- name: greater than
|
401
|
+
symbol: '>'
|
402
|
+
- name: vertical bar
|
403
|
+
symbol: '|'
|
404
|
+
- name: underscore
|
405
|
+
symbol: '_'
|
406
|
+
remark: cannot be used as tag symbol; reserved for escaping in future versions
|
407
|
+
- name: back slash
|
408
|
+
symbol: \
|
409
|
+
remark: cannot be used as tag symbol; reserved for escaping in current version
|
410
|
+
- name: left parenthesis
|
411
|
+
symbol: '('
|
412
|
+
remark: cannot be used as tag symbol; reserved for block delimiter
|
413
|
+
- name: right parenthesis
|
414
|
+
symbol: ')'
|
415
|
+
remark: cannot be used as tag symbol; reserved for block delimiter
|
416
|
+
- name: left bracket
|
417
|
+
symbol: '['
|
418
|
+
remark: cannot be used as tag symbol; reserved for block delimiter
|
419
|
+
- name: right bracket
|
420
|
+
symbol: ']'
|
421
|
+
remark: cannot be used as tag symbol; reserved for block delimiter
|
422
|
+
- name: left brace
|
423
|
+
symbol: '{'
|
424
|
+
remark: cannot be used as tag symbol; reserved for block delimiter
|
425
|
+
- name: right brace
|
426
|
+
symbol: '}'
|
427
|
+
remark: cannot be used as tag symbol; reserved for block delimiter
|
428
|
+
|
429
|
+
|
430
|
+
|