wlang 0.9.2 → 0.10.0

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.
Files changed (36) hide show
  1. data/CHANGELOG.md +96 -0
  2. data/{LICENCE.rdoc → LICENCE.md} +2 -2
  3. data/README.md +176 -0
  4. data/bin/wlang +1 -0
  5. data/doc/specification/dialects.wtpl +1 -1
  6. data/doc/specification/specification.html +1237 -1001
  7. data/doc/specification/specification.yml +12 -10
  8. data/lib/wlang.rb +2 -2
  9. data/lib/wlang/dialects/coderay_dialect.rb +1 -0
  10. data/lib/wlang/dialects/hosted_dialect.rb +50 -0
  11. data/lib/wlang/dialects/plain_text_dialect.rb +2 -2
  12. data/lib/wlang/dialects/ruby_dialect.rb +74 -5
  13. data/lib/wlang/dialects/standard_dialects.rb +41 -0
  14. data/lib/wlang/dialects/yaml_dialect.rb +30 -0
  15. data/lib/wlang/encoder.rb +0 -4
  16. data/lib/wlang/ext/string.rb +7 -2
  17. data/lib/wlang/parser.rb +1 -1
  18. data/lib/wlang/rulesets/basic_ruleset.rb +1 -1
  19. data/lib/wlang/rulesets/context_ruleset.rb +3 -3
  20. data/lib/wlang/rulesets/encoding_ruleset.rb +3 -3
  21. data/lib/wlang/rulesets/imperative_ruleset.rb +2 -2
  22. data/test/spec/test_all.rb +1 -1
  23. data/test/standard_dialects/ruby/data.rb +7 -0
  24. data/test/standard_dialects/ruby/inclusion.exp +6 -0
  25. data/test/standard_dialects/ruby/inclusion.tpl +6 -0
  26. data/test/standard_dialects/test_all.rb +29 -0
  27. data/test/standard_dialects/yaml/assumptions_test.rb +13 -0
  28. data/test/standard_dialects/yaml/data.rb +3 -0
  29. data/test/standard_dialects/yaml/inclusion_1.exp +7 -0
  30. data/test/standard_dialects/yaml/inclusion_1.tpl +2 -0
  31. data/test/standard_dialects/yaml/inclusion_2.exp +5 -0
  32. data/test/standard_dialects/yaml/inclusion_2.tpl +3 -0
  33. data/test/unit/wlang/ruby_dialect_test.rb +1 -1
  34. metadata +23 -11
  35. data/CHANGELOG.rdoc +0 -73
  36. data/README.rdoc +0 -165
data/CHANGELOG.md ADDED
@@ -0,0 +1,96 @@
1
+ # Version 0.10.0
2
+
3
+ ## New features
4
+
5
+ * Introduced a wlang/hosted language which parses blocks as actually described in the specification
6
+ * Introduced a semantics +{...} in wlang/ruby that prints literals.
7
+ * wlang/ruby now includes the Buffering ruleset
8
+ * Introduced a wlang/active-text dialect which includes Basic, Imperative, Buffering and Context rulesets.
9
+ * Introduced a wlang/yaml dialect with special inclusion +{...} operator
10
+
11
+ ## Broken features and APIs
12
+
13
+ * Due to the wlang/ruby <-> wlang/hosted changes and the fact that wlang/ruby now includes the
14
+ Buffering ruleset, users that generate ruby (a few) may have broken templates and should probably
15
+ be pessimist and require wlang 0.9.x
16
+ * For the same reason, users that make complex wlang meta-constructions ala +{+{...}} could observe
17
+ problems due to the change of +{...} in wlang/ruby. The wlang/hosted dialect is introduced to limit
18
+ such problems, but not encountering them is not guaranteed.
19
+
20
+ ## Development-based changesets
21
+
22
+ * Moved to rspec 2.4.0
23
+ * Moved from rdoc to yard for generating the documentation
24
+ * README, CHANGELOG and LICENCE are now in Mardown instead of rdoc
25
+
26
+ # Version 0.9.2
27
+
28
+ ## New features (by order of importance)
29
+
30
+ * Implements main transformer on dialects
31
+ * Makes coderay encoders available without options using a bit of meta programming
32
+ * System-local absolute paths (i.e. starting with '/') are recognized by buffer rulesets
33
+
34
+ # Version 0.9.1
35
+
36
+ ## Bug fixes
37
+
38
+ * #307, about HashScope.has_key? which returned nil instead of false in some situations
39
+
40
+ ## Broken features and APIs (by order of importance)
41
+
42
+ * HostedLanguage::DSL is strictly private and should be reopened. Methods added to this class
43
+ will never be available in templates. Use HostedLanguage.variable_missing instead.
44
+ * ::WLang::BasicObject has been removed. HostedLanguage::DSL implements its own strategy, which
45
+ is spec tested in test/spec/basic_object.spec
46
+
47
+ ## New features (by order of importance)
48
+
49
+ * WLang does not requires the rdoc gem by default
50
+ * A new encoder redcloth/xhtml allows using Textile markups easily
51
+ * The wlang/xhtml dialect provides a tag helper for links @{...}{...}
52
+ * The parser class returns friendly messages when a rule is ill-implemented
53
+
54
+ # Version 0.9.0
55
+
56
+ ## Broken features and APIs (by order of importance)
57
+
58
+ * Major broken API in WLang.instantiate and WLang.file_instantiate which do not allow passing
59
+ buffers anymore
60
+ * Hash are not methodized by default anymore (major broken feature with 0.8.x versions)
61
+ * Expressions 'a la' PHP w@w (sections/.../.../id) are not supported anymore
62
+ * The default hosted language raises a WLang::UndefinedVariableError when a variable cannot be
63
+ found in the current template scope (0.8.x versions returned nil in this case)
64
+ * Template.initialize does not take a default context anymore
65
+ * WLang::Parser.context_xxx do not exist anymore. Use branch(...) instead
66
+ * WLang::Parser::Context removed, and WLang::HashScope introduced
67
+ * WLang::Parser instance variables are all made protected
68
+
69
+ ## New features (by order of importance)
70
+
71
+ * WLang::HostingLanguage introduced, with a default one for Ruby. The hosting language
72
+ is the way to provide a main scope, accessible to all templates at once.
73
+ * WLang::HostingLanguage is not sensitive to the difference between symbol keys and strings
74
+ * Buffering and Context rulesets now branch the current parser instead of creating a new one
75
+ * WLang::Error and subclasses propose a backtrace information
76
+ * WLang::Parser refactored to encapsulate the whole state in another class (WLang::Parser::State)
77
+ * WLang facade has been made much more robust as it now checks all its arguments.
78
+ * WLang::dialect may now be used to ensure dialect instances from both Dialect args and qualified names.
79
+ * Introduction of WLang.template and WLang.file_template
80
+ * plain-text dialect proposes new camel-based encoders
81
+ * wlang/active-string dialect has the imperative rule set included
82
+ * sql dialect has been added
83
+ * ruby dialect proposes a method-case encoder
84
+
85
+ # Version 0.8.5
86
+
87
+ * Enhances error messages a lot
88
+ * Some bug fixes for ruby 0.8.7
89
+
90
+ # Version 0.8.4
91
+
92
+ * Migration from svn.chefbe.net to github.com
93
+
94
+ # Version 0.8.0
95
+
96
+ * First public version
@@ -1,8 +1,8 @@
1
- = Licence
1
+ # Licence
2
2
 
3
3
  The MIT License
4
4
 
