wlang 0.10.2 → 2.0.0.beta

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