5
- Copyright (c) 2009 Bernard & Louis Lambeau and the University of Louvain
5
+ Copyright (c) 2009-2011 Bernard & Louis Lambeau and the University of Louvain
6
6
  (Universite Catholique de Louvain, Louvain-la-Neuve, Belgium)
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
data/README.md ADDED
@@ -0,0 +1,176 @@
1
+ # What is _wlang_ ?
2
+
3
+ _wlang_ is a simple, powerful, robust and secure <b>code generation</b>/<b>templating engine</b>
4
+ (at least, authors hope so ;-) Motivation for it can be found at http://www.revision-zero.org/wlang.
5
+ It's main aim is to help you creating web pages, sql queries, ruby code (that is, generating code in
6
+ general) without having to worry too much about html entities encoding, sql back quoting, string
7
+ escaping and the like. WLang proposes a generic engine that you can extend to fit your needs. It also
8
+ proposes standard instantiations of this engine for common tasks such as creating SQL queries,
9
+ instantiating web pages, etc.
10
+
11
+ Basic concepts and usage is illustrated below. Also have a look at the [detailed specification](http://blambeau.github.com/wlang).
12
+
13
+ ## A collection of typical encoders
14
+
15
+ The first basic usage of WLang is to provide a collection of text encoders:
16
+
17
+ WLang::encode('&', 'xhtml/entities-encoding') # &amp;
18
+ WLang::encode("O'Neil", 'sql/single-quoting') # O\'Neil
19
+ WLang::encode("O'Neil", 'sql/sybase/single-quoting') # O''Neil
20
+ ...
21
+ WLang::encode("hello world", 'plain-text/camel') # HelloWorld
22
+ WLang::encode("hello world", 'plain-text/lower-camel') # helloWorld
23
+ ...
24
+ WLang::encode("helloWorld", 'ruby/method-case') # hello_world
25
+
26
+ ## A powerful alternative to ruby string interpolation
27
+
28
+ The second usage is to have shortcuts for using these encoders in typical
29
+ situations:
30
+
31
+ # Hello world!
32
+ "Hello ${who}!".wlang(:who => 'world')
33
+
34
+ # Hello cruel &amp; world!
35
+ "Hello ${who}!".wlang({:who => 'cruel & world'}, 'wlang/xhtml')
36
+
37
+ # Hello blambeau, llambeau
38
+ "Hello *{authors as a}{${a}}{, }".wlang(:authors => ['blambeau', 'llambeau'])
39
+
40
+ # INSERT INTO people VALUES ('O\'Neil')
41
+ INSERT INTO people VALUES ('{who}')".wlang(:who => "O'Neil")
42
+
43
+ ## A powerful templating engine
44
+
45
+ But the main usage of _wlang_ is as follows (for bold words, see terminology later):
46
+ you have a *template* file (written in a given _wlang_ *dialect*), you have some
47
+ instantiation *context* (data provided through a Ruby Hash or a yaml file for
48
+ example) and you would like to instantiate the template with that data.
49
+
50
+ Example: a template.whtml as follows
51
+ <html>
52
+ <head>
53
+ <title>${title}</title>
54
+ </head>
55
+ <body>
56
+ <h1>Hello ${who} !</h1>
57
+ </body>
58
+ </html>
59
+
60
+ Instantiation data is a hash containing values for _title_ and _who_. Instantiating
61
+ the template is straightforward:
62
+
63
+ require 'wlang'
64
+ context = {"title" => "Hello world in WLang", "who" => "Alice"}
65
+ STDOUT << WLang.file_instantiate("template.whtml", context)
66
+
67
+ ## Behind the scene
68
+
69
+ - WLang helps you avoiding SQL injection and XSS attacks through the same tags reacting differently
70
+ in different contexts.
71
+ - WLang understands your context (and its dialect) from the template file extension
72
+ - WLang provides a rich collection of pre-defined tags and dialects
73
+ - WLang allows you to create your own encoders, tags and dialects while reusing existing ones
74
+ - WLang may change the current dialect during the template instantiation itself (generating
75
+ html with embedded javascript is easy and natural)
76
+ - WLang is able to generate wlang code without any perturabation
77
+
78
+ ## Additional examples (availability of the tags may depend on the dialect)
79
+
80
+ * Include text files on the fly
81
+
82
+ <<{my_file.html}
83
+
84
+ * Instantiate sub-templates on the fly, passing data as arguments
85
+
86
+ <<+{my_sub_template.whtml using who: 'wlang'}
87
+
88
+ * Load data from yaml or ruby files on the fly
89
+
90
+ <<={resources.yaml as resources}{
91
+ *{resources as r}{ ${r} }
92
+ }
93
+
94
+ * WLang instrospection (basic example)
95
+
96
+ context = {:varname => 'who', :who => 'wlang'}
97
+ "Hello ${${varname}}!".wlang(context) # => Hello wlang!
98
+
99
+ * Generate a wlang template and instantiate it after that
100
+
101
+ dialect = 'wlang/active-string'
102
+ tpl = "Hello $(${varname})!" # => Hello $(${varname})
103
+ tpl = tpl.wlang(:varname => 'who') # => Hello $(who)!
104
+ tpl = tpl.wlang({:who => 'wlang'}, dialect, :parentheses) # => Hello wlang!
105
+
106
+ ## Roadmap
107
+
108
+ - For terminology and a quick overview of _wlang_ for generating code, read on.
109
+ - For the current cheatsheet/specification see the file doc/specification/specification.html
110
+ - If you want to learn _wlang_ quickly, see the example directory or read examples
111
+ in the specification file (if you understand all examples in the specification file, then you
112
+ probably master wlang.
113
+ - If you want a killer example (but simple) see the way the specification.html file
114
+ is generated in doc/specification directory
115
+ - If you want to know which dialects are available (that is, in which target languages
116
+ you can generate code), see the specification as well or read the file
117
+ lib/wlang/dialects/standard_dialects.rb in the source distribution.
118
+ - If you want to create your own wlang dialect, see WLang::Dialect::DSL
119
+ - If you think that your own dialect is of generic purpose and well-designed, if
120
+ you have any question or want to contribute join us on {github}[http://github.com/blambeau/wlang].
121
+
122
+ ## Terminology
123
+
124
+ _wlang_ comes with a well-defined terminology for the underlying abstractions. As
125
+ the documentation uses it, you'll probably be happy to learn about the main abstractions
126
+ and associated terms.
127
+
128
+ _template_ : Source code respecting the wlang grammar, and attached to a given <em>wlang
129
+ dialect</em>. Asbtraction implemented by WLang::Template.
130
+
131
+ _dialect_ : Basically, <em>dialect</em> is used as a synonym for (programming) <em>language</em>.
132
+ However _wlang_ uses a tree of dialects, allowing specializations: <tt>sql/sybase</tt>
133
+ for example is the qualified name of a sub-dialect 'sybase' of the 'sql' dialect.
134
+ Dialects come with associated _encoders_. Abstraction implemented by WLang::Dialect.
135
+
136
+ _wlang dialect_ : When we talk about a <em>wlang dialect</em>, we are actually refering to some
137
+ specialization of the wlang tag-based grammar: <tt>wlang/xhtml</tt> for example
138
+ is the templating language _wlang_ proposes to generate xhtml pages. An
139
+ example of source code in that dialect has been shown before.
140
+ In addition to its encoders a <em>wlang dialect</em> comes with its sets of _tags_
141
+ and associated _rules_. Abstraction implemented by WLang::Dialect as well as
142
+ WLang::EncoderSet and WLang::RuleSet.
143
+
144
+ _encoder set_ : Reusable set of <em>encoders</em>, attached to a dialect. Abstraction
145
+ implemented by WLang::EncoderSet.
146
+
147
+ _encoder_ : Text transformation (algorithm) applying some encoding conventions of a portion
148
+ of a the target language generated by a dialect. HTML entities-encoding, SQL's back-quoting
149
+ are examples of encoders. Encoders are accessible through their qualified name:
150
+ xhtml/entities-encoding and sql/back-quoting in the examples. Abstraction implemented by
151
+ WLang::Encoder.
152
+
153
+ _ruleset_ : Reusable set of <em>tags</em> associated to <em>rule</em>s. Abstraction
154
+ implemented by WLang::RuleSet.
155
+
156
+ _wlang tag_ : Special tags in the template, starting with wlang symbols and a number of wlang
157
+ blocks. A tag is associated with a wlang rule. Examples: <tt>${...}</tt> is a
158
+ tag with only one block, while <tt>?{...}{...}{...}</tt> is another tag but with
159
+ three blocks.
160
+
161
+ _rule_ : Transformation semantics of a given <em>tag</em>. When wlang instantiates a
162
+ template it simply replaces <em>wlang tags</em> by some <em>replacement value</em>
163
+ (which is always a string). This value is computed by the rule attached to
164
+ the tag. Rule definition explicitly describes the number of blocks it expects, in which dialect they
165
+ are parsed and instantiated and the way the replacement value is computed.
166
+ Example: <tt>^{wlang/active-string}{...}</tt> (also known as 'encoding')
167
+ instantiates #1, looking for an encoder qualified name. Instantiates #2 in
168
+ the current dialect. Encode #2's instantiation using encoder found in (#1)
169
+
170
+ _context_ : Some rules allow code to be executed in the <em>hosting language</em> (the
171
+ definition explicitly announce it by putting <tt>wlang/hosted</tt> in the corresponding
172
+ block). When doing so, this code is in fact executed in a given context that
173
+ provides the execution semantics. Abstraction implemented in WLang::Parser::Context.
174
+
175
+ _hosting language_ : language (or framework) that executes wlang. In this case, it will be
176
+ <tt>ruby</tt>.
data/bin/wlang CHANGED
@@ -16,6 +16,7 @@ begin
16
16
  rescue ::WLang::Error => e
17
17
  $stderr.puts e.message
18
18
  $stderr.puts e.wlang_backtrace.join("\n\t")
19
+ $stderr.puts e.backtrace.join("\n\t")
19
20
  rescue Interrupt => e
20
21
  $stderr.puts
21
22
  $stderr.puts "Interrupted"
@@ -1,3 +1,3 @@
1
1
  *{WLang::dialect_tree.dialect('wlang').dialects using each_pair as name, dialect}{
2
- <<+{dialect.wtpl with dialect: dialect}
2
+ <<+{dialect.wtpl with dialect: dialect.build!}
3
3
  }
@@ -3,517 +3,539 @@
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
4
  <head>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
- <title>WLang (version 0.9.1)</title>
6
+ <title>WLang (version 0.10.0)</title>
7
7
  <style type="text/css">
8
8
  body {
9
- font-family: arial, verdana, sans-serif;
10
- font-size: 14px;
11
- width: 1024px;
12
- margin: auto;
13
- margin-top: 20px;
14
- }
15
- .clear { clear: both; }
16
- p { margin: 0px; margin-bottom: 10px; text-align: justify; }
17
- #title { float: left; margin: 10px 0px 20px 0px; }
18
- #tabs { float: right; margin: 15px 0px; }
19
- #tabs li { display: block; float: right; cursor: pointer; margin: 0px 0px 0px 5px; padding: 5px; border: 1px solid black; }
20
- #tabs li.focus { background-color: #A00000; color: white; }
21
- dl dt { margin-top: 10px; font-weight: bold; }
22
- div.header { border-bottom: 1px solid black; margin: 10px 0px; }
23
- h2 { float: left; margin: 0px; padding: 0px; }
24
- h3 { margin-top: 20px; margin-bottom: 10px; text-decoration: underline;}
25
- dl { padding-left: 35px; }
26
- ul { padding: 0px 0px 0px 25px; }
27
- ul li { margin: 5px;}
28
- ul.links { float: right; margin: 0px; padding: 0px; }
29
- ul.links li { cursor: pointer; margin: 0px 0px 0px 10px; padding: 0px; padding-top: 5px; display: block; float: right; }
30
- ul.links li a, ul.links li a:visited { color: black; text-decoration: none; }
31
- ul.links li a:hover { color: #A00000; }
32
- h3 { margin-bottom: 5px; }
33
- h4 { margin-bottom: 3px; float: left; margin-top: 0px; }
34
- table { border-collapse: collapse; border: 1px solid black; }
35
- table th { font-size: 12px; }
36
- table th, table td { padding: 4px; }
37
- table.glossary { margin-top: 20px; }
38
- table.glossary th { background: green; color: white; border-bottom: 1px solid black; }
39
- table.glossary th.term { width: 100px; }
40
- table.glossary td { border-bottom: 1px dashed black; }
41
- table.symbols { font-size: 12px; margin-top: 20px; width: 100%; }
42
- table.symbols th { background: green; color: white; border-bottom: 1px solid black; }
43
- table.symbols th.name { width: 150px; }
44
- table.symbols th.symbol { width: 50px; }
45
- table.symbols th.meaning { width: 250px; }
46
- table.symbols td { border-bottom: 1px dashed black; }
47
- table.ruleset { font-size: 12px; }
48
- table.ruleset th { background: green; color: white; }
49
- table.ruleset td { border-bottom: 1px dashed black; }
50
- th.signature, td.signature { width: 300px; }
51
- th.name, td.name { width: 120px; }
52
- th.definition, td.definition { width: 580px; }
53
- table.examples { float: right; font-size: 12px; }
54
- table.examples th { background: #A00000; color: white; border-bottom: 1px solid black; }
55
- table.examples th, table.examples td { padding: 4px; }
56
- table.examples td { border-bottom: 1px dashed black; }
57
- th.dialect, td.dialect { width: 150px; }
58
- th.expression, td.expression { width: 350px; }
59
- th.replacement, td.replacement { width: 350px; }
60
- div.dialect {padding-left: 20px;}
9
+ font-family: arial, verdana, sans-serif;
10
+ font-size: 14px;
11
+ width: 1024px;
12
+ margin: auto;
13
+ margin-top: 20px;
14
+ }
15
+ .clear { clear: both; }
16
+ p { margin: 0px; margin-bottom: 10px; text-align: justify; }
17
+ #title { float: left; margin: 10px 0px 20px 0px; }
18
+ #tabs { float: right; margin: 15px 0px; }
19
+ #tabs li { display: block; float: right; cursor: pointer; margin: 0px 0px 0px 5px; padding: 5px; border: 1px solid black; }
20
+ #tabs li.focus { background-color: #A00000; color: white; }
21
+ dl dt { margin-top: 10px; font-weight: bold; }
22
+ div.header { border-bottom: 1px solid black; margin: 10px 0px; }
23
+ h2 { float: left; margin: 0px; padding: 0px; }
24
+ h3 { margin-top: 20px; margin-bottom: 10px; text-decoration: underline;}
25
+ dl { padding-left: 35px; }
26
+ ul { padding: 0px 0px 0px 25px; }
27
+ ul li { margin: 5px;}
28
+ ul.links { float: right; margin: 0px; padding: 0px; }
29
+ ul.links li { cursor: pointer; margin: 0px 0px 0px 10px; padding: 0px; padding-top: 5px; display: block; float: right; }
30
+ ul.links li a, ul.links li a:visited { color: black; text-decoration: none; }
31
+ ul.links li a:hover { color: #A00000; }
32
+ h3 { margin-bottom: 5px; }
33
+ h4 { margin-bottom: 3px; float: left; margin-top: 0px; }
34
+ table { border-collapse: collapse; border: 1px solid black; }
35
+ table th { font-size: 12px; }
36
+ table th, table td { padding: 4px; }
37
+ table.glossary { margin-top: 20px; }
38
+ table.glossary th { background: green; color: white; border-bottom: 1px solid black; }
39
+ table.glossary th.term { width: 100px; }
40
+ table.glossary td { border-bottom: 1px dashed black; }
41
+ table.symbols { font-size: 12px; margin-top: 20px; width: 100%; }
42
+ table.symbols th { background: green; color: white; border-bottom: 1px solid black; }
43
+ table.symbols th.name { width: 150px; }
44
+ table.symbols th.symbol { width: 50px; }
45
+ table.symbols th.meaning { width: 250px; }
46
+ table.symbols td { border-bottom: 1px dashed black; }
47
+ table.ruleset { font-size: 12px; }
48
+ table.ruleset th { background: green; color: white; }
49
+ table.ruleset td { border-bottom: 1px dashed black; }
50
+ th.signature, td.signature { width: 300px; }
51
+ th.name, td.name { width: 120px; }
52
+ th.definition, td.definition { width: 580px; }
53
+ table.examples { float: right; font-size: 12px; }
54
+ table.examples th { background: #A00000; color: white; border-bottom: 1px solid black; }
55
+ table.examples th, table.examples td { padding: 4px; }
56
+ table.examples td { border-bottom: 1px dashed black; }
57
+ th.dialect, td.dialect { width: 150px; }
58
+ th.expression, td.expression { width: 350px; }
59
+ th.replacement, td.replacement { width: 350px; }
60
+ div.dialect {padding-left: 20px;}
61
61
  </style>
62
62
  <script type="text/javascript" language="JavaScript"><!--
63
63
  var current = 'about'
64
- function show(who) {
65
- document.getElementById(current).style.display = "none";
66
- document.getElementById(current + 'focus').className = "unfocus";
67
- document.getElementById(who).style.display = "block";
68
- document.getElementById(who + 'focus').className = "focus";
69
- current = who;
70
- }
64
+ function show(who) {
65
+ document.getElementById(current).style.display = "none";
66
+ document.getElementById(current + 'focus').className = "unfocus";
67
+ document.getElementById(who).style.display = "block";
68
+ document.getElementById(who + 'focus').className = "focus";
69
+ current = who;
70
+ }
71
71
 
72
72
  //--></script>
73
73
  </head>
74
74
  <body onload="show('about')">
75
- <h1 id="title">WLang (version 0.9.1)</h1>
75
+ <h1 id="title">WLang (version 0.10.0)</h1>
76
76
  <ul id="tabs">
77
- <li id="symbolsfocus" onclick="show('symbols')">Tag symbols</li>
78
- <li id="glossaryfocus" onclick="show('glossary')">Glossary</li>
79
- <li id="hostingfocus" onclick="show('hosting')">Hosting language</li>
80
- <li id="dialectsfocus" onclick="show('dialects')">Dialects</li>
81
- <li id="rulesetsfocus" onclick="show('rulesets')">Rulesets</li>
82
- <li id="overviewfocus" onclick="show('overview')">Overview</li>
83
- <li id="aboutfocus" onclick="show('about')">About</li>
84
-
77
+
78
+ <li id="symbolsfocus" onclick="show('symbols')">Tag symbols</li>
79
+
80
+ <li id="glossaryfocus" onclick="show('glossary')">Glossary</li>
81
+
82
+ <li id="hostingfocus" onclick="show('hosting')">Hosting language</li>
83
+
84
+ <li id="dialectsfocus" onclick="show('dialects')">Dialects</li>
85
+
86
+ <li id="rulesetsfocus" onclick="show('rulesets')">Rulesets</li>
87
+
88
+ <li id="overviewfocus" onclick="show('overview')">Overview</li>
89
+
90
+ <li id="aboutfocus" onclick="show('about')">About</li>
91
+
85
92
  </ul>
86
93
  <div class="clear"></div>
87
- <div id="about" style="display: none;">
88
- <div class="header">
89
- <h2>About</h2>
90
-
91
- <div class="clear"></div>
92
- </div>
93
- <p>
94
- WLang is a a reusable and extensible <em>code generator</em>, also known as
95
- a <em>templating engine</em>. Motivation for it can be found at <a
96
- href="http://www.revision-zero.org/wlang">www.revision-zero.org/wlang</a>.
97
- The current file is the reference of the tool.
98
- </p>
99
- <h3>Topics</h3>
100
- <dl>
101
- <dt>Short overview</dt><dd>Probably the first section to read! Basic usage of <em>wlang</em> is
102
- explained here and pointers are given to continue your learning.
103
-
104
- </dd>
105
- <dt>Rulesets</dt><dd>Standard rulesets are specified. As most of them are included in standard
106
- dialects, looking at standard rulesets is the quickest way to learn all of
107
- them at once.
108
-
109
- </dd>
110
- <dt>Dialects</dt><dd>Standard dialects are described. This page also provides useful cheatsheets
111
- of available tags in standard dialects.
112
-
113
- </dd>
114
- <dt>Hosting language</dt><dd>Somewhat more tricky but powerful. The notion of hosting language is
115
- explained more deeply. Implementing you own hosting language abstraction
116
- (advanced topic) sometimes leads to cleaner and cross-implementation
117
- templates.
118
-
119
- </dd>
120
- <dt>Glossary</dt><dd><em>wlang</em> comes with a terminology, knowing it will make your reading
121
- easier.
122
-
123
- </dd>
124
- <dt>Symbols</dt><dd>If you plan to create your own tags, it can be useful to know what is
125
- allowed and what is not. This pages covers this topic.
126
-
127
- </dd>
128
- </dl>
129
- <h3>About this document</h3>
130
- <p>
131
- This document is a simple .html file without external dependencies
132
- (embedded CSS and javascript). As it contains several cheatsheets, you can
133
- simply save it on your harddisk without having to be online to browse the
134
- documentation. It has been generated using <em>wlang</em> itself using the
135
- following command:
136
- </p>
137
- <pre>
138
- wlang specification.wtpl
139
- </pre>
140
- <p>
141
- The file &#8216;specification.wtpl&#8217; is almost empty and other files
142
- next to it are all kept simple and written in the most appropriate format
143
- for the task at hand (YAML for structured parts, RDoc for text sections,
144
- sometimes YAML embedding short sentences writted in RDoc style, etc.). One
145
- way to learn <em>wlang</em> quickly is to download the source distribution
146
- and to look how this is made possible ;-)
147
- </p>
148
- <p>
149
- This reference document is under a <a
150
- href="http://creativecommons.org/licenses/by/2.0/be/">Creative Commons
151
- Licence 2.0</a> contract. You can use it, redistribute it and modify it
152
- providing that you keep a reference to the original licensor (namely, the
153
- &#8216;University of Louvain&#8217; or &#8216;Bernard and Louis
154
- Lambeau&#8217;).
155
- </p>
156
- <p>
157
- Enjoy <em>wlang</em> !
158
- </p>
159
- <h3>Distribution</h3>
160
- <ul>
161
- <li>The reference implementation of <em>wlang</em>, implemented in Ruby, is
162
- freely available as a &#8216;wlang&#8217; gem (under MIT licence). <br/>
163
- Use <tt>'gem install wlang'</tt> to install it. For repository and bug
164
- tracker visit us on <a href="http://github.com/blambeau/wlang">github</a>
165
-
166
- </li>
167
- <li>We don&#8217;t have another implementation up to now. If you plan to start
168
- one in another language, let us know!
169
94
 
170
- </li>
171
- </ul>
172
- <h3>Authors</h3>
173
- <p>
174
- <em>wlang</em> has been initially designed by Bernard and Louis Lambeau
175
- during the implementation of w@w, yet another web framework (proof of
176
- concept). They are also maintainers of the reference implementation.
177
- </p>
178
- <h3>Credits</h3>
179
- <p>
180
- This work is supported by the <a
181
- href="http://www.uclouvain.be/en-ingi.html">department of computer
182
- science</a> of the <a
183
- href="http://www.uclouvain.be/en-index.html">University of Louvain</a>
184
- (EPL/INGI, Universite Catholique de Louvain, UCL, Louvain-la-Neuve,
185
- Belgium).
186
- </p>
187
- <p>
188
- This work was also partially supported by the Regional Government of
189
- Wallonia (ReQuest project, RW Conv. 315592 and GISELE project, RW Conv.
190
- 616425) and the MoVES project (PAI program of the Belgian government).
191
- </p>
192
-
193
-
194
- </div>
195
- <div id="overview" style="display: none;">
196
- <div class="header">
197
- <h2>Overview</h2>
198
-
199
- <div class="clear"></div>
200
- </div>
201
- <h3>What is <em>wlang</em> designed for?</h3>
202
- <p>
203
- <em>wlang</em> helps you <b>generating code</b>, in a broad sense. It was
204
- originally the templating engine of w@w, a proof-of-concept web framework.
205
- While more powerful than the original version, the <b>templating engine</b>
206
- ability of <em>wlang</em> has been kept unchanged. For this reason,
207
- generating html code with <em>wlang</em> is probably a bit more mature than
208
- generating ruby, java or sql code, to take some examples of what
209
- <em>wlang</em> can do. It is the author opinion that <em>wlang</em> will
210
- also become mature quiclky for these tasks because of its foundations:
211
- <b>its engine is generic</b> (in a sense, <em>wlang</em> does not really
212
- care about what it generates) but is <b>fully and easily configurable</b>.
213
- Generation of html files is mature because <em>wlang</em> has been used a
214
- lot for such a job; thus its authors have acquired experience of what is
215
- useful when generating simple as well as complex html files. This
216
- experience led us to a mature configuration of the <em>wlang</em> engine
217
- for generating html files, as the following paragraph illustrates (for
218
- people interested in generating code in other languages than html,
219
- don&#8217;t stop your reading here: the paragraph immediately following
220
- contains information for you!)
221
- </p>
222
- <p>
223
- Consider this file for example, which is completely self-contained. It
224
- consists of several parts, some of them being structured - the tables for
225
- example - while others are not. It also embeds a complete CSS stylesheet
226
- and some javascript functions. We have not written this file manually, nor
227
- do we maintain it this way. In fact, this reference document is entirely
228
- generated by <em>wlang</em> itself from separated parts written mainly in
229
- yaml and rdoc files. Also, the cheatsheets given later contains a lot of
230
- examples. To ensure that all of them are correct, we simply ask
231
- <em>wlang</em> to compute them during generation (technically, we say that
232
- <b><em>wlang</em> naturally allows metaprogramming</b>). Lastly, if
233
- <em>wlang</em> can be used inside a web framework, it can also be used as a
234
- standalone (commandline) tool for generating single files like this one or
235
- multiple files, even if all of them are of different nature.
236
- </p>
237
- <p>
238
- <b>Maybe you are looking for a code generator for another language than
239
- html</b> (which one does not really care, unless really specific; we call
240
- it the <em>target language</em>)? Don&#8217;t be affraid by our previous
241
- words about <em>wlang</em>&#8217;s maturity: even in such a case,
242
- <em>wlang</em> is your friend. Start with an existing dialect (see later
243
- about dialects), which will provide basic utilities for starting and try to
244
- identify common patterns when you use them. Then simply create special
245
- shortcuts that are more friendly to use than combining several existing
246
- utils &#8230; you are on the way of creating your own mature and reusable
247
- dialect for that target language. In this case, don&#8217;t forget to share
248
- it &#8230;
249
- </p>
250
- <h3>Template and instantiation</h3>
251
- <p>
252
- The <em>wlang</em> grammar used to write a <em>template</em> is generic and
253
- simple: every character stands for itself (meaning that it is reproduced
254
- exactly when the template is instantiated) except <em>tags</em> (and their
255
- associated <em>blocks</em>, enclosed between &#8217;{&#8217; and
256
- &#8217;}&#8217;) that are replaced by what is called the <em>replacement
257
- value</em>. Consider the following example:
258
- </p>
259
- <pre>
260
- &lt;html&gt;
261
- &lt;head&gt;
262
- &lt;title&gt;${title}&lt;/title&gt;
263
- &lt;/head&gt;
264
- &lt;body&gt;
265
- &lt;h1&gt;Hello *{authors as who}{${who}}{, } !&lt;/h1&gt;
266
- &lt;/body&gt;
267
- &lt;/html&gt;
268
- </pre>
269
- <p>
270
- Assume that we have some instantitation data through the following hash (or
271
- something similar, like a YAML file):
272
- </p>
273
- <pre>
274
- {&quot;title&quot; =&gt; &quot;Short overview of wlang&quot;, &quot;authors&quot; =&gt; [&quot;blambeau&quot;, &quot;llambeau&quot;, &quot;ancailliau&quot;]}
275
- </pre>
276
- <p>
277
- When instantiated this template will produce exactly the same html file
278
- except for special tags <tt>${title}</tt> and <tt>*{whos as who}{${who}}{,
279
- }</tt> that will be replaced by <tt>'Short overview of wlang'</tt> and
280
- <tt>'blambeau, llambeau, ancailliau'</tt>, respectively. A lot of tags is
281
- available, each of them being designed for a specific task: inserting the
282
- value of a variable, iterating over collections, including another file,
283
- dynamically loading instantiation data, etc. All of these things are
284
- commonly proposed by templating engines and <em>wlang</em> is one of them
285
- &#8230; However, <em>wlang</em> is a bit different as will quickly appear.
286
- </p>
287
- <p>
288
- Indeed (and maybe surprisingly) <em>wlang</em> can also behave really
289
- differently on the same template: replacing <tt>${title}</tt> but not
290
- <tt>*{...}</tt> or the converse, or not replacing anything, or replacing
291
- both tags but not <tt>${who}</tt>, etc. All of this is possible in
292
- <em>wlang</em>. The magic relies under the notion of <em>dialect</em>,
293
- which you need to understand.
294
- </p>
295
- <h3>Dialects and Rulesets</h3>
296
- <p>
297
- The notion of dialect drives the recognition of tags as well as their
298
- replacement during instantiation. Dialects are what makes <em>wlang</em>
299
- really powerful: if instantiated as being written in the
300
- <tt>wlang/xhtml</tt> dialect, the template above will give the result
301
- mentionned previously. In contrast, if written in <tt>wlang/dummy</tt> the
302
- template will be reproduced whitout any change (no tag replacement at all).
303
- This behavior is not hardcoded; it results from the definition of wlang
304
- (standard) dialects: <tt>wlang/xhtml</tt> define special meanings for
305
- <tt>${...}</tt> and <tt>*{...}{...}{...}</tt> while <tt>wlang/dummy</tt>
306
- does not.
307
- </p>
308
- <p>
309
- The replacement of a given <em>tag</em> during instantiation is computed by
310
- what we call the <em>rule</em> attached to the tag (keeping rules and tags
311
- as different concepts leads to another feature of <em>wlang</em>: you can
312
- reuse rule implementations and attach them to other tags than those
313
- proposed). A dialect comes with a set of (tag, rule) pairs that determine
314
- its replacement behavior. Such a set is called a <em>ruleset</em>; for
315
- easier reuse, standard rulesets are already implemented. A dialect is a
316
- packaging of standard rulesets (and maybe implements specific tag/rule
317
- pairs) designed for generating code in a given target language.
318
- </p>
319
- <p>
320
- A complete <em>wlang</em> implementation already provides standard dialects
321
- for common tasks: creating html pages, building SQL queries, generating
322
- code in Ruby or in another language, etc. Each dialect comes with special
323
- tags that are useful for the task at hand (a tag for back-quoting values is
324
- useful for creating SQL queries but does not really makes sense for
325
- generating an html page where, in contrast, a tag for encoding entities is
326
- probably welcome). Such an implementation also allows you to extend
327
- standard dialects and to create your own dialect by implementing specific
328
- tags and rules or by reusing existing ones. Lastlty, the dialect in used
329
- during instantiation can be changed dynamically (<em>explicitly</em>, by
330
- using the <tt>%{dialect/qualified/name}{...}</tt> standard tag and
331
- <em>implicitly</em>, when rules parse their blocks).
332
- </p>
333
- <p>
334
- To learn more about standard dialects and reusable rules, read the
335
- &#8216;Dialects&#8217; and &#8216;Rulesets&#8217; pages of this
336
- documentation.
337
- </p>
338
- <h3>Grammar</h3>
339
- <p>
340
- The (abstract) <em>wlang</em> grammar rules what forms a valid template. At
341
- first glance, this grammar does not depend on the dialect that is used for
342
- instantiation. It is simple, but comes with some constraints that are
343
- explained below:
344
- </p>
345
- <ul>
346
- <li>block delimiters are &#8217;{&#8217; and &#8217;}&#8217; by default;
347
- <em>wlang</em> can be configured to use &#8217;(&#8217; and &#8217;)&#8217;
348
- or &#8217;[&#8217; and &#8217;]&#8217; instead. However, block
349
- <b>delimiters are template-specific</b>: only one kind of delimiters can be
350
- used inside the same template.
351
-
352
- </li>
353
- <li>block delimiters <b>must always be paired</b>, even when not used for
354
- delimiting blocks. If an opening or closing delimiter is not paired, it
355
- must be escaped with a backslash, which will not be reproduced. If you want
356
- a backslash to appear before a block delimiter in the instantiation result,
357
- use a double backslash.
358
-
359
- </li>
360
- <li>if a given tag has a special meaning in the current dialect and you
361
- don&#8217;t want it to be replaced by <em>wlang</em> you can escape it with
362
- a backslash as well (the backslash will not be reproduced).
363
-
364
- </li>
365
- <li>some tags (precisely: some rules associated with tags) require multiple
366
- blocks (like <tt>*{...}{...}{...}</tt> in <tt>wlang/xhtml</tt> for example,
367
- with the third block bein optional). In such a case no character is allowed
368
- between the end of a block &#8217;}&#8217; and the start of the next one
369
- &#8217;{&#8217;, not even spaces or a carriage return. In other words,
370
- multiple blocks (that must be interpreted as such) must touch each others
371
- using &#8217;}{&#8217; precisely, as ilustrated below. If a non-optional
372
- block is missing a parse error is raised by the <em>wlang</em>
373
- implementation.
374
-
375
- <pre>
376
- *{authors as who}{${who}}{, } -&gt; blambeau, llambeau, ancailliau
377
- *{authors as who}{${who}} {, } -&gt; blambeaullambeauancailliau {, }
378
- *{authors as who} {${who}}{, } -&gt; parse error 1:18, missing block 2 in *{...}{...}
379
- </pre>
380
- </li>
381
- </ul>
382
- <p>
383
- In addition to these constraints, dialects and the hosting language may
384
- impose restrictions on what can be put inside specific blocks of tags/rules
385
- (for example, &#8216;authors as who&#8217; is valid as first tag of
386
- <tt>*{...}{...}</tt> but not every string is, of course). These constraints
387
- are not specific to the wlang grammar <em>per se</em> and are explained in
388
- the &#8216;Rulesets&#8217;, &#8216;Dialects&#8217; and &#8216;Hosting
389
- language&#8217; pages of this document.
390
- </p>
391
-
392
-
393
- </div>
394
- <div id="rulesets" style="display: none;">
395
- <div class="header">
396
- <h2>Rulesets</h2>
397
- <ul class="links">
398
- <li><a href="#Buffering">Buffering</a></li><li><a href="#Context">Context</a></li><li><a href="#Imperative">Imperative</a></li><li><a href="#Encoding">Encoding</a></li><li><a href="#Basic">Basic</a></li>
399
- </ul>
400
-
401
- <div class="clear"></div>
402
- </div>
403
- <p>
404
- Standard ruleset are designed to be reusable: including them in your own
405
- dialect is made easy by a typical <em>wlang</em> implementation. Some of
406
- them are also included by standard dialects.
407
- </p>
408
- <h3>How to read this cheatsheet?</h3>
409
- <p>
410
- First of all, focus on the examples; they are written to let you learn
411
- <em>wlang</em> quickly and deeply. Some of them are a bit difficult to
412
- understand but they are representative of <em>wlang</em> powerfulness
413
- (don&#8217;t be affraid: in practice, some constructions are never used).
414
- Don&#8217;t forget that the <tt>wlang/dummy</tt> dialect does not recognize
415
- any tag. We also assume instantiation data to be the following hash:
416
- </p>
417
- <pre>
418
- {&quot;name&quot; =&gt; &quot;O'Neil&quot;,
419
- &quot;author&quot; =&gt; &quot;blambeau&quot;
420
- &quot;authors&quot; =&gt; [&quot;blambeau&quot;, &quot;llambeau&quot;, &quot;ancailliau&quot;]}
421
- </pre>
422
- <p>
423
- Moreover, the dialect column in the examples is important; <em>wlang</em>
424
- behaves differently in different dialects. When the dialect does not care,
425
- we use <tt>wlang/*</tt> which means &#8216;in any dialect that includes
426
- this ruleset&#8217;.
427
- </p>
428
- <p>
429
- Next, certain rule definitions are given as shortcuts for longer
430
- expressions, involving other tags. This is somewhat representative of
431
- <em>wlang</em> usage, even if these rules are not actually implemented this
432
- way (mainly for efficiency concerns). Once again, understanding shortcuts
433
- will help you mastering wlang! In definitions (textual as well as
434
- shortcuts), we use #1, #2, and #3 to refer to the content of the blocks.
435
- Those identifiers are not real <em>wlang</em> constructs, but are only used
436
- here for easier explanations (for those who know this kind of vocabulary:
437
- they are part of the meta-language, not the language <em>per se</em>).
438
- </p>
439
- <p>
440
- Lastly, dialect names that appear in rule signatures are to be interpreted
441
- as an implicit dialect modulation: the corresponding block (often the first
442
- one) is not instantiated in the current dialect but in the one specified by
443
- the signature. In contrast, when we use &#8217;&#8230;&#8217; it means that
444
- the corresponding block is simply instantiated in the current dialect.
445
- Implicit dialect modulation is in fact natural: if a block expects an uri
446
- for example, the easiest way is to give it exactly:
447
- <tt>&lt;&lt;{a/file/to/include.txt}</tt>. But you can even compute it using
448
- <em>wlang</em>, as illustrated by the example below. In complex situations
449
- you will probably be happy to use a dialect that helps you doing so (think
450
- at all blocks that expect an expression in the hosting language, for
451
- example)!
452
- </p>
453
- <pre>
454
- # Concatenates all files of the 'files' array variable
455
- *{files as f}{&lt;&lt;{+{f}}}
456
- </pre>
95
+ <div id="about" style="display: none;">
96
+ <div class="header">
97
+ <h2>About</h2>
98
+
99
+ <div class="clear"></div>
100
+ </div>
101
+
102
+ <p>
103
+ WLang is a a reusable and extensible <em>code generator</em>, also known as
104
+ a <em>templating engine</em>. Motivation for it can be found at <a
105
+ href="http://www.revision-zero.org/wlang">www.revision-zero.org/wlang</a>.
106
+ The current file is the reference of the tool.
107
+ </p>
108
+ <h3>Topics</h3>
109
+ <dl>
110
+ <dt>Short overview</dt><dd>Probably the first section to read! Basic usage of <em>wlang</em> is
111
+ explained here and pointers are given to continue your learning.
112
+
113
+ </dd>
114
+ <dt>Rulesets</dt><dd>Standard rulesets are specified. As most of them are included in standard
115
+ dialects, looking at standard rulesets is the quickest way to learn all of
116
+ them at once.
117
+
118
+ </dd>
119
+ <dt>Dialects</dt><dd>Standard dialects are described. This page also provides useful cheatsheets
120
+ of available tags in standard dialects.
121
+
122
+ </dd>
123
+ <dt>Hosting language</dt><dd>Somewhat more tricky but powerful. The notion of hosting language is
124
+ explained more deeply. Implementing you own hosting language abstraction
125
+ (advanced topic) sometimes leads to cleaner and cross-implementation
126
+ templates.
127
+
128
+ </dd>
129
+ <dt>Glossary</dt><dd><em>wlang</em> comes with a terminology, knowing it will make your reading
130
+ easier.
131
+
132
+ </dd>
133
+ <dt>Symbols</dt><dd>If you plan to create your own tags, it can be useful to know what is
134
+ allowed and what is not. This pages covers this topic.
135
+
136
+ </dd>
137
+ </dl>
138
+ <h3>About this document</h3>
139
+ <p>
140
+ This document is a simple .html file without external dependencies
141
+ (embedded CSS and javascript). As it contains several cheatsheets, you can
142
+ simply save it on your harddisk without having to be online to browse the
143
+ documentation. It has been generated using <em>wlang</em> itself using the
144
+ following command:
145
+ </p>
146
+ <pre>
147
+ wlang specification.wtpl
148
+ </pre>
149
+ <p>
150
+ The file &#8216;specification.wtpl&#8217; is almost empty and other files
151
+ next to it are all kept simple and written in the most appropriate format
152
+ for the task at hand (YAML for structured parts, RDoc for text sections,
153
+ sometimes YAML embedding short sentences writted in RDoc style, etc.). One
154
+ way to learn <em>wlang</em> quickly is to download the source distribution
155
+ and to look how this is made possible ;-)
156
+ </p>
157
+ <p>
158
+ This reference document is under a <a
159
+ href="http://creativecommons.org/licenses/by/2.0/be/">Creative Commons
160
+ Licence 2.0</a> contract. You can use it, redistribute it and modify it
161
+ providing that you keep a reference to the original licensor (namely, the
162
+ &#8216;University of Louvain&#8217; or &#8216;Bernard and Louis
163
+ Lambeau&#8217;).
164
+ </p>
165
+ <p>
166
+ Enjoy <em>wlang</em> !
167
+ </p>
168
+ <h3>Distribution</h3>
169
+ <ul>
170
+ <li>The reference implementation of <em>wlang</em>, implemented in Ruby, is
171
+ freely available as a &#8216;wlang&#8217; gem (under MIT licence). <br/>
172
+ Use <tt>'gem install wlang'</tt> to install it. For repository and bug
173
+ tracker visit us on <a href="http://github.com/blambeau/wlang">github</a>
174
+
175
+ </li>
176
+ <li>We don&#8217;t have another implementation up to now. If you plan to start
177
+ one in another language, let us know!
178
+
179
+ </li>
180
+ </ul>
181
+ <h3>Authors</h3>
182
+ <p>
183
+ <em>wlang</em> has been initially designed by Bernard and Louis Lambeau
184
+ during the implementation of w@w, yet another web framework (proof of
185
+ concept). They are also maintainers of the reference implementation.
186
+ </p>
187
+ <h3>Credits</h3>
188
+ <p>
189
+ This work is supported by the <a
190
+ href="http://www.uclouvain.be/en-ingi.html">department of computer
191
+ science</a> of the <a
192
+ href="http://www.uclouvain.be/en-index.html">University of Louvain</a>
193
+ (EPL/INGI, Universite Catholique de Louvain, UCL, Louvain-la-Neuve,
194
+ Belgium).
195
+ </p>
196
+ <p>
197
+ This work was also partially supported by the Regional Government of
198
+ Wallonia (ReQuest project, RW Conv. 315592 and GISELE project, RW Conv.
199
+ 616425) and the MoVES project (PAI program of the Belgian government).
200
+ </p>
201
+
202
+
203
+ </div>
457
204
 
205
+ <div id="overview" style="display: none;">
206
+ <div class="header">
207
+ <h2>Overview</h2>
208
+
209
+ <div class="clear"></div>
210
+ </div>
211
+
212
+ <h3>What is <em>wlang</em> designed for?</h3>
213
+ <p>
214
+ <em>wlang</em> helps you <b>generating code</b>, in a broad sense. It was
215
+ originally the templating engine of w@w, a proof-of-concept web framework.
216
+ While more powerful than the original version, the <b>templating engine</b>
217
+ ability of <em>wlang</em> has been kept unchanged. For this reason,
218
+ generating html code with <em>wlang</em> is probably a bit more mature than
219
+ generating ruby, java or sql code, to take some examples of what
220
+ <em>wlang</em> can do. It is the author opinion that <em>wlang</em> will
221
+ also become mature quiclky for these tasks because of its foundations:
222
+ <b>its engine is generic</b> (in a sense, <em>wlang</em> does not really
223
+ care about what it generates) but is <b>fully and easily configurable</b>.
224
+ Generation of html files is mature because <em>wlang</em> has been used a
225
+ lot for such a job; thus its authors have acquired experience of what is
226
+ useful when generating simple as well as complex html files. This
227
+ experience led us to a mature configuration of the <em>wlang</em> engine
228
+ for generating html files, as the following paragraph illustrates (for
229
+ people interested in generating code in other languages than html,
230
+ don&#8217;t stop your reading here: the paragraph immediately following
231
+ contains information for you!)
232
+ </p>
233
+ <p>
234
+ Consider this file for example, which is completely self-contained. It
235
+ consists of several parts, some of them being structured - the tables for
236
+ example - while others are not. It also embeds a complete CSS stylesheet
237
+ and some javascript functions. We have not written this file manually, nor
238
+ do we maintain it this way. In fact, this reference document is entirely
239
+ generated by <em>wlang</em> itself from separated parts written mainly in
240
+ yaml and rdoc files. Also, the cheatsheets given later contains a lot of
241
+ examples. To ensure that all of them are correct, we simply ask
242
+ <em>wlang</em> to compute them during generation (technically, we say that
243
+ <b><em>wlang</em> naturally allows metaprogramming</b>). Lastly, if
244
+ <em>wlang</em> can be used inside a web framework, it can also be used as a
245
+ standalone (commandline) tool for generating single files like this one or
246
+ multiple files, even if all of them are of different nature.
247
+ </p>
248
+ <p>
249
+ <b>Maybe you are looking for a code generator for another language than
250
+ html</b> (which one does not really care, unless really specific; we call
251
+ it the <em>target language</em>)? Don&#8217;t be affraid by our previous
252
+ words about <em>wlang</em>&#8217;s maturity: even in such a case,
253
+ <em>wlang</em> is your friend. Start with an existing dialect (see later
254
+ about dialects), which will provide basic utilities for starting and try to
255
+ identify common patterns when you use them. Then simply create special
256
+ shortcuts that are more friendly to use than combining several existing
257
+ utils &#8230; you are on the way of creating your own mature and reusable
258
+ dialect for that target language. In this case, don&#8217;t forget to share
259
+ it &#8230;
260
+ </p>
261
+ <h3>Template and instantiation</h3>
262
+ <p>
263
+ The <em>wlang</em> grammar used to write a <em>template</em> is generic and
264
+ simple: every character stands for itself (meaning that it is reproduced
265
+ exactly when the template is instantiated) except <em>tags</em> (and their
266
+ associated <em>blocks</em>, enclosed between &#8217;{&#8217; and
267
+ &#8217;}&#8217;) that are replaced by what is called the <em>replacement
268
+ value</em>. Consider the following example:
269
+ </p>
270
+ <pre>
271
+ &lt;html&gt;
272
+ &lt;head&gt;
273
+ &lt;title&gt;${title}&lt;/title&gt;
274
+ &lt;/head&gt;
275
+ &lt;body&gt;
276
+ &lt;h1&gt;Hello *{authors as who}{${who}}{, } !&lt;/h1&gt;
277
+ &lt;/body&gt;
278
+ &lt;/html&gt;
279
+ </pre>
280
+ <p>
281
+ Assume that we have some instantitation data through the following hash (or
282
+ something similar, like a YAML file):
283
+ </p>
284
+ <pre>
285
+ {&quot;title&quot; =&gt; &quot;Short overview of wlang&quot;, &quot;authors&quot; =&gt; [&quot;blambeau&quot;, &quot;llambeau&quot;, &quot;ancailliau&quot;]}
286
+ </pre>
287
+ <p>
288
+ When instantiated this template will produce exactly the same html file
289
+ except for special tags <tt>${title}</tt> and <tt>*{whos as who}{${who}}{,
290
+ }</tt> that will be replaced by <tt>'Short overview of wlang'</tt> and
291
+ <tt>'blambeau, llambeau, ancailliau'</tt>, respectively. A lot of tags is
292
+ available, each of them being designed for a specific task: inserting the
293
+ value of a variable, iterating over collections, including another file,
294
+ dynamically loading instantiation data, etc. All of these things are
295
+ commonly proposed by templating engines and <em>wlang</em> is one of them
296
+ &#8230; However, <em>wlang</em> is a bit different as will quickly appear.
297
+ </p>
298
+ <p>
299
+ Indeed (and maybe surprisingly) <em>wlang</em> can also behave really
300
+ differently on the same template: replacing <tt>${title}</tt> but not
301
+ <tt>*{...}</tt> or the converse, or not replacing anything, or replacing
302
+ both tags but not <tt>${who}</tt>, etc. All of this is possible in
303
+ <em>wlang</em>. The magic relies under the notion of <em>dialect</em>,
304
+ which you need to understand.
305
+ </p>
306
+ <h3>Dialects and Rulesets</h3>
307
+ <p>
308
+ The notion of dialect drives the recognition of tags as well as their
309
+ replacement during instantiation. Dialects are what makes <em>wlang</em>
310
+ really powerful: if instantiated as being written in the
311
+ <tt>wlang/xhtml</tt> dialect, the template above will give the result
312
+ mentionned previously. In contrast, if written in <tt>wlang/dummy</tt> the
313
+ template will be reproduced whitout any change (no tag replacement at all).
314
+ This behavior is not hardcoded; it results from the definition of wlang
315
+ (standard) dialects: <tt>wlang/xhtml</tt> define special meanings for
316
+ <tt>${...}</tt> and <tt>*{...}{...}{...}</tt> while <tt>wlang/dummy</tt>
317
+ does not.
318
+ </p>
319
+ <p>
320
+ The replacement of a given <em>tag</em> during instantiation is computed by
321
+ what we call the <em>rule</em> attached to the tag (keeping rules and tags
322
+ as different concepts leads to another feature of <em>wlang</em>: you can
323
+ reuse rule implementations and attach them to other tags than those
324
+ proposed). A dialect comes with a set of (tag, rule) pairs that determine
325
+ its replacement behavior. Such a set is called a <em>ruleset</em>; for
326
+ easier reuse, standard rulesets are already implemented. A dialect is a
327
+ packaging of standard rulesets (and maybe implements specific tag/rule
328
+ pairs) designed for generating code in a given target language.
329
+ </p>
330
+ <p>
331
+ A complete <em>wlang</em> implementation already provides standard dialects
332
+ for common tasks: creating html pages, building SQL queries, generating
333
+ code in Ruby or in another language, etc. Each dialect comes with special
334
+ tags that are useful for the task at hand (a tag for back-quoting values is
335
+ useful for creating SQL queries but does not really makes sense for
336
+ generating an html page where, in contrast, a tag for encoding entities is
337
+ probably welcome). Such an implementation also allows you to extend
338
+ standard dialects and to create your own dialect by implementing specific
339
+ tags and rules or by reusing existing ones. Lastlty, the dialect in used
340
+ during instantiation can be changed dynamically (<em>explicitly</em>, by
341
+ using the <tt>%{dialect/qualified/name}{...}</tt> standard tag and
342
+ <em>implicitly</em>, when rules parse their blocks).
343
+ </p>
344
+ <p>
345
+ To learn more about standard dialects and reusable rules, read the
346
+ &#8216;Dialects&#8217; and &#8216;Rulesets&#8217; pages of this
347
+ documentation.
348
+ </p>
349
+ <h3>Grammar</h3>
350
+ <p>
351
+ The (abstract) <em>wlang</em> grammar rules what forms a valid template. At
352
+ first glance, this grammar does not depend on the dialect that is used for
353
+ instantiation. It is simple, but comes with some constraints that are
354
+ explained below:
355
+ </p>
356
+ <ul>
357
+ <li>block delimiters are &#8217;{&#8217; and &#8217;}&#8217; by default;
358
+ <em>wlang</em> can be configured to use &#8217;(&#8217; and &#8217;)&#8217;
359
+ or &#8217;[&#8217; and &#8217;]&#8217; instead. However, block
360
+ <b>delimiters are template-specific</b>: only one kind of delimiters can be
361
+ used inside the same template.
362
+
363
+ </li>
364
+ <li>block delimiters <b>must always be paired</b>, even when not used for
365
+ delimiting blocks. If an opening or closing delimiter is not paired, it
366
+ must be escaped with a backslash, which will not be reproduced. If you want
367
+ a backslash to appear before a block delimiter in the instantiation result,
368
+ use a double backslash.
369
+
370
+ </li>
371
+ <li>if a given tag has a special meaning in the current dialect and you
372
+ don&#8217;t want it to be replaced by <em>wlang</em> you can escape it with
373
+ a backslash as well (the backslash will not be reproduced).
374
+
375
+ </li>
376
+ <li>some tags (precisely: some rules associated with tags) require multiple
377
+ blocks (like <tt>*{...}{...}{...}</tt> in <tt>wlang/xhtml</tt> for example,
378
+ with the third block bein optional). In such a case no character is allowed
379
+ between the end of a block &#8217;}&#8217; and the start of the next one
380
+ &#8217;{&#8217;, not even spaces or a carriage return. In other words,
381
+ multiple blocks (that must be interpreted as such) must touch each others
382
+ using &#8217;}{&#8217; precisely, as ilustrated below. If a non-optional
383
+ block is missing a parse error is raised by the <em>wlang</em>
384
+ implementation.
385
+
386
+ <pre>
387
+ *{authors as who}{${who}}{, } -&gt; blambeau, llambeau, ancailliau
388
+ *{authors as who}{${who}} {, } -&gt; blambeaullambeauancailliau {, }
389
+ *{authors as who} {${who}}{, } -&gt; parse error 1:18, missing block 2 in *{...}{...}
390
+ </pre>
391
+ </li>
392
+ </ul>
393
+ <p>
394
+ In addition to these constraints, dialects and the hosting language may
395
+ impose restrictions on what can be put inside specific blocks of tags/rules
396
+ (for example, &#8216;authors as who&#8217; is valid as first tag of
397
+ <tt>*{...}{...}</tt> but not every string is, of course). These constraints
398
+ are not specific to the wlang grammar <em>per se</em> and are explained in
399
+ the &#8216;Rulesets&#8217;, &#8216;Dialects&#8217; and &#8216;Hosting
400
+ language&#8217; pages of this document.
401
+ </p>
402
+
403
+
404
+ </div>
458
405
 
459
- <h3 id="Basic">Basic</h3>
460
- <p>
461
- The Basic ruleset is commonly installed on any dialect and provides access
462
- to <em>wlang</em> foundations inside your template: requesting the hosting
463
- language to execute some expression, changing the current dialect and
464
- encoding text.
465
- </p>
406
+ <div id="rulesets" style="display: none;">
407
+ <div class="header">
408
+ <h2>Rulesets</h2>
409
+
410
+ <ul class="links">
411
+ <li><a href="#Buffering">Buffering</a></li><li><a href="#Context">Context</a></li><li><a href="#Imperative">Imperative</a></li><li><a href="#Encoding">Encoding</a></li><li><a href="#Basic">Basic</a></li>
412
+ </ul>
413
+
414
+ <div class="clear"></div>
415
+ </div>
416
+
417
+ <p>
418
+ Standard ruleset are designed to be reusable: including them in your own
419
+ dialect is made easy by a typical <em>wlang</em> implementation. Some of
420
+ them are also included by standard dialects.
421
+ </p>
422
+ <h3>How to read this cheatsheet?</h3>
423
+ <p>
424
+ First of all, focus on the examples; they are written to let you learn
425
+ <em>wlang</em> quickly and deeply. Some of them are a bit difficult to
426
+ understand but they are representative of <em>wlang</em> powerfulness
427
+ (don&#8217;t be affraid: in practice, some constructions are never used).
428
+ Don&#8217;t forget that the <tt>wlang/dummy</tt> dialect does not recognize
429
+ any tag. We also assume instantiation data to be the following hash:
430
+ </p>
431
+ <pre>
432
+ {&quot;name&quot; =&gt; &quot;O'Neil&quot;,
433
+ &quot;author&quot; =&gt; &quot;blambeau&quot;
434
+ &quot;authors&quot; =&gt; [&quot;blambeau&quot;, &quot;llambeau&quot;, &quot;ancailliau&quot;]}
435
+ </pre>
436
+ <p>
437
+ Moreover, the dialect column in the examples is important; <em>wlang</em>
438
+ behaves differently in different dialects. When the dialect does not care,
439
+ we use <tt>wlang/*</tt> which means &#8216;in any dialect that includes
440
+ this ruleset&#8217;.
441
+ </p>
442
+ <p>
443
+ Next, certain rule definitions are given as shortcuts for longer
444
+ expressions, involving other tags. This is somewhat representative of
445
+ <em>wlang</em> usage, even if these rules are not actually implemented this
446
+ way (mainly for efficiency concerns). Once again, understanding shortcuts
447
+ will help you mastering wlang! In definitions (textual as well as
448
+ shortcuts), we use #1, #2, and #3 to refer to the content of the blocks.
449
+ Those identifiers are not real <em>wlang</em> constructs, but are only used
450
+ here for easier explanations (for those who know this kind of vocabulary:
451
+ they are part of the meta-language, not the language <em>per se</em>).
452
+ </p>
453
+ <p>
454
+ Lastly, dialect names that appear in rule signatures are to be interpreted
455
+ as an implicit dialect modulation: the corresponding block (often the first
456
+ one) is not instantiated in the current dialect but in the one specified by
457
+ the signature. In contrast, when we use &#8217;&#8230;&#8217; it means that
458
+ the corresponding block is simply instantiated in the current dialect.
459
+ Implicit dialect modulation is in fact natural: if a block expects an uri
460
+ for example, the easiest way is to give it exactly:
461
+ <tt>&lt;&lt;{a/file/to/include.txt}</tt>. But you can even compute it using
462
+ <em>wlang</em>, as illustrated by the example below. In complex situations
463
+ you will probably be happy to use a dialect that helps you doing so (think
464
+ at all blocks that expect an expression in the hosting language, for
465
+ example)!
466
+ </p>
467
+ <pre>
468
+ # Concatenates all files of the 'files' array variable
469
+ *{files as f}{&lt;&lt;{+{f}}}
470
+ </pre>
471
+
472
+
473
+
474
+ <h3 id="Basic">Basic</h3>
475
+ <p>
476
+ The Basic ruleset is commonly installed on any dialect and provides access
477
+ to <em>wlang</em> foundations inside your template: requesting the hosting
478
+ language to execute some expression, changing the current dialect and
479
+ encoding text.
480
+ </p>
481
+
482
+ <table class="ruleset">
483
+ <tr>
484
+ <th class="signature">signature</th>
485
+ <th class="name">name</th>
486
+ <th class="definition">definition</th>
487
+ </tr>
466
488
 
467
- <table class="ruleset">
468
- <tr>
469
- <th class="signature">signature</th>
470
- <th class="name">name</th>
471
- <th class="definition">definition</th>
472
- </tr>
473
489
  <tr>
474
490
  <td class="signature"><tt>!{wlang/hosted}</tt></td>
475
491
  <td class="name">execution</td>
476
492
  <td class="definition">Instantiates #1, looking for an expression of the hosting language.
477
- Evaluates it, looking for any object. Converts it to a string (using to_s
478
- for example if Ruby is the hosting language) and returns the result as
479
- replacement value.</td>
493
+ Evaluates it, looking for any object. Converts it to a string (using to_s
494
+ for example if Ruby is the hosting language) and returns the result as
495
+ replacement value.</td>
480
496
  </tr>
497
+
481
498
  <tr>
482
499
  <td class="signature"><tt>%{wlang/active-string}{...}</tt></td>
483
500
  <td class="name">modulation</td>
484
501
  <td class="definition">Instantiates #1, looking for a dialect qualified name. Instantiates #2
485
- according to the rules defined by that dialect and returns the #2&#8217;s
486
- instantiation as replacement value.</td>
502
+ according to the rules defined by that dialect and returns the #2&#8217;s
503
+ instantiation as replacement value.</td>
487
504
  </tr>
505
+
488
506
  <tr>
489
507
  <td class="signature"><tt>^{wlang/active-string}{...}</tt></td>
490
508
  <td class="name">encoding</td>
491
509
  <td class="definition">Instantiates #1, looking for an encoder qualified name. Instantiates #2 in
492
- the current dialect. Encode #2&#8217;s instantiation using encoder found in
493
- (#1) and returns encoding as replacement value.</td>
510
+ the current dialect. Encode #2&#8217;s instantiation using encoder found in
511
+ (#1) and returns encoding as replacement value.</td>
494
512
  </tr>
513
+
495
514
  <tr>
496
515
  <td class="signature"><tt>%!{wlang/active-string &lt;using&gt;? &lt;with&gt;?}{...}</tt></td>
497
516
  <td class="name">recursive-application</td>
498
517
  <td class="definition">Instantiates #1, looking for a dialect qualified name. Instantiates #2 in
499
- the current dialect. Instantiates #2&#8217;s instantiation in the dialect
500
- found in #1, using context installed by &#8216;using &#8230;&#8217; and
501
- &#8216;with &#8230;&#8217;. Returns this instantiation as replacement value
502
- (this really advanced rule allows metaprogramming).</td>
518
+ the current dialect. Instantiates #2&#8217;s instantiation in the dialect
519
+ found in #1, using context installed by &#8216;using &#8230;&#8217; and
520
+ &#8216;with &#8230;&#8217;. Returns this instantiation as replacement value
521
+ (this really advanced rule allows metaprogramming).</td>
503
522
  </tr>
523
+
504
524
  <tr>
505
525
  <td class="signature"><tt>${wlang/hosted}</tt></td>
506
526
  <td class="name">injection</td>
507
527
  <td class="definition">Same semantics as execution (intended to be overrided).</td>
508
528
  </tr>
529
+
509
530
  <tr>
510
531
  <td class="signature"><tt>+{wlang/hosted}</tt></td>
511
532
  <td class="name">inclusion</td>
512
533
  <td class="definition">Same semantics as execution (intended to be overrided).</td>
513
534
  </tr>
514
535
 
515
- </table>
516
-
536
+ </table>
537
+
538
+
517
539
  <br/>
518
540
  <h4>Examples:</h4>
519
541
  <table class="examples">
@@ -522,113 +544,159 @@
522
544
  <th>wlang expression</th>
523
545
  <th>replacement value</th>
524
546
  </tr>
525
- <tr>
526
- <td class="dialect">
527
- <tt>wlang/active-string</tt>
528
- </td>
529
- <td class="expression">
530
- <tt>Hello !{name}</tt>
531
- </td>
532
- <td class="replacement">
533
- <tt>Hello O'Neil</tt>
534
547
 
535
- </td>
536
- </tr>
537
- <tr>
538
- <td class="dialect">
539
- <tt>wlang/active-string</tt>
540
- </td>
541
- <td class="expression">
542
- <tt>Hello %{wlang/dummy}{!{name}}</tt>
543
- </td>
544
- <td class="replacement">
545
- <tt>Hello !{name}</tt>
548
+ <tr>
549
+ <td class="dialect">
550
+ <tt>wlang/active-string</tt>
551
+ </td>
552
+ <td class="expression">
553
+ <tt>Hello !{name}</tt>
554
+ </td>
555
+ <td class="replacement">
556
+
557
+ <tt>Hello O'Neil</tt>
558
+
559
+ </td>
560
+ </tr>
546
561
 
547
- </td>
548
- </tr>
549
- <tr>
550
- <td class="dialect">
551
- <tt>wlang/dummy</tt>
552
- </td>
553
- <td class="expression">
554
- <tt>Hello %{wlang/dummy}{!{name}}</tt>
555
- </td>
556
- <td class="replacement">
557
- <tt>Hello %{wlang/dummy}{!{name}}</tt>
562
+ <tr>
563
+ <td class="dialect">
564
+ <tt>wlang/active-string</tt>
565
+ </td>
566
+ <td class="expression">
567
+ <tt>Hello %{wlang/dummy}{!{name}}</tt>
568
+ </td>
569
+ <td class="replacement">
570
+
571
+ <tt>Hello !{name}</tt>
572
+
573
+ </td>
574
+ </tr>
558
575
 
559
- </td>
560
- </tr>
561
- <tr>
562
- <td class="dialect">
563
- <tt>wlang/active-string</tt>
564
- </td>
565
- <td class="expression">
566
- <tt>Hello ^{plain-text/upcase}{${name}}</tt>
567
- </td>
568
- <td class="replacement">
569
- <tt>Hello O'NEIL</tt>
576
+ <tr>
577
+ <td class="dialect">
578
+ <tt>wlang/dummy</tt>
579
+ </td>
580
+ <td class="expression">
581
+ <tt>Hello %{wlang/dummy}{!{name}}</tt>
582
+ </td>
583
+ <td class="replacement">
584
+
585
+ <tt>Hello %{wlang/dummy}{!{name}}</tt>
586
+
587
+ </td>
588
+ </tr>
589
+
590
+ <tr>
591
+ <td class="dialect">
592
+ <tt>wlang/active-string</tt>
593
+ </td>
594
+ <td class="expression">
595
+ <tt>Hello ^{plain-text/upcase}{${name}}</tt>
596
+ </td>
597
+ <td class="replacement">
598
+
599
+ <tt>Hello O'NEIL</tt>
600
+
601
+ </td>
602
+ </tr>
603
+
604
+ <tr>
605
+ <td class="dialect">
606
+ <tt>wlang/ruby</tt>
607
+ </td>
608
+ <td class="expression">
609
+ <tt>puts +{name}</tt>
610
+ </td>
611
+ <td class="replacement">
612
+
613
+ <tt>puts "O'Neil"</tt>
614
+
615
+ </td>
616
+ </tr>
617
+
618
+ <tr>
619
+ <td class="dialect">
620
+ <tt>wlang/ruby</tt>
621
+ </td>
622
+ <td class="expression">
623
+ <tt>puts +{authors}</tt>
624
+ </td>
625
+ <td class="replacement">
626
+
627
+ <tt>puts ["blambeau", "llambeau", "ancailliau"]</tt>
628
+
629
+ </td>
630
+ </tr>
570
631
 
571
- </td>
572
- </tr>
573
-
574
632
  </table>
575
633
  <div style="clear: both;"></div>
576
- <h3 id="Encoding">Encoding</h3>
577
- <p>
578
- Almost all languages require escaping/encoding in specific situations:
579
- quoted string literals always come with an escaping mechanism
580
- (unfortunately different from one language to another), html requires
581
- entities-encoding, etc. The Encoding ruleset proposes shortcut tags for
582
- encoding. Note that these shortcuts are written in such a way that they
583
- don&#8217;t depend on the effective dialect. <em>wlang</em> hides language
584
- and vendors differences!
585
- </p>
634
+
635
+
636
+ <h3 id="Encoding">Encoding</h3>
637
+ <p>
638
+ Almost all languages require escaping/encoding in specific situations:
639
+ quoted string literals always come with an escaping mechanism
640
+ (unfortunately different from one language to another), html requires
641
+ entities-encoding, etc. The Encoding ruleset proposes shortcut tags for
642
+ encoding. Note that these shortcuts are written in such a way that they
643
+ don&#8217;t depend on the effective dialect. <em>wlang</em> hides language
644
+ and vendors differences!
645
+ </p>
646
+
647
+ <table class="ruleset">
648
+ <tr>
649
+ <th class="signature">signature</th>
650
+ <th class="name">name</th>
651
+ <th class="definition">definition</th>
652
+ </tr>
586
653
 
587
- <table class="ruleset">
588
- <tr>
589
- <th class="signature">signature</th>
590
- <th class="name">name</th>
591
- <th class="definition">definition</th>
592
- </tr>
593
654
  <tr>
594
655
  <td class="signature"><tt>&amp;{...}</tt></td>
595
656
  <td class="name">main-encoding</td>
596
657
  <td class="definition"><tt>^{+{@parser.current_dialect}/main-encoding}{#1}</tt></td>
597
658
  </tr>
659
+
598
660
  <tr>
599
661
  <td class="signature"><tt>&amp;;{...}</tt></td>
600
662
  <td class="name">entities-encoding</td>
601
663
  <td class="definition"><tt>^{+{@parser.current_dialect}/entities-encoding}{#1}</tt></td>
602
664
  </tr>
665
+
603
666
  <tr>
604
667
  <td class="signature"><tt>&amp;'{...}</tt></td>
605
668
  <td class="name">single-quoting</td>
606
669
  <td class="definition"><tt>^{+{@parser.current_dialect}/single-quoting}{#1}</tt></td>
607
670
  </tr>
671
+
608
672
  <tr>
609
673
  <td class="signature"><tt>&amp;&quot;{...}</tt></td>
610
674
  <td class="name">double-quoting</td>
611
675
  <td class="definition"><tt>^{+{@parser.current_dialect}/double-quoting}{#1}</tt></td>
612
676
  </tr>
677
+
613
678
  <tr>
614
679
  <td class="signature"><tt>${wlang/hosted}</tt></td>
615
680
  <td class="name">injection</td>
616
681
  <td class="definition"><tt>&amp;{+{#1}}</tt></td>
617
682
  </tr>
683
+
618
684
  <tr>
619
685
  <td class="signature"><tt>'{wlang/hosted}</tt></td>
620
686
  <td class="name">single-quoted</td>
621
687
  <td class="definition"><tt>'&amp;'{+{#1}}</tt> (first single quote is kept in the result)</td>
622
688
  </tr>
689
+
623
690
  <tr>
624
691
  <td class="signature"><tt>&quot;{wlang/hosted}</tt></td>
625
692
  <td class="name">double-quoted</td>
626
693
  <td class="definition"><tt>&quot;&amp;&quot;{+{#1}}</tt> (first double quote is kept in the
627
- result)</td>
694
+ result)</td>
628
695
  </tr>
629
696
 
630
- </table>
631
-
697
+ </table>
698
+
699
+
632
700
  <br/>
633
701
  <h4>Examples:</h4>
634
702
  <table class="examples">
@@ -637,137 +705,158 @@
637
705
  <th>wlang expression</th>
638
706
  <th>replacement value</th>
639
707
  </tr>
640
- <tr>
641
- <td class="dialect">
642
- <tt>wlang/xhtml</tt>
643
- </td>
644
- <td class="expression">
645
- <tt>Hello &amp;{name}</tt>
646
- </td>
647
- <td class="replacement">
648
- <tt>Hello name</tt>
649
708
 
650
- </td>
651
- </tr>
652
- <tr>
653
- <td class="dialect">
654
- <tt>wlang/xhtml</tt>
655
- </td>
656
- <td class="expression">
657
- <tt>Hello &amp;{&lt;script&gt;}</tt>
658
- </td>
659
- <td class="replacement">
660
- <tt>Hello &lt;script&gt;</tt>
709
+ <tr>
710
+ <td class="dialect">
711
+ <tt>wlang/xhtml</tt>
712
+ </td>
713
+ <td class="expression">
714
+ <tt>Hello &amp;{name}</tt>
715
+ </td>
716
+ <td class="replacement">
717
+
718
+ <tt>Hello name</tt>
719
+
720
+ </td>
721
+ </tr>
661
722
 
662
- </td>
663
- </tr>
664
- <tr>
665
- <td class="dialect">
666
- <tt>wlang/xhtml</tt>
667
- </td>
668
- <td class="expression">
669
- <tt>Hello &amp;;{&lt;script&gt;}</tt>
670
- </td>
671
- <td class="replacement">
672
- <tt>Hello &lt;script&gt;</tt>
723
+ <tr>
724
+ <td class="dialect">
725
+ <tt>wlang/xhtml</tt>
726
+ </td>
727
+ <td class="expression">
728
+ <tt>Hello &amp;{&lt;script&gt;}</tt>
729
+ </td>
730
+ <td class="replacement">
731
+
732
+ <tt>Hello &lt;script&gt;</tt>
733
+
734
+ </td>
735
+ </tr>
673
736
 
674
- </td>
675
- </tr>
676
- <tr>
677
- <td class="dialect">
678
- <tt>wlang/ruby</tt>
679
- </td>
680
- <td class="expression">
681
- <tt>puts 'Hello &amp;'{name}'</tt>
682
- </td>
683
- <td class="replacement">
684
- <tt>puts 'Hello name'</tt>
737
+ <tr>
738
+ <td class="dialect">
739
+ <tt>wlang/xhtml</tt>
740
+ </td>
741
+ <td class="expression">
742
+ <tt>Hello &amp;;{&lt;script&gt;}</tt>
743
+ </td>
744
+ <td class="replacement">
745
+
746
+ <tt>Hello &lt;script&gt;</tt>
747
+
748
+ </td>
749
+ </tr>
685
750
 
686
- </td>
687
- </tr>
688
- <tr>
689
- <td class="dialect">
690
- <tt>wlang/ruby</tt>
691
- </td>
692
- <td class="expression">
693
- <tt>puts 'Hello &amp;'{!{name}}'</tt>
694
- </td>
695
- <td class="replacement">
696
- <tt>puts 'Hello O\'Neil'</tt>
751
+ <tr>
752
+ <td class="dialect">
753
+ <tt>wlang/ruby</tt>
754
+ </td>
755
+ <td class="expression">
756
+ <tt>puts 'Hello &amp;'{name}'</tt>
757
+ </td>
758
+ <td class="replacement">
759
+
760
+ <tt>puts 'Hello name'</tt>
761
+
762
+ </td>
763
+ </tr>
697
764
 
698
- </td>
699
- </tr>
700
- <tr>
701
- <td class="dialect">
702
- <tt>wlang/ruby</tt>
703
- </td>
704
- <td class="expression">
705
- <tt>puts 'Hello ' &lt;&lt; '{name}'</tt>
706
- </td>
707
- <td class="replacement">
708
- <tt>puts 'Hello ' << 'O\'Neil'</tt>
765
+ <tr>
766
+ <td class="dialect">
767
+ <tt>wlang/ruby</tt>
768
+ </td>
769
+ <td class="expression">
770
+ <tt>puts 'Hello &amp;'{!{name}}'</tt>
771
+ </td>
772
+ <td class="replacement">
773
+
774
+ <tt>puts 'Hello O\'Neil'</tt>
775
+
776
+ </td>
777
+ </tr>
709
778
 
710
- </td>
711
- </tr>
712
- <tr>
713
- <td class="dialect">
714
- <tt>wlang/sql</tt>
715
- </td>
716
- <td class="expression">
717
- <tt>... WHERE name='{name}'</tt>
718
- </td>
719
- <td class="replacement">
720
- <tt>... WHERE name='O\'Neil'</tt>
779
+ <tr>
780
+ <td class="dialect">
781
+ <tt>wlang/ruby</tt>
782
+ </td>
783
+ <td class="expression">
784
+ <tt>puts 'Hello ' &lt;&lt; '{name}'</tt>
785
+ </td>
786
+ <td class="replacement">
787
+
788
+ <tt>puts 'Hello ' << 'O\'Neil'</tt>
789
+
790
+ </td>
791
+ </tr>
721
792
 
722
- </td>
723
- </tr>
724
- <tr>
725
- <td class="dialect">
726
- <tt>wlang/sql/sybase</tt>
727
- </td>
728
- <td class="expression">
729
- <tt>... WHERE name='{name}'</tt>
730
- </td>
731
- <td class="replacement">
732
- <tt>... WHERE name='O''Neil'</tt>
793
+ <tr>
794
+ <td class="dialect">
795
+ <tt>wlang/sql</tt>
796
+ </td>
797
+ <td class="expression">
798
+ <tt>... WHERE name='{name}'</tt>
799
+ </td>
800
+ <td class="replacement">
801
+
802
+ <tt>... WHERE name='O\'Neil'</tt>
803
+
804
+ </td>
805
+ </tr>
806
+
807
+ <tr>
808
+ <td class="dialect">
809
+ <tt>wlang/sql/sybase</tt>
810
+ </td>
811
+ <td class="expression">
812
+ <tt>... WHERE name='{name}'</tt>
813
+ </td>
814
+ <td class="replacement">
815
+
816
+ <tt>... WHERE name='O''Neil'</tt>
817
+
818
+ </td>
819
+ </tr>
733
820
 
734
- </td>
735
- </tr>
736
-
737
821
  </table>
738
822
  <div style="clear: both;"></div>
739
- <h3 id="Imperative">Imperative</h3>
740
- <p>
741
- Instantiating conditionally and iterating collection elements are common
742
- code generation tasks. The Imperative dialect provides these features.
743
- </p>
823
+
824
+
825
+ <h3 id="Imperative">Imperative</h3>
826
+ <p>
827
+ Instantiating conditionally and iterating collection elements are common
828
+ code generation tasks. The Imperative dialect provides these features.
829
+ </p>
830
+
831
+ <table class="ruleset">
832
+ <tr>
833
+ <th class="signature">signature</th>
834
+ <th class="name">name</th>
835
+ <th class="definition">definition</th>
836
+ </tr>
744
837
 
745
- <table class="ruleset">
746
- <tr>
747
- <th class="signature">signature</th>
748
- <th class="name">name</th>
749
- <th class="definition">definition</th>
750
- </tr>
751
838
  <tr>
752
839
  <td class="signature"><tt>?{wlang/hosted}{...}{...}</tt></td>
753
840
  <td class="name">conditional<br/>(third block is optional)</td>
754
841
  <td class="definition">Instantiates #1, looking for an expression in the hosting language.
755
- Evaluates it, looking for a boolean value (according to boolean semantics
756
- of the hosting language). If true, instantiates #2, otherwise instantiates
757
- #3 if present, returning instantiation as replacement value.</td>
842
+ Evaluates it, looking for a boolean value (according to boolean semantics
843
+ of the hosting language). If true, instantiates #2, otherwise instantiates
844
+ #3 if present, returning instantiation as replacement value.</td>
758
845
  </tr>
846
+
759
847
  <tr>
760
848
  <td class="signature"><tt>*{wlang/hosted &lt;as x&gt;?}{...}{...}</tt></td>
761
849
  <td class="name">enumeration<br/>(third block is optional)</td>
762
850
  <td class="definition">Instantiates #1, looking for an expression in the hosting language.
763
- Evaluates it, looking for an enumerable. Iterates all its elements,
764
- instantiating #2 for each of them (the iterated value is set under name x
765
- in the scope). If #3 is present, it is instantiated between elements.
766
- Replacement is the concatenation of all these instantiations.</td>
851
+ Evaluates it, looking for an enumerable. Iterates all its elements,
852
+ instantiating #2 for each of them (the iterated value is set under name x
853
+ in the scope). If #3 is present, it is instantiated between elements.
854
+ Replacement is the concatenation of all these instantiations.</td>
767
855
  </tr>
768
856
 
769
- </table>
770
-
857
+ </table>
858
+
859
+
771
860
  <br/>
772
861
  <h4>Examples:</h4>
773
862
  <table class="examples">
@@ -776,105 +865,120 @@
776
865
  <th>wlang expression</th>
777
866
  <th>replacement value</th>
778
867
  </tr>
779
- <tr>
780
- <td class="dialect">
781
- <tt>wlang/*</tt>
782
- </td>
783
- <td class="expression">
784
- <tt>?{true}{then}{else}</tt>
785
- </td>
786
- <td class="replacement">
787
- <tt>then</tt>
788
868
 
789
- </td>
790
- </tr>
791
- <tr>
792
- <td class="dialect">
793
- <tt>wlang/*</tt>
794
- </td>
795
- <td class="expression">
796
- <tt>?{/th/ =~ &quot;not tat&quot;}{then}{else}</tt>
797
- </td>
798
- <td class="replacement">
799
- <tt>else</tt>
869
+ <tr>
870
+ <td class="dialect">
871
+ <tt>wlang/*</tt>
872
+ </td>
873
+ <td class="expression">
874
+ <tt>?{true}{then}{else}</tt>
875
+ </td>
876
+ <td class="replacement">
877
+
878
+ <tt>then</tt>
879
+
880
+ </td>
881
+ </tr>
800
882
 
801
- </td>
802
- </tr>
803
- <tr>
804
- <td class="dialect">
805
- <tt>wlang/*</tt>
806
- </td>
807
- <td class="expression">
808
- <tt>?{authors.include? &quot;blambeau&quot;}{yes}{no}</tt>
809
- </td>
810
- <td class="replacement">
811
- <tt>yes</tt>
883
+ <tr>
884
+ <td class="dialect">
885
+ <tt>wlang/*</tt>
886
+ </td>
887
+ <td class="expression">
888
+ <tt>?{/th/ =~ &quot;not tat&quot;}{then}{else}</tt>
889
+ </td>
890
+ <td class="replacement">
891
+
892
+ <tt>else</tt>
893
+
894
+ </td>
895
+ </tr>
812
896
 
813
- </td>
814
- </tr>
815
- <tr>
816
- <td class="dialect">
817
- <tt>wlang/*</tt>
818
- </td>
819
- <td class="expression">
820
- <tt>[*{authors as a}{&quot;{a}&quot;}{, }]</tt>
821
- </td>
822
- <td class="replacement">
823
- <tt>["blambeau", "llambeau", "ancailliau"]</tt>
897
+ <tr>
898
+ <td class="dialect">
899
+ <tt>wlang/*</tt>
900
+ </td>
901
+ <td class="expression">
902
+ <tt>?{authors.include? &quot;blambeau&quot;}{yes}{no}</tt>
903
+ </td>
904
+ <td class="replacement">
905
+
906
+ <tt>yes</tt>
907
+
908
+ </td>
909
+ </tr>
910
+
911
+ <tr>
912
+ <td class="dialect">
913
+ <tt>wlang/*</tt>
914
+ </td>
915
+ <td class="expression">
916
+ <tt>[*{authors as a}{&quot;{a}&quot;}{, }]</tt>
917
+ </td>
918
+ <td class="replacement">
919
+
920
+ <tt>["blambeau", "llambeau", "ancailliau"]</tt>
921
+
922
+ </td>
923
+ </tr>
824
924
 
825
- </td>
826
- </tr>
827
-
828
925
  </table>
829
926
  <div style="clear: both;"></div>
830
- <h3 id="Context">Context</h3>
831
- <p>
832
- Complex templates come with specific needs. The ability to manipulate the
833
- context and the current scope is provided by the Context ruleset. All are
834
- variants of &#8216;saving previous instantiations&#8217; in scope
835
- variables&#8230;
836
- </p>
927
+
928
+
929
+ <h3 id="Context">Context</h3>
930
+ <p>
931
+ Complex templates come with specific needs. The ability to manipulate the
932
+ context and the current scope is provided by the Context ruleset. All are
933
+ variants of &#8216;saving previous instantiations&#8217; in scope
934
+ variables&#8230;
935
+ </p>
936
+
937
+ <table class="ruleset">
938
+ <tr>
939
+ <th class="signature">signature</th>
940
+ <th class="name">name</th>
941
+ <th class="definition">definition</th>
942
+ </tr>
837
943
 
838
- <table class="ruleset">
839
- <tr>
840
- <th class="signature">signature</th>
841
- <th class="name">name</th>
842
- <th class="definition">definition</th>
843
- </tr>
844
944
  <tr>
845
945
  <td class="signature"><tt>={wlang/hosted &lt;as x&gt;}{...}</tt></td>
846
946
  <td class="name">assignment<br/>(second block is optional)</td>
847
947
  <td class="definition">Instantiates #1, looking for an expression in the hosting language.
848
- Evaluates it, looking for any object. Without second block, expands the
849
- current scope with &#8216;x&#8217; being bound to evaluation result.
850
- Otherwise, branches the current scope for the second block instantiation
851
- only and bind &#8216;x&#8217; the same way (i.e. x will not be available
852
- outside the second block). Returns an empty string as replacement value.</td>
948
+ Evaluates it, looking for any object. Without second block, expands the
949
+ current scope with &#8216;x&#8217; being bound to evaluation result.
950
+ Otherwise, branches the current scope for the second block instantiation
951
+ only and bind &#8216;x&#8217; the same way (i.e. x will not be available
952
+ outside the second block). Returns an empty string as replacement value.</td>
853
953
  </tr>
954
+
854
955
  <tr>
855
956
  <td class="signature"><tt>%={wlang/active-string &lt;as x&gt;}{...}{...}</tt></td>
856
957
  <td class="name">modulo-assignment<br/>(third block is optional)</td>
857
958
  <td class="definition">Instantiates #1, looking for a dialect qualified name. Instantiates #2
858
- according to the rules defined by that dialect. Without third block,
859
- expands the current scope with &#8216;x&#8217; being bound to #2&#8217;s
860
- instantiation. Otherwise, branches the current scope for the third block
861
- instantiation only and binds &#8216;x&#8217; the same way (i.e. x will not
862
- be available outside the third block). Returns an empty string as
863
- replacement value.</td>
959
+ according to the rules defined by that dialect. Without third block,
960
+ expands the current scope with &#8216;x&#8217; being bound to #2&#8217;s
961
+ instantiation. Otherwise, branches the current scope for the third block
962
+ instantiation only and binds &#8216;x&#8217; the same way (i.e. x will not
963
+ be available outside the third block). Returns an empty string as
964
+ replacement value.</td>
864
965
  </tr>
966
+
865
967
  <tr>
866
968
  <td class="signature"><tt>#={wlang/active-string}{...}{...}</tt></td>
867
969
  <td class="name">block-assignment<br/>(third block is optional)</td>
868
970
  <td class="definition"><tt>%={+{@parser.current_dialect} as #1}{#2}{#3}</tt></td>
869
971
  </tr>
972
+
870
973
  <tr>
871
974
  <td class="signature"><tt>^={wlang/active-string &lt;as x&gt;}{...}{...}</tt></td>
872
975
  <td class="name">encoding-assignment<br/>(third block is optional)</td>
873
976
  <td class="definition"><tt>%={+{@parser.current_dialect} as x}{^{#1}{#2}}{#3}</tt></td>
874
977
  </tr>
875
978
 
876
- </table>
877
-
979
+ </table>
980
+
981
+
878
982
  <br/>
879
983
  <h4>Examples:</h4>
880
984
  <table class="examples">
@@ -883,542 +987,674 @@
883
987
  <th>wlang expression</th>
884
988
  <th>replacement value</th>
885
989
  </tr>
886
- <tr>
887
- <td class="dialect">
888
- <tt>wlang/*</tt>
889
- </td>
890
- <td class="expression">
891
- <tt>={name as n}{Hello +{n}}</tt>
892
- </td>
893
- <td class="replacement">
894
- <tt>Hello O'Neil</tt>
895
990
 
896
- </td>
897
- </tr>
898
- <tr>
899
- <td class="dialect">
900
- <tt>wlang/*</tt>
901
- </td>
902
- <td class="expression">
903
- <tt>={name as n}Hello +{n}</tt>
904
- </td>
905
- <td class="replacement">
906
- <tt>Hello O'Neil</tt>
991
+ <tr>
992
+ <td class="dialect">
993
+ <tt>wlang/*</tt>
994
+ </td>
995
+ <td class="expression">
996
+ <tt>={name as n}{Hello !{n}}</tt>
997
+ </td>
998
+ <td class="replacement">
999
+
1000
+ <tt>Hello O'Neil</tt>
1001
+
1002
+ </td>
1003
+ </tr>
907
1004
 
908
- </td>
909
- </tr>
910
- <tr>
911
- <td class="dialect">
912
- <tt>wlang/*</tt>
913
- </td>
914
- <td class="expression">
915
- <tt>#={name}{blambeau}{Hello +{name}} and +{name}</tt>
916
- </td>
917
- <td class="replacement">
918
- <tt>Hello blambeau and O'Neil</tt>
1005
+ <tr>
1006
+ <td class="dialect">
1007
+ <tt>wlang/*</tt>
1008
+ </td>
1009
+ <td class="expression">
1010
+ <tt>={name as n}Hello !{n}</tt>
1011
+ </td>
1012
+ <td class="replacement">
1013
+
1014
+ <tt>Hello O'Neil</tt>
1015
+
1016
+ </td>
1017
+ </tr>
919
1018
 
920
- </td>
921
- </tr>
922
- <tr>
923
- <td class="dialect">
924
- <tt>wlang/*</tt>
925
- </td>
926
- <td class="expression">
927
- <tt>#={name}{blambeau}Hello +{name} and +{name}</tt>
928
- </td>
929
- <td class="replacement">
930
- <tt>Hello blambeau and blambeau</tt>
1019
+ <tr>
1020
+ <td class="dialect">
1021
+ <tt>wlang/*</tt>
1022
+ </td>
1023
+ <td class="expression">
1024
+ <tt>#={name}{blambeau}{Hello !{name}} and !{name}</tt>
1025
+ </td>
1026
+ <td class="replacement">
1027
+
1028
+ <tt>Hello blambeau and O'Neil</tt>
1029
+
1030
+ </td>
1031
+ </tr>
931
1032
 
932
- </td>
933
- </tr>
934
- <tr>
935
- <td class="dialect">
936
- <tt>wlang/*</tt>
937
- </td>
938
- <td class="expression">
939
- <tt>={author as name}{Hello +{name}} and +{name}</tt>
940
- </td>
941
- <td class="replacement">
942
- <tt>Hello blambeau and O'Neil</tt>
1033
+ <tr>
1034
+ <td class="dialect">
1035
+ <tt>wlang/*</tt>
1036
+ </td>
1037
+ <td class="expression">
1038
+ <tt>#={name}{blambeau}Hello !{name} and !{name}</tt>
1039
+ </td>
1040
+ <td class="replacement">
1041
+
1042
+ <tt>Hello blambeau and blambeau</tt>
1043
+
1044
+ </td>
1045
+ </tr>
943
1046
 
944
- </td>
945
- </tr>
946
- <tr>
947
- <td class="dialect">
948
- <tt>wlang/*</tt>
949
- </td>
950
- <td class="expression">
951
- <tt>={author as name}Hello +{name} and +{name}</tt>
952
- </td>
953
- <td class="replacement">
954
- <tt>Hello blambeau and blambeau</tt>
1047
+ <tr>
1048
+ <td class="dialect">
1049
+ <tt>wlang/*</tt>
1050
+ </td>
1051
+ <td class="expression">
1052
+ <tt>={author as name}{Hello !{name}} and !{name}</tt>
1053
+ </td>
1054
+ <td class="replacement">
1055
+
1056
+ <tt>Hello blambeau and O'Neil</tt>
1057
+
1058
+ </td>
1059
+ </tr>
955
1060
 
956
- </td>
957
- </tr>
958
- <tr>
959
- <td class="dialect">
960
- <tt>wlang/*</tt>
961
- </td>
962
- <td class="expression">
963
- <tt>%={wlang/dummy as hello}{Hello +{name}}{+{hello}}</tt>
964
- </td>
965
- <td class="replacement">
966
- <tt>Hello +{name}</tt>
1061
+ <tr>
1062
+ <td class="dialect">
1063
+ <tt>wlang/*</tt>
1064
+ </td>
1065
+ <td class="expression">
1066
+ <tt>={author as name}Hello !{name} and !{name}</tt>
1067
+ </td>
1068
+ <td class="replacement">
1069
+
1070
+ <tt>Hello blambeau and blambeau</tt>
1071
+
1072
+ </td>
1073
+ </tr>
967
1074
 
968
- </td>
969
- </tr>
970
- <tr>
971
- <td class="dialect">
972
- <tt>wlang/*</tt>
973
- </td>
974
- <td class="expression">
975
- <tt>^={plain-text/upcase as name}{+{author}}{Hello +{name}} and +{name}</tt>
976
- </td>
977
- <td class="replacement">
978
- <tt>Hello BLAMBEAU and O'Neil</tt>
1075
+ <tr>
1076
+ <td class="dialect">
1077
+ <tt>wlang/*</tt>
1078
+ </td>
1079
+ <td class="expression">
1080
+ <tt>%={wlang/dummy as hello}{Hello !{name}}{!{hello}}</tt>
1081
+ </td>
1082
+ <td class="replacement">
1083
+
1084
+ <tt>Hello !{name}</tt>
1085
+
1086
+ </td>
1087
+ </tr>
979
1088
 
980
- </td>
981
- </tr>
982
- <tr>
983
- <td class="dialect">
984
- <tt>wlang/*</tt>
985
- </td>
986
- <td class="expression">
987
- <tt>^={plain-text/upcase as name}{+{author}}Hello +{name} and +{name}</tt>
988
- </td>
989
- <td class="replacement">
990
- <tt>Hello BLAMBEAU and BLAMBEAU</tt>
1089
+ <tr>
1090
+ <td class="dialect">
1091
+ <tt>wlang/*</tt>
1092
+ </td>
1093
+ <td class="expression">
1094
+ <tt>^={plain-text/upcase as name}{!{author}}{Hello !{name}} and !{name}</tt>
1095
+ </td>
1096
+ <td class="replacement">
1097
+
1098
+ <tt>Hello BLAMBEAU and O'Neil</tt>
1099
+
1100
+ </td>
1101
+ </tr>
1102
+
1103
+ <tr>
1104
+ <td class="dialect">
1105
+ <tt>wlang/*</tt>
1106
+ </td>
1107
+ <td class="expression">
1108
+ <tt>^={plain-text/upcase as name}{!{author}}Hello !{name} and !{name}</tt>
1109
+ </td>
1110
+ <td class="replacement">
1111
+
1112
+ <tt>Hello BLAMBEAU and BLAMBEAU</tt>
1113
+
1114
+ </td>
1115
+ </tr>
991
1116
 
992
- </td>
993
- </tr>
994
-
995
1117
  </table>
996
1118
  <div style="clear: both;"></div>
997
- <h3 id="Buffering">Buffering</h3>
998
- <p>
999
- The Buffering ruleset is probably one of the more useful. It allows you to
1000
- load text and data files, to change the current output buffer (for
1001
- generating multiple files for example) and even to start the instantiation
1002
- on other templates.
1003
- </p>
1119
+
1120
+
1121
+ <h3 id="Buffering">Buffering</h3>
1122
+ <p>
1123
+ The Buffering ruleset is probably one of the more useful. It allows you to
1124
+ load text and data files, to change the current output buffer (for
1125
+ generating multiple files for example) and even to start the instantiation
1126
+ on other templates.
1127
+ </p>
1128
+
1129
+ <table class="ruleset">
1130
+ <tr>
1131
+ <th class="signature">signature</th>
1132
+ <th class="name">name</th>
1133
+ <th class="definition">definition</th>
1134
+ </tr>
1004
1135
 
1005
- <table class="ruleset">
1006
- <tr>
1007
- <th class="signature">signature</th>
1008
- <th class="name">name</th>
1009
- <th class="definition">definition</th>
1010
- </tr>
1011
1136
  <tr>
1012
1137
  <td class="signature"><tt>&lt;&lt;{wlang/uri}</tt></td>
1013
1138
  <td class="name">input</td>
1014
1139
  <td class="definition">Instantiates #1, looking for an uri. Returns the text content of the found
1015
- uri (#1) as replacement value.</td>
1140
+ uri (#1) as replacement value.</td>
1016
1141
  </tr>
1142
+
1017
1143
  <tr>
1018
1144
  <td class="signature"><tt>&gt;&gt;{wlang/uri}{...}</tt></td>
1019
1145
  <td class="name">output</td>
1020
1146
  <td class="definition">Instantiates #1, looking for an uri. Instantiates #2 in the current
1021
- dialect, using the file found in #1 as output buffer. Returns an empty
1022
- string as replacement value.</td>
1147
+ dialect, using the file found in #1 as output buffer. Returns an empty
1148
+ string as replacement value.</td>
1023
1149
  </tr>
1150
+
1024
1151
  <tr>
1025
1152
  <td class="signature"><tt>&lt;&lt;={wlang/uri &lt;as x&gt;}{...}</tt></td>
1026
1153
  <td class="name">data-assignment</td>
1027
1154
  <td class="definition">Instantiates #1, looking for an uri. Loads data provided by this uri, based
1028
- on the file extension (typically .yml or .rb). Without second block,
1029
- expands the current scope with &#8216;x&#8217; being bound to the data.
1030
- Otherwise, branches the current scope for the second block instantiation
1031
- only and binds &#8216;x&#8217; the same way (i.e. x will not be available
1032
- outside the second block). Returns an empty string as replacement value.</td>
1155
+ on the file extension (typically .yml or .rb). Without second block,
1156
+ expands the current scope with &#8216;x&#8217; being bound to the data.
1157
+ Otherwise, branches the current scope for the second block instantiation
1158
+ only and binds &#8216;x&#8217; the same way (i.e. x will not be available
1159
+ outside the second block). Returns an empty string as replacement value.</td>
1033
1160
  </tr>
1161
+
1034
1162
  <tr>
1035
1163
  <td class="signature"><tt>&lt;&lt;+{wlang/uri &lt;using&gt;? &lt;with&gt;?}</tt></td>
1036
1164
  <td class="name">input-inclusion</td>
1037
1165
  <td class="definition">Instantiates #1, looking for an uri. Instantiates the <em>wlang</em>
1038
- template at this location (the dialect is infered from the file extension)
1039
- in a fresh new scope built from the <em>with</em> expression. Returns this
1040
- instantiation as replacement value.</td>
1166
+ template at this location (the dialect is infered from the file extension)
1167
+ in a fresh new scope built from the <em>with</em> expression. Returns this
1168
+ instantiation as replacement value.</td>
1041
1169
  </tr>
1042
1170
 
1043
- </table>
1171
+ </table>
1172
+
1173
+
1174
+
1175
+
1176
+
1177
+ </div>
1044
1178
 
1179
+ <div id="dialects" style="display: none;">
1180
+ <div class="header">
1181
+ <h2>Dialects</h2>
1182
+
1183
+ <div class="clear"></div>
1184
+ </div>
1185
+
1186
+
1187
+ <div class="dialect">
1188
+ <div style="margin-bottom: 20px">
1189
+ <h3 style="display: inline">wlang/hosted</h3>
1190
+
1191
+ <p style="display: inline">Includes Basic, Encoding, Imperative, Context, Hosted</p>
1192
+
1193
+ </div>
1194
+
1195
+
1196
+ </div>
1197
+
1198
+
1199
+ <div class="dialect">
1200
+ <div style="margin-bottom: 20px">
1201
+ <h3 style="display: inline">wlang/uri</h3>
1045
1202
 
1046
- </div>
1047
- <div id="dialects" style="display: none;">
1048
- <div class="header">
1049
- <h2>Dialects</h2>
1050
-
1051
- <div class="clear"></div>
1052
- </div>
1053
- <div class="dialect">
1054
- <div style="margin-bottom: 20px">
1055
- <h3 style="display: inline">wlang/uri</h3>
1056
1203
  <p style="display: inline">Includes Basic</p>
1057
1204
 
1058
- </div>
1205
+ </div>
1206
+
1207
+
1208
+ </div>
1209
+
1210
+
1211
+ <div class="dialect">
1212
+ <div style="margin-bottom: 20px">
1213
+ <h3 style="display: inline">wlang/active-text</h3>
1214
+
1215
+ <p style="display: inline">Includes Basic, Imperative, Buffering, Context</p>
1059
1216
 
1217
+ </div>
1218
+
1219
+
1220
+ </div>
1221
+
1222
+
1223
+ <div class="dialect">
1224
+ <div style="margin-bottom: 20px">
1225
+ <h3 style="display: inline">wlang/sql</h3>
1060
1226
 
1061
- </div>
1062
- <div class="dialect">
1063
- <div style="margin-bottom: 20px">
1064
- <h3 style="display: inline">wlang/sql</h3>
1065
1227
  <p style="display: inline">Includes Basic, Encoding, Imperative, SQL</p>
1066
1228
 
1067
- </div>
1229
+ </div>
1230
+
1231
+
1068
1232
 
1069
- <div class="dialect">
1070
- <div style="margin-bottom: 20px">
1071
- <h3 style="display: inline">wlang/sql/sybase</h3>
1072
- <p style="display: inline">Includes Basic, Encoding, Imperative, SQL</p>
1233
+ <div class="dialect">
1234
+ <div style="margin-bottom: 20px">
1235
+ <h3 style="display: inline">wlang/sql/sybase</h3>
1073
1236
 
1074
- </div>
1075
-
1076
-
1077
- </div>
1237
+ <p style="display: inline">Includes Basic, Encoding, Imperative, SQL</p>
1078
1238
 
1239
+ </div>
1240
+
1241
+
1242
+ </div>
1243
+
1079
1244
 
1080
- </div>
1081
- <div class="dialect">
1082
- <div style="margin-bottom: 20px">
1083
- <h3 style="display: inline">wlang/active-string</h3>
1084
- <p style="display: inline">Includes Basic, Imperative</p>
1245
+
1246
+ </div>
1247
+
1248
+
1249
+ <div class="dialect">
1250
+ <div style="margin-bottom: 20px">
1251
+ <h3 style="display: inline">wlang/active-string</h3>
1085
1252
 
1086
- </div>
1253
+ <p style="display: inline">Includes Basic, Imperative</p>
1087
1254
 
1255
+ </div>
1256
+
1257
+
1258
+ </div>
1259
+
1260
+
1261
+ <div class="dialect">
1262
+ <div style="margin-bottom: 20px">
1263
+ <h3 style="display: inline">wlang/xhtml</h3>
1088
1264
 
1089
- </div>
1090
- <div class="dialect">
1091
- <div style="margin-bottom: 20px">
1092
- <h3 style="display: inline">wlang/xhtml</h3>
1093
1265
  <p style="display: inline">Includes Basic, Encoding, Imperative, Buffering, Context, XHtml</p>
1094
1266
 
1095
- </div>
1096
-
1097
-
1098
- </div>
1099
- <div class="dialect">
1100
- <div style="margin-bottom: 20px">
1101
- <h3 style="display: inline">wlang/ruby</h3>
1102
- <p style="display: inline">Includes Basic, Encoding, Imperative, Context, Ruby</p>
1103
-
1104
- </div>
1105
-
1106
-
1107
- </div>
1108
- <div class="dialect">
1109
- <div style="margin-bottom: 20px">
1110
- <h3 style="display: inline">wlang/dummy</h3>
1111
-
1112
- </div>
1113
-
1267
+ </div>
1268
+
1269
+
1270
+ </div>
1271
+
1272
+
1273
+ <div class="dialect">
1274
+ <div style="margin-bottom: 20px">
1275
+ <h3 style="display: inline">wlang/yaml</h3>
1114
1276
 
1115
- </div>
1277
+ <p style="display: inline">Includes Basic, Encoding, Imperative, Buffering, Context, YAML</p>
1116
1278
 
1279
+ </div>
1280
+
1281
+
1282
+ </div>
1283
+
1284
+
1285
+ <div class="dialect">
1286
+ <div style="margin-bottom: 20px">
1287
+ <h3 style="display: inline">wlang/ruby</h3>
1117
1288
 
1118
- </div>
1119
- <div id="hosting" style="display: none;">
1120
- <div class="header">
1121
- <h2>Hosting language</h2>
1122
-
1123
- <div class="clear"></div>
1124
- </div>
1125
-
1289
+ <p style="display: inline">Includes Basic, Encoding, Imperative, Buffering, Context, Ruby</p>
1126
1290
 
1127
- </div>
1128
- <div id="glossary" style="display: none;">
1129
- <div class="header">
1130
- <h2>Glossary</h2>
1131
-
1132
- <div class="clear"></div>
1133
- </div>
1134
- <table class="glossary">
1135
- <tr>
1136
- <th class="term">term</th>
1137
- <th class="definition">definition</th>
1138
- <th class="example">example</th>
1139
- </tr>
1140
- <tr>
1141
- <td><em>template</em></td>
1142
- <td>Source code respecting the wlang grammar, and attached to a given <em>wlang
1143
- dialect</em>.</td>
1144
- <td style="font-size: 90%;"><tt>Hello ${name}</tt></td>
1145
- </tr>
1146
- <tr>
1147
- <td><em>dialect</em></td>
1148
- <td>Basically, <em>dialect</em> is used as a synonym for (programming)
1149
- <em>language</em>. However <em>wlang</em> uses a tree of dialects, allowing
1150
- specializations: <tt>sql/sybase</tt> for example is the qualified name of a
1151
- sub-dialect &#8216;sybase&#8217; of the &#8216;sql&#8217; dialect. Dialects
1152
- come with associated <em>encoders</em>.</td>
1153
- <td style="font-size: 90%;"><tt>sql/sybase</tt></td>
1154
- </tr>
1155
- <tr>
1156
- <td><em>wlang dialect</em></td>
1157
- <td>When we talk about a <em>wlang dialect</em>, we are actually refering to
1158
- some specialization of the wlang tag-based grammar: <tt>wlang/xhtml</tt>
1159
- for example is the templating language <em>wlang</em> proposes to generate
1160
- xhtml pages. An example of source code in that dialect has been shown
1161
- before. In addition to its encoders a <em>wlang dialect</em> comes with its
1162
- sets of <em>tags</em> and associated <em>rules</em>.</td>
1163
- <td style="font-size: 90%;"><tt>wlang/xhtml</tt></td>
1164
- </tr>
1165
- <tr>
1166
- <td><em>encoder</em></td>
1167
- <td>Text transformation (algorithm) applying some encoding conventions of a
1168
- portion of a the target language generated by a dialect. HTML
1169
- entities-encoding, SQL&#8217;s back-quoting are examples of encoders.
1170
- Encoders are accessible through their qualified name (dialect/encoder).</td>
1171
- <td style="font-size: 90%;"><tt>xhtml/entities-encoding</tt><br/><tt>sql/single-quoting</tt></td>
1172
- </tr>
1173
- <tr>
1174
- <td><em>ruleset</em></td>
1175
- <td>Reusable set of <em>tags</em> associated to <em>rule</em>s.</td>
1176
- <td style="font-size: 90%;"><tt>Imperative ruleset</tt><br/><tt>Encoding rulset</tt></td>
1177
- </tr>
1178
- <tr>
1179
- <td><em>wlang tag</em></td>
1180
- <td>Special tags in the template, starting with wlang symbols and a number of
1181
- wlang blocks. A tag is associated with a wlang rule.</td>
1182
- <td style="font-size: 90%;"><tt>${...}</tt><br/><tt>?{...}{...}{...}</tt></td>
1183
- </tr>
1184
- <tr>
1185
- <td><em>rule</em></td>
1186
- <td>Transformation semantics of a given <em>tag</em>. When wlang instantiates a
1187
- template it simply replaces <em>wlang tags</em> by some <em>replacement
1188
- value</em> (which is always a string). This value is computed by the rule
1189
- attached to the tag. Rule definition (see Rulesets tab on top of the page)
1190
- explicitly describes the number of blocks it expects, in which dialect they
1191
- are parsed and instantiated and the way the replacement value is computed.</td>
1192
- <td style="font-size: 90%;"><tt>^{wlang/active-string}{...}</tt><br/> Instantiates #1, looking for an
1193
- encoder qualified name. Instantiates #2 in the current dialect. Encode
1194
- #2&#8217;s instantiation using encoder found in (#1) and return the result
1195
- as replacement value.</td>
1196
- </tr>
1197
- <tr>
1198
- <td><em>context</em></td>
1199
- <td>Some rules allow code to be executed in the <em>hosting language</em> (the
1200
- definition explicitly announce it by putting <tt>wlang/hosted</tt> in the
1201
- corresponding block). When doing so, this code is in fact executed in a
1202
- given context that provides the execution semantics.</td>
1203
- <td style="font-size: 90%;"></td>
1204
- </tr>
1205
- <tr>
1206
- <td><em>hosting language</em></td>
1207
- <td>language (or framework) that executes wlang. More precisely, the hosting
1208
- language is the one that rules what is considered as an executable
1209
- expression in tags that relies on some execution semantics (like !{&#8230;}
1210
- for example). See the &#8216;Hosting language&#8217; section to learn more.</td>
1211
- <td style="font-size: 90%;">ruby</td>
1212
- </tr>
1291
+ </div>
1292
+
1293
+
1294
+ </div>
1295
+
1296
+
1297
+ <div class="dialect">
1298
+ <div style="margin-bottom: 20px">
1299
+ <h3 style="display: inline">wlang/dummy</h3>
1300
+
1301
+ </div>
1302
+
1303
+
1304
+ </div>
1305
+
1306
+
1307
+
1308
+ </div>
1213
1309
 
1214
- </table>
1310
+ <div id="hosting" style="display: none;">
1311
+ <div class="header">
1312
+ <h2>Hosting language</h2>
1313
+
1314
+ <div class="clear"></div>
1315
+ </div>
1316
+
1317
+
1318
+
1319
+ </div>
1215
1320
 
1321
+ <div id="glossary" style="display: none;">
1322
+ <div class="header">
1323
+ <h2>Glossary</h2>
1324
+
1325
+ <div class="clear"></div>
1326
+ </div>
1327
+
1328
+ <table class="glossary">
1329
+ <tr>
1330
+ <th class="term">term</th>
1331
+ <th class="definition">definition</th>
1332
+ <th class="example">example</th>
1333
+ </tr>
1334
+
1335
+ <tr>
1336
+ <td><em>template</em></td>
1337
+ <td>Source code respecting the wlang grammar, and attached to a given <em>wlang
1338
+ dialect</em>.</td>
1339
+ <td style="font-size: 90%;"><tt>Hello ${name}</tt></td>
1340
+ </tr>
1341
+
1342
+ <tr>
1343
+ <td><em>dialect</em></td>
1344
+ <td>Basically, <em>dialect</em> is used as a synonym for (programming)
1345
+ <em>language</em>. However <em>wlang</em> uses a tree of dialects, allowing
1346
+ specializations: <tt>sql/sybase</tt> for example is the qualified name of a
1347
+ sub-dialect &#8216;sybase&#8217; of the &#8216;sql&#8217; dialect. Dialects
1348
+ come with associated <em>encoders</em>.</td>
1349
+ <td style="font-size: 90%;"><tt>sql/sybase</tt></td>
1350
+ </tr>
1351
+
1352
+ <tr>
1353
+ <td><em>wlang dialect</em></td>
1354
+ <td>When we talk about a <em>wlang dialect</em>, we are actually refering to
1355
+ some specialization of the wlang tag-based grammar: <tt>wlang/xhtml</tt>
1356
+ for example is the templating language <em>wlang</em> proposes to generate
1357
+ xhtml pages. An example of source code in that dialect has been shown
1358
+ before. In addition to its encoders a <em>wlang dialect</em> comes with its
1359
+ sets of <em>tags</em> and associated <em>rules</em>.</td>
1360
+ <td style="font-size: 90%;"><tt>wlang/xhtml</tt></td>
1361
+ </tr>
1362
+
1363
+ <tr>
1364
+ <td><em>encoder</em></td>
1365
+ <td>Text transformation (algorithm) applying some encoding conventions of a
1366
+ portion of a the target language generated by a dialect. HTML
1367
+ entities-encoding, SQL&#8217;s back-quoting are examples of encoders.
1368
+ Encoders are accessible through their qualified name (dialect/encoder).</td>
1369
+ <td style="font-size: 90%;"><tt>xhtml/entities-encoding</tt><br/><tt>sql/single-quoting</tt></td>
1370
+ </tr>
1371
+
1372
+ <tr>
1373
+ <td><em>ruleset</em></td>
1374
+ <td>Reusable set of <em>tags</em> associated to <em>rule</em>s.</td>
1375
+ <td style="font-size: 90%;"><tt>Imperative ruleset</tt><br/><tt>Encoding rulset</tt></td>
1376
+ </tr>
1377
+
1378
+ <tr>
1379
+ <td><em>wlang tag</em></td>
1380
+ <td>Special tags in the template, starting with wlang symbols and a number of
1381
+ wlang blocks. A tag is associated with a wlang rule.</td>
1382
+ <td style="font-size: 90%;"><tt>${...}</tt><br/><tt>?{...}{...}{...}</tt></td>
1383
+ </tr>
1384
+
1385
+ <tr>
1386
+ <td><em>rule</em></td>
1387
+ <td>Transformation semantics of a given <em>tag</em>. When wlang instantiates a
1388
+ template it simply replaces <em>wlang tags</em> by some <em>replacement
1389
+ value</em> (which is always a string). This value is computed by the rule
1390
+ attached to the tag. Rule definition (see Rulesets tab on top of the page)
1391
+ explicitly describes the number of blocks it expects, in which dialect they
1392
+ are parsed and instantiated and the way the replacement value is computed.</td>
1393
+ <td style="font-size: 90%;"><tt>^{wlang/active-string}{...}</tt><br/> Instantiates #1, looking for an
1394
+ encoder qualified name. Instantiates #2 in the current dialect. Encode
1395
+ #2&#8217;s instantiation using encoder found in (#1) and return the result
1396
+ as replacement value.</td>
1397
+ </tr>
1398
+
1399
+ <tr>
1400
+ <td><em>context</em></td>
1401
+ <td>Some rules allow code to be executed in the <em>hosting language</em> (the
1402
+ definition explicitly announce it by putting <tt>wlang/hosted</tt> in the
1403
+ corresponding block). When doing so, this code is in fact executed in a
1404
+ given context that provides the execution semantics.</td>
1405
+ <td style="font-size: 90%;"></td>
1406
+ </tr>
1407
+
1408
+ <tr>
1409
+ <td><em>hosting language</em></td>
1410
+ <td>language (or framework) that executes wlang. More precisely, the hosting
1411
+ language is the one that rules what is considered as an executable
1412
+ expression in tags that relies on some execution semantics (like !{&#8230;}
1413
+ for example). See the &#8216;Hosting language&#8217; section to learn more.</td>
1414
+ <td style="font-size: 90%;">ruby</td>
1415
+ </tr>
1416
+
1417
+ </table>
1418
+
1419
+
1420
+ </div>
1216
1421
 
1217
- </div>
1218
- <div id="symbols" style="display: none;">
1219
- <div class="header">
1220
- <h2>Tag symbols</h2>
1221
-
1222
- <div class="clear"></div>
1223
- </div>
1224
- <table class="symbols">
1225
- <tr>
1226
- <th class="name">name</th>
1227
- <th class="symbol">symbol</th>
1228
- <th class="meaning">meaning</th>
1229
- <th class="remark">remark</th>
1230
- </tr>
1422
+ <div id="symbols" style="display: none;">
1423
+ <div class="header">
1424
+ <h2>Tag symbols</h2>
1425
+
1426
+ <div class="clear"></div>
1427
+ </div>
1428
+
1429
+ <table class="symbols">
1430
+ <tr>
1431
+ <th class="name">name</th>
1432
+ <th class="symbol">symbol</th>
1433
+ <th class="meaning">meaning</th>
1434
+ <th class="remark">remark</th>
1435
+ </tr>
1436
+
1231
1437
  <tr>
1232
1438
  <td><em>exclamation mark</em></td>
1233
1439
  <td>!</td>
1234
1440
  <td>execution</td>
1235
1441
  <td>should never be overrided as single</td>
1236
1442
  </tr>
1443
+
1237
1444
  <tr>
1238
1445
  <td><em>caret/circumflex</em></td>
1239
1446
  <td>^</td>
1240
1447
  <td>explicit encoding</td>
1241
1448
  <td>should never be overrided as single</td>
1242
1449
  </tr>
1450
+
1243
1451
  <tr>
1244
1452
  <td><em>percent</em></td>
1245
1453
  <td>%</td>
1246
1454
  <td>modulation</td>
1247
1455
  <td>should never be overrided as single</td>
1248
1456
  </tr>
1457
+
1249
1458
  <tr>
1250
1459
  <td><em>double quote</em></td>
1251
1460
  <td>&quot;</td>
1252
1461
  <td>double-quoting</td>
1253
1462
  <td></td>
1254
1463
  </tr>
1464
+
1255
1465
  <tr>
1256
1466
  <td><em>dollar</em></td>
1257
1467
  <td>$</td>
1258
1468
  <td>main-encoding</td>
1259
1469
  <td></td>
1260
1470
  </tr>
1471
+
1261
1472
  <tr>
1262
1473
  <td><em>ampersand</em></td>
1263
1474
  <td>&amp;</td>
1264
1475
  <td>encoding</td>
1265
1476
  <td></td>
1266
1477
  </tr>
1478
+
1267
1479
  <tr>
1268
1480
  <td><em>single quote</em></td>
1269
1481
  <td>'</td>
1270
1482
  <td>single-quoting</td>
1271
1483
  <td></td>
1272
1484
  </tr>
1485
+
1273
1486
  <tr>
1274
1487
  <td><em>asterisk</em></td>
1275
1488
  <td>*</td>
1276
1489
  <td>iteration</td>
1277
1490
  <td></td>
1278
1491
  </tr>
1492
+
1279
1493
  <tr>
1280
1494
  <td><em>plus</em></td>
1281
1495
  <td>+</td>
1282
1496
  <td>inclusion</td>
1283
1497
  <td></td>
1284
1498
  </tr>
1499
+
1285
1500
  <tr>
1286
1501
  <td><em>question mark</em></td>
1287
1502
  <td>?</td>
1288
1503
  <td>condition</td>
1289
1504
  <td></td>
1290
1505
  </tr>
1506
+
1291
1507
  <tr>
1292
1508
  <td><em>at symbol</em></td>
1293
1509
  <td>@</td>
1294
1510
  <td>linking</td>
1295
1511
  <td></td>
1296
1512
  </tr>
1513
+
1297
1514
  <tr>
1298
1515
  <td><em>tilde</em></td>
1299
1516
  <td>~</td>
1300
1517
  <td>matching</td>
1301
1518
  <td></td>
1302
1519
  </tr>
1520
+
1303
1521
  <tr>
1304
1522
  <td><em>number sign</em></td>
1305
1523
  <td>#</td>
1306
1524
  <td></td>
1307
1525
  <td></td>
1308
1526
  </tr>
1527
+
1309
1528
  <tr>
1310
1529
  <td><em>comma</em></td>
1311
1530
  <td>,</td>
1312
1531
  <td></td>
1313
1532
  <td></td>
1314
1533
  </tr>
1534
+
1315
1535
  <tr>
1316
1536
  <td><em>minus (dash)</em></td>
1317
1537
  <td>-</td>
1318
1538
  <td></td>
1319
1539
  <td></td>
1320
1540
  </tr>
1541
+
1321
1542
  <tr>
1322
1543
  <td><em>dot</em></td>
1323
1544
  <td>.</td>
1324
1545
  <td></td>
1325
1546
  <td></td>
1326
1547
  </tr>
1548
+
1327
1549
  <tr>
1328
1550
  <td><em>forward slash</em></td>
1329
1551
  <td>/</td>
1330
1552
  <td></td>
1331
1553
  <td></td>
1332
1554
  </tr>
1555
+
1333
1556
  <tr>
1334
1557
  <td><em>colon</em></td>
1335
1558
  <td>:</td>
1336
1559
  <td></td>
1337
1560
  <td></td>
1338
1561
  </tr>
1562
+
1339
1563
  <tr>
1340
1564
  <td><em>semi-colon</em></td>
1341
1565
  <td>;</td>
1342
1566
  <td></td>
1343
1567
  <td></td>
1344
1568
  </tr>
1569
+
1345
1570
  <tr>
1346
1571
  <td><em>equal sign</em></td>
1347
1572
  <td>=</td>
1348
1573
  <td></td>
1349
1574
  <td></td>
1350
1575
  </tr>
1576
+
1351
1577
  <tr>
1352
1578
  <td><em>less than</em></td>
1353
1579
  <td>&lt;</td>
1354
1580
  <td></td>
1355
1581
  <td></td>
1356
1582
  </tr>
1583
+
1357
1584
  <tr>
1358
1585
  <td><em>greater than</em></td>
1359
1586
  <td>&gt;</td>
1360
1587
  <td></td>
1361
1588
  <td></td>
1362
1589
  </tr>
1590
+
1363
1591
  <tr>
1364
1592
  <td><em>vertical bar</em></td>
1365
1593
  <td>|</td>
1366
1594
  <td></td>
1367
1595
  <td></td>
1368
1596
  </tr>
1597
+
1369
1598
  <tr>
1370
1599
  <td><em>underscore</em></td>
1371
1600
  <td>_</td>
1372
1601
  <td></td>
1373
1602
  <td>cannot be used as tag symbol; reserved for escaping in future versions</td>
1374
1603
  </tr>
1604
+
1375
1605
  <tr>
1376
1606
  <td><em>back slash</em></td>
1377
1607
  <td>\</td>
1378
1608
  <td></td>
1379
1609
  <td>cannot be used as tag symbol; reserved for escaping in current version</td>
1380
1610
  </tr>
1611
+
1381
1612
  <tr>
1382
1613
  <td><em>left parenthesis</em></td>
1383
1614
  <td>(</td>
1384
1615
  <td></td>
1385
1616
  <td>cannot be used as tag symbol; reserved for block delimiter</td>
1386
1617
  </tr>
1618
+
1387
1619
  <tr>
1388
1620
  <td><em>right parenthesis</em></td>
1389
1621
  <td>)</td>
1390
1622
  <td></td>
1391
1623
  <td>cannot be used as tag symbol; reserved for block delimiter</td>
1392
1624
  </tr>
1625
+
1393
1626
  <tr>
1394
1627
  <td><em>left bracket</em></td>
1395
1628
  <td>[</td>
1396
1629
  <td></td>
1397
1630
  <td>cannot be used as tag symbol; reserved for block delimiter</td>
1398
1631
  </tr>
1632
+
1399
1633
  <tr>
1400
1634
  <td><em>right bracket</em></td>
1401
1635
  <td>]</td>
1402
1636
  <td></td>
1403
1637
  <td>cannot be used as tag symbol; reserved for block delimiter</td>
1404
1638
  </tr>
1639
+
1405
1640
  <tr>
1406
1641
  <td><em>left brace</em></td>
1407
1642
  <td>{</td>
1408
1643
  <td></td>
1409
1644
  <td>cannot be used as tag symbol; reserved for block delimiter</td>
1410
1645
  </tr>
1646
+
1411
1647
  <tr>
1412
1648
  <td><em>right brace</em></td>
1413
1649
  <td>}</td>
1414
1650
  <td></td>
1415
1651
  <td>cannot be used as tag symbol; reserved for block delimiter</td>
1416
1652
  </tr>
1417
-
1418
- </table>
1419
-
1420
-
1421
- </div>
1653
+
1654
+ </table>
1422
1655
 
1656
+
1657
+ </div>
1658
+
1423
1659
  </body>
1424
1660
  </html>