glyph 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/.gitignore +7 -0
  2. data/AUTHORS.textile +8 -7
  3. data/CHANGELOG.textile +89 -8
  4. data/LICENSE.textile +1 -2
  5. data/README.textile +89 -61
  6. data/Rakefile +12 -10
  7. data/VERSION +1 -1
  8. data/benchmark.rb +1 -1
  9. data/book/config.yml +18 -4
  10. data/book/document.glyph +269 -45
  11. data/book/images/glyph/commands_tasks.png +0 -0
  12. data/book/images/{document_generation.png → glyph/document_generation.png} +0 -0
  13. data/book/images/glyph/glyph.eps +123 -0
  14. data/book/images/glyph/glyph.png +0 -0
  15. data/book/images/glyph/glyph.svg +29 -0
  16. data/book/lib/commands/commands.rb +11 -0
  17. data/book/lib/layouts/bookindex.glyph +127 -0
  18. data/book/lib/layouts/bookpage.glyph +129 -0
  19. data/book/lib/layouts/project.glyph +26 -0
  20. data/book/lib/macros/reference.rb +27 -7
  21. data/book/lib/tasks/tasks.rake +52 -0
  22. data/book/snippets.yml +1 -1
  23. data/book/text/{acknowledgement.glyph → acknowledgements.glyph} +4 -2
  24. data/book/text/changelog.glyph +29 -3
  25. data/book/text/compiling/compiling.glyph +44 -20
  26. data/book/text/compiling/lite_mode.glyph +0 -4
  27. data/book/text/compiling/programmatic_usage.glyph +1 -5
  28. data/book/text/config/document.glyph +35 -0
  29. data/book/text/config/filters.glyph +28 -0
  30. data/book/text/config/options.glyph +25 -0
  31. data/book/text/config/output.glyph +83 -0
  32. data/book/text/extending/bookmarks_headers.glyph +0 -5
  33. data/book/text/extending/command.glyph +56 -0
  34. data/book/text/extending/commands_tasks.glyph +39 -0
  35. data/book/text/extending/further_reading.glyph +0 -3
  36. data/book/text/extending/internals.glyph +3 -5
  37. data/book/text/extending/interpreting.glyph +0 -4
  38. data/book/text/extending/layouts.glyph +68 -0
  39. data/book/text/extending/macro_def.glyph +0 -5
  40. data/book/text/extending/output_format.glyph +78 -0
  41. data/book/text/extending/params_attrs.glyph +0 -3
  42. data/book/text/extending/placeholders.glyph +0 -4
  43. data/book/text/extending/task.glyph +46 -0
  44. data/book/text/extending/validators.glyph +5 -6
  45. data/book/text/getting_started/configuration.glyph +1 -5
  46. data/book/text/getting_started/create_project.glyph +1 -5
  47. data/book/text/getting_started/structure.glyph +0 -4
  48. data/book/text/introduction.glyph +100 -75
  49. data/book/text/license.glyph +1 -2
  50. data/book/text/macros/macros_block.glyph +8 -4
  51. data/book/text/macros/macros_core.glyph +0 -3
  52. data/book/text/macros/macros_filters.glyph +2 -7
  53. data/book/text/macros/macros_inline.glyph +0 -4
  54. data/book/text/macros/macros_structure.glyph +0 -4
  55. data/book/text/ref_commands.glyph +29 -7
  56. data/book/text/stats/bookmarks.glyph +49 -0
  57. data/book/text/stats/links.glyph +90 -0
  58. data/book/text/stats/macros.glyph +73 -0
  59. data/book/text/stats/snippets.glyph +50 -0
  60. data/book/text/stats/stats.glyph +79 -0
  61. data/book/text/text_editing/attribute_intro.glyph +22 -0
  62. data/book/text/text_editing/code.glyph +0 -5
  63. data/book/text/text_editing/conditionals.glyph +0 -4
  64. data/book/text/text_editing/esc_quot.glyph +64 -0
  65. data/book/text/text_editing/evaluation.glyph +0 -3
  66. data/book/text/text_editing/glyph_files.glyph +0 -3
  67. data/book/text/text_editing/images.glyph +0 -5
  68. data/book/text/text_editing/inclusions.glyph +0 -4
  69. data/book/text/text_editing/links.glyph +2 -7
  70. data/book/text/text_editing/macro_intro.glyph +1 -98
  71. data/book/text/text_editing/raw_html.glyph +0 -87
  72. data/book/text/text_editing/section_aliases.glyph +28 -0
  73. data/book/text/text_editing/sections.glyph +1 -32
  74. data/book/text/text_editing/stylesheets.glyph +3 -5
  75. data/book/text/text_editing/topics.glyph +33 -0
  76. data/book/text/text_editing/xml_fallback.glyph +73 -0
  77. data/book/text/troubleshooting/errors_command.glyph +0 -3
  78. data/book/text/troubleshooting/errors_generic.glyph +21 -6
  79. data/book/text/troubleshooting/errors_macro.glyph +11 -8
  80. data/book/text/troubleshooting/errors_parser.glyph +0 -3
  81. data/config.yml +60 -25
  82. data/glyph.gemspec +90 -36
  83. data/layouts/web/index.glyph +16 -0
  84. data/layouts/web/topic.glyph +15 -0
  85. data/layouts/web5/index.glyph +16 -0
  86. data/layouts/web5/topic.glyph +17 -0
  87. data/lib/glyph.rb +36 -49
  88. data/lib/glyph/analyzer.rb +253 -0
  89. data/lib/glyph/bookmark.rb +92 -0
  90. data/lib/glyph/commands.rb +9 -221
  91. data/lib/glyph/commands/add.rb +8 -0
  92. data/lib/glyph/commands/compile.rb +93 -0
  93. data/lib/glyph/commands/config.rb +38 -0
  94. data/lib/glyph/commands/init.rb +6 -0
  95. data/lib/glyph/commands/outline.rb +45 -0
  96. data/lib/glyph/commands/stats.rb +48 -0
  97. data/lib/glyph/commands/todo.rb +29 -0
  98. data/lib/glyph/config.rb +2 -0
  99. data/lib/glyph/document.rb +61 -30
  100. data/lib/glyph/interpreter.rb +2 -2
  101. data/lib/glyph/macro.rb +14 -5
  102. data/lib/glyph/macro_helpers.rb +280 -0
  103. data/lib/glyph/macro_validators.rb +37 -2
  104. data/lib/glyph/reporter.rb +182 -0
  105. data/lib/glyph/syntax_node.rb +37 -10
  106. data/lib/glyph/system_extensions.rb +8 -45
  107. data/lib/glyph/utils.rb +148 -0
  108. data/macros/core.rb +10 -15
  109. data/macros/filters.rb +4 -5
  110. data/macros/html/block.rb +46 -30
  111. data/macros/html/inline.rb +9 -35
  112. data/macros/html/structure.rb +59 -72
  113. data/macros/html5/block.rb +69 -0
  114. data/macros/html5/inline.rb +24 -0
  115. data/macros/html5/structure.rb +139 -0
  116. data/macros/xml.rb +1 -1
  117. data/spec/files/custom_command.rb +6 -0
  118. data/spec/files/custom_tasks.rake +6 -0
  119. data/spec/files/document_for_stats.glyph +12 -0
  120. data/spec/files/references.glyph +4 -0
  121. data/spec/files/web1.glyph +11 -0
  122. data/spec/files/web2.glyph +10 -0
  123. data/spec/files/web_doc.glyph +23 -0
  124. data/spec/lib/analyzer_spec.rb +137 -0
  125. data/spec/lib/bookmark_spec.rb +64 -0
  126. data/spec/lib/commands_spec.rb +30 -5
  127. data/spec/lib/document_spec.rb +49 -9
  128. data/spec/lib/glyph_spec.rb +21 -1
  129. data/spec/lib/macro_spec.rb +6 -6
  130. data/spec/lib/macro_validators_spec.rb +24 -0
  131. data/spec/lib/reporter_spec.rb +132 -0
  132. data/spec/macros/core_spec.rb +2 -3
  133. data/spec/macros/filters_spec.rb +2 -2
  134. data/spec/macros/html5_spec.rb +101 -0
  135. data/spec/macros/macros_spec.rb +16 -6
  136. data/spec/macros/web5_spec.rb +32 -0
  137. data/spec/macros/web_spec.rb +59 -0
  138. data/spec/macros/xml_spec.rb +1 -1
  139. data/spec/spec_helper.rb +24 -4
  140. data/spec/tasks/generate_spec.rb +54 -0
  141. data/spec/tasks/load_spec.rb +29 -3
  142. data/spec/tasks/project_spec.rb +21 -3
  143. data/styles/default.css +40 -4
  144. data/styles/pagination.css +59 -41
  145. data/tasks/generate.rake +110 -31
  146. data/tasks/load.rake +39 -7
  147. data/tasks/project.rake +9 -7
  148. metadata +115 -34
  149. data/book/images/glyph.png +0 -0
  150. data/book/images/glyph.svg +0 -351
  151. data/book/output/html/glyph.html +0 -4482
  152. data/book/output/html/images/document_generation.png +0 -0
  153. data/book/output/html/images/glyph.png +0 -0
  154. data/book/output/html/images/glyph.svg +0 -351
  155. data/book/output/pdf/glyph.pdf +4 -10254
  156. data/book/script/authors +0 -1
  157. data/book/script/changelog +0 -1
  158. data/book/script/license +0 -1
  159. data/book/script/readme +0 -1
  160. data/book/text/ref_config.glyph +0 -100
  161. data/book/text/ref_macros.glyph +0 -6
  162. data/book/text/troubleshooting/errors_intro.glyph +0 -3
@@ -0,0 +1,79 @@
1
+ rewrite:[stats_for|
2
+ section[
3
+ @title[Displaying stats about {{title}}]
4
+ txt[To display statistics about {{object}}, execute code[glyph stats {{command}}]. Glyph displays something like this:]
5
+ highlight[=html|
6
+ {{example}}
7
+ =]
8
+ section[
9
+ @title[Remarks]
10
+ txt[
11
+ {{remarks}}
12
+ ]
13
+ ]
14
+ ]
15
+ ]
16
+ p[Glyph includes a #>[stats] that can be used to display useful statistics about your Glyph project. If you try running Glyph's command help, you'll see that this command can take quite a few options:
17
+ ]
18
+ highlight[html|
19
+ $ glyph help stats
20
+ =====================================
21
+ Glyph v\.%[Glyph::VERSION]
22
+ =====================================
23
+ stats \[options\]
24
+ Display statistics
25
+
26
+ Options:
27
+ -b, --bookmarks - Display stats about bookmarks
28
+ --bookmark=arg - Display stats about a single bookmark
29
+ -f, --files - Display stats about project files
30
+ -l, --links - Display stats about links
31
+ --link=arg - Display stats about links matching a regular expression
32
+ -m, --macros - Display stats about macros
33
+ --macro=arg - Display stats about a single macro
34
+ -s, --snippets - Display stats about snippets
35
+ --snippet=arg - Display stats about a single snippet
36
+ ]
37
+ txt[
38
+ If no options are specified, the command returns a summary containing different element totals, i.e.:
39
+ * The files used in the project
40
+ * Macro definitions and instances
41
+ * Snippets
42
+ * Bookmarks
43
+ * Links and references
44
+
45
+ Example:
46
+ ]
47
+ highlight[=html|
48
+ =====================================
49
+ Glyph - Statistics
50
+ =====================================
51
+
52
+ ===== Files
53
+ -- Total Files: 50
54
+ -- /text -- 46
55
+ -- /images -- 3
56
+ -- /styles -- 0
57
+ -- /layouts -- 0
58
+ -- /lib -- 1
59
+
60
+ ===== Macros
61
+ -- Total Macro Instances: 2950
62
+ -- Total Macro Definitions: 22
63
+ -- Total Macro Aliases: 57
64
+ -- Total Used Macro Definitions: 60
65
+
66
+ ===== Snippets
67
+ -- Total Snippets: 21
68
+ -- Total Used Snippets: 21
69
+ -- Total Unused Snippets: 0
70
+
71
+ ===== Bookmarks
72
+ -- Total Bookmarks: 221
73
+ -- Total Referenced Bookmarks: 87
74
+ -- Total Unreferenced Bookmarks: 135
75
+
76
+ ===== Links
77
+ -- Total Internal Links: 87
78
+ -- Total External Links: 97
79
+ =]
@@ -0,0 +1,22 @@
1
+ txt[
2
+ Although a macro can take any number of parameters, they are often no more than two or three, for readibility reasons: parameters have no name, but their position within a macro is significant.
3
+
4
+ If you have something like this:
5
+ ]
6
+
7
+ highlight[=html|custom_image[test.png\|50%\|50%\|Test Image]=]
8
+ txt[
9
+ it may still be easy enough to understand what each parameter is used for, but:
10
+ * you can easily forget that the third parameter is the image width
11
+ * if you don't want to resize the image, you still have to pass _empty parameters_ to the macro, like this: code[=custom_image[test2.png\|\|\|Test Image]=]
12
+
13
+ To avoid these situations, some macros which would normally take three or four parameters take optional attributes instead, so you can write:
14
+ ]
15
+ highlight[=html|
16
+ image[test.png
17
+ @width[50%]
18
+ @alt[Test Image]
19
+ @height[50%]
20
+ ]=]
21
+ p[More verbose, of course, but definitely more readable. In this way, if you won't want to scale an image, you can safely omit the code[@width] and code[@height] attributes.]
22
+ note[Like parameters, attributes can contain other macros, too.]
@@ -1,6 +1,3 @@
1
- section[
2
- @title[Source Code]
3
- @id[source_code]
4
1
  txt[
5
2
  If you're a programmer, chances are that you're going to include some source code in your articles and books. Glyph offers two ways to format code blocks effortlessly: the %>[codeblock], which simply wraps text into @<pre>@ and @<code>@ tags, or the %>[highlight]. The last one requires either &[coderay] or &[uv], but it provides syntax highlighting for the most common programming languages.
6
3
 
@@ -47,5 +44,3 @@ end
47
44
  * You must always escape pipes (@\|@) with the code or the highlight macro.
48
45
  ]
49
46
  ]
50
- ]
51
-
@@ -1,6 +1,3 @@
1
- section[
2
- @title[Conditional Macros]
3
- @id[cond_macros]
4
1
  txt[
5
2
  Sometimes you may want text to be included in a document only if certain conditions are satisfied. For example, you may want to display a disclaimer section only if the document is a draft (see the $>[document.draft]), or use a particular stylesheet only if when you generate a PDF document.
6
3
 
@@ -46,4 +43,3 @@ The %>[condition] in Glyph works in a similar way as conditionals in programming
46
43
  * A conditional expression is not satisfied if it evaluates to an empty string or the string "false".
47
44
  ]
48
45
  ]
49
- ]
@@ -0,0 +1,64 @@
1
+ txt[
2
+ Glyph doesn't require any special control characters like LaTeX, and its macro syntax is very straightforward and liberal. This however comes with a price: because square brackets are used as delimiters, you must escape any square bracket in your text with a backslash. That's not _too_ bad if you think about it, unless you're writing programming code, in which case escaping every single square bracket can be painful.
3
+
4
+ If a portion of your text contains an excessive amount of square brackets, you may consider using the %>[escape] (or its alias @.@) with the @\[=@ and @=\]@ delimiters. By itself, the escape macro doesn't do anything: it just evaluates to its contents, but the special delimiters act as an escape for any square bracket within them. As a consequence, any macro within @\[=@ and @=\]@ will _not_ be evaluated.
5
+
6
+ You can use the quoting delimiters with _any_ macro identifier. Obviously, using them as delimiters for things like %>[section]s may not be a good idea, but they should be more or less mandatory with the %>[codeblock] or the %>[highlight], especially when it contains square brackets or even Glyph code, like this:
7
+ ]
8
+
9
+ highlight[=html|
10
+ codeblock\[=
11
+ section[
12
+ @title[A section]
13
+ @id[test]
14
+ This is a section.
15
+ section[
16
+ @title[A nested section]
17
+ This is another section.
18
+ ]
19
+ ]
20
+ \=]
21
+ =]
22
+
23
+ note[Although quoting delimiters allow you to use square brackets without escaping them, you must still escape them if you want to escape quoting delimiters themselves.]
24
+
25
+ p[Besides square brackets, there are other characters that must or can be escaped with backslashes, as shown in the following table:]
26
+
27
+ table[
28
+ tr[
29
+ th[Escape Sequence]
30
+ th[Evaluates to...]
31
+ th[Notes]
32
+ ]
33
+ tr[
34
+ td[code[\\\.\[]]
35
+ td[code[\[]]
36
+ td[&[sq_esc]]
37
+ ]
38
+ tr[
39
+ td[code[\\\.\]]]
40
+ td[code[\]]]
41
+ td[&[sq_esc]]
42
+ ]
43
+ tr[
44
+ td[code[\\\\]]
45
+ td[code[\\]]
46
+ td[Backslashes do not have to be escaped by default, but an escaped backslash will evaluate to itself.]
47
+ ]
48
+ tr[
49
+ td[code[\\\.\=]]
50
+ td[code[\.=]]
51
+ td[Equal signs do not have to be escaped by default, but an escaped equal sign will evaluate to iself.]
52
+ ]
53
+ tr[
54
+ td[code[\\\.\|]]
55
+ td[code[\|]]
56
+ td[Pipes must be escaped (even within quoting macros) unless they are used to separate macro parameters.]
57
+ ]
58
+ tr[
59
+ td[code[\\\..]]
60
+ td[]
61
+ td[An escaped dot evaluates to nothing. Useful to separate macro identifiers from other characters: br[]code[=_\\\\..=>[#link\|This link is emphasized using Textile]_ =]
62
+ ]
63
+ ]
64
+ ]
@@ -1,5 +1,3 @@
1
- section[
2
- @title[Evaluating Ruby code and Configuration Settings]
3
1
  txt[
4
2
  &[glang] is not a full-blown programming language and it is currently not Turing-complete (it does not provide loops). However, it is possible to evaluate simple ruby code snippets using the @ruby@ macro (aliased to @%@), like this:
5
3
  * code[=%[2 + 2]=] &rarr; 4
@@ -10,4 +8,3 @@ The scope for the code evaluation is the Kernel module, (with all inclusions req
10
8
 
11
9
  Although it is possible to retrieve Glyph configuration settings in this way (e.g. code[=%[cfg('document.author')]=]), the %>[config] (aliased to @$@) makes things slightly simpler (e.g. code[=$[document.author]=]).
12
10
  ]
13
- ]
@@ -1,7 +1,4 @@
1
- section[
2
- @title[.glyph files]
3
1
  txt[
4
2
  The @text@ folder of any Glyph folder contains all the text source files used to produce a document. Although there are no restrictions on the extension of the files in this folder, you may want to use @.glyph@, especially if =>[http://www.vim.org|Vim] is your favorite text editor.
5
3
  The reason is simple: a Glyph syntax file is =>[http://www.vim.org/scripts/script.php?script_id=3086|available on vim.org]. Although not essential, syntax highlighting does help when editing Glyph files.
6
4
  ]
7
- ]
@@ -1,6 +1,3 @@
1
- section[
2
- @title[Images and Figures]
3
- @id[img_fig]
4
1
  p[Same as for =>[#links|links], you can also include images and figures using &[markups]. If you want additional features, you can use the %>[image] and the %>[figure], as shown in the following example:]
5
2
 
6
3
  box[Example|
@@ -25,5 +22,3 @@ figure[example.png\|An example figure.
25
22
  txt[Any attribute passed to the %>[image] or the %>[figure] is automatically passed to the underlying @<img>@ tag.]
26
23
  ]
27
24
  note[In future releases, figures will be numbered automatically and included in a em[List of Figures] section.]
28
- ]
29
-
@@ -1,6 +1,3 @@
1
- section[
2
- @title[Including Files and Snippets]
3
- @id[incl]
4
1
  txt[
5
2
  If you're authoring a user manual, a long article, or a book, writing everything inside a single @document.glyph@ file may not be optimal. For this reason, Glyph provides an %>[include] that can be used to include the contents of any file within the @text/@ directory:
6
3
 
@@ -41,4 +38,3 @@ tip[Besides storing snippets in the @snippets.yml@ file, you can also define the
41
38
  tip[
42
39
  Snippets (or any other macro) can be nested within other snippets. Glyph takes care of checking if you nested snippets or macros mutually and warns you as necessary.
43
40
  ]
44
- ]
@@ -1,6 +1,3 @@
1
- section[
2
- @title[Links and Bookmarks]
3
- @id[links]
4
1
  txt[
5
2
  Lightweight markups let you create internal and external links in a very easy way, and you can still do so in Glyph. However, if you do so:
6
3
  * you can't check if they are valid
@@ -47,7 +44,5 @@ section[
47
44
  ...
48
45
  ]
49
46
  =]
50
- note[
51
- At present, link validation and automatic title retrieval only works with internal links (i.e. the check occurs if the first parameter of the %>[link] starts with a code[#]). In the future, the macro could be extended to support external (http) links as well.
52
- ]
53
- ]
47
+ p[By default, validation is only enabled for internal links (i.e. the check occurs if the first parameter of the %>[link] starts with a code[#]). You can enable it for external links as well by setting the $>[options.url_validation] to code[true]. If URL validation is enabled, an error is returned if a link returns an HTTP status greater than 302.]
48
+ important[Enabling URL validation may significantly slow down compilation if a lot of external links are present.]
@@ -1,6 +1,4 @@
1
- section[
2
- @title[Introducing &[macros]]
3
- @id[macro_intro]
1
+
4
2
  txt[
5
3
  The most important concept to grasp about Glyph is the concept of _macro_.
6
4
 
@@ -14,98 +12,3 @@ A macro can often have one or more aliases. For example, @=>@ is an alias for th
14
12
  * code[=\.=>[#test\|Test Section]=]
15
13
  * code[=\.link[#test\|Test Section]=]
16
14
  ]
17
- ]
18
- section[
19
- @title[Macro attributes]
20
- @id[attribute_intro]
21
- txt[
22
- Although a macro can take any number of parameters, they are often no more than two or three, for readibility reasons: parameters have no name, but their position within a macro is significant.
23
-
24
- If you have something like this:
25
- ]
26
-
27
- highlight[=html|custom_image[test.png\|50%\|50%\|Test Image]=]
28
- txt[
29
- it may still be easy enough to understand what each parameter is used for, but:
30
- * you can easily forget that the third parameter is the image width
31
- * if you don't want to resize the image, you still have to pass _empty parameters_ to the macro, like this: code[=custom_image[test2.png\|\|\|Test Image]=]
32
-
33
- To avoid these situations, some macros which would normally take three or four parameters take optional attributes instead, so you can write:
34
- ]
35
- highlight[=html|
36
- image[test.png
37
- @width[50%]
38
- @alt[Test Image]
39
- @height[50%]
40
- ]=]
41
- p[More verbose, of course, but definitely more readable. In this way, if you won't want to scale an image, you can safely omit the code[@width] and code[@height] attributes.]
42
- note[Like parameters, attributes can contain other macros, too.]
43
- ]
44
- section[
45
- @title[Escaping and Quoting]
46
- @id[esc_quot]
47
- txt[
48
- Glyph doesn't require any special control characters like LaTeX, and its macro syntax is very straightforward and liberal. This however comes with a price: because square brackets are used as delimiters, you must escape any square bracket in your text with a backslash. That's not _too_ bad if you think about it, unless you're writing programming code, in which case escaping every single square bracket can be painful.
49
-
50
- If a portion of your text contains an excessive amount of square brackets, you may consider using the %>[escape] (or its alias @.@) with the @\[=@ and @=\]@ delimiters. By itself, the escape macro doesn't do anything: it just evaluates to its contents, but the special delimiters act as an escape for any square bracket within them. As a consequence, any macro within @\[=@ and @=\]@ will _not_ be evaluated.
51
-
52
- You can use the quoting delimiters with _any_ macro identifier. Obviously, using them as delimiters for things like %>[section]s may not be a good idea, but they should be more or less mandatory with the %>[codeblock] or the %>[highlight], especially when it contains square brackets or even Glyph code, like this:
53
- ]
54
-
55
- highlight[=html|
56
- codeblock\[=
57
- section[
58
- @title[A section]
59
- @id[test]
60
- This is a section.
61
- section[
62
- @title[A nested section]
63
- This is another section.
64
- ]
65
- ]
66
- \=]
67
- =]
68
-
69
- note[Although quoting delimiters allow you to use square brackets without escaping them, you must still escape them if you want to escape quoting delimiters themselves.]
70
-
71
- p[Besides square brackets, there are other characters that must or can be escaped with backslashes, as shown in the following table:]
72
-
73
- table[
74
- tr[
75
- th[Escape Sequence]
76
- th[Evaluates to...]
77
- th[Notes]
78
- ]
79
- tr[
80
- td[code[\\\.\[]]
81
- td[code[\[]]
82
- td[&[sq_esc]]
83
- ]
84
- tr[
85
- td[code[\\\.\]]]
86
- td[code[\]]]
87
- td[&[sq_esc]]
88
- ]
89
- tr[
90
- td[code[\\\\]]
91
- td[code[\\]]
92
- td[Backslashes do not have to be escaped by default, but an escaped backslash will evaluate to itself.]
93
- ]
94
- tr[
95
- td[code[\\\.\=]]
96
- td[code[\.=]]
97
- td[Equal signs do not have to be escaped by default, but an escaped equal sign will evaluate to iself.]
98
- ]
99
- tr[
100
- td[code[\\\.\|]]
101
- td[code[\|]]
102
- td[Pipes must be escaped (even within quoting macros) unless they are used to separate macro parameters.]
103
- ]
104
- tr[
105
- td[code[\\\..]]
106
- td[]
107
- td[An escaped dot evaluates to nothing. Useful to separate macro identifiers from other characters: br[]code[=_\\\\..=>[#link\|This link is emphasized using Textile]_ =]
108
- ]
109
- ]
110
- ]
111
- ]
@@ -1,12 +1,3 @@
1
- section[
2
- txt[So far we examined how to create @<div>@ tags for sections, links, images... but what about lists, tables or paragraphs? How is it possible to create them using Glyphs? You have two possibilities (besides using raw HTML code, that is):
3
- * use a lightweight markup supported by Glyph (currently &[markups])
4
- * rely Glyph's _XML fallback_ feature
5
- ]
6
- @title[Other HTML Elements]
7
- @id[other_elements]
8
- section[
9
- @title[&[markups]]
10
1
  p[&[markups] are very easy and intuitive to use, and they can produce HTML markup with almost no effort. Using them with Glyph is as simple as using the %>[textile] (aliased to code[txt]) and the %>[markdown] (aliased to code[md]).]
11
2
  box[Example|
12
3
  p[The following Glyph code:]
@@ -32,81 +23,3 @@ This is another paragraph with some -deleted- text.
32
23
  =]
33
24
  ]
34
25
  important[Be careful when using block-level HTML with Textile and Markdown: sometimes it may be necessary to add extra empty lines or escape tags.]
35
- ]
36
- section[
37
- @title[XML Fallback]
38
- p[Sure Textile and Markdown are great, but sometimes you may want to just use HTML, without the extra verbosity, of course. Take tables for example: Textile offers an easy way to create them, but things may get dirty when you need to have multiple paragraphs or lists within cells.]
39
- p[Very early versions of Glyph used to offered some simple code[table], code[tr], code[tr], code[td] macros just for that. Of course the problem was that thy didn't offer any way to customize the markup by adding, for example, CSS classes.]
40
- p[Instead, by default, Glyph can convert any unrecognized macro to the corresponding XML element and macro attributes to XML attributes.]
41
- box[Example|
42
- p[&[gcode]]
43
- highlight[=html|
44
- table[@class[features]
45
- tr[
46
- th[ID]
47
- th[Priority]
48
- th[Description]
49
- ]
50
- tr[
51
- td[27]
52
- td[span[@style[color:red;font-weight:bold;] HIGH]]
53
- td[HTML output]
54
- ]
55
- tr[
56
- td[42]
57
- td[span[@style[color:green;font-weight:bols;] LOW]]
58
- td[
59
- p[Support for less-used tags:]
60
- ul[
61
- li[cite]
62
- li[sup]
63
- li[...]
64
- ]
65
- ]
66
- ]
67
- ]
68
- =]
69
- p[&[htmlcode]]
70
- highlight[=html|
71
- <table class="features">
72
- <tr>
73
- <th>ID</th>
74
- <th>Priority</th>
75
- <th>Description</th>
76
- </tr>
77
- <tr>
78
- <td>27</td>
79
- <td><span style="color:red;font-weight:bold;">HIGH</span></td>
80
- <td>HTML output</td>
81
- </tr>
82
- <tr>
83
- <td>42</td>
84
- <td><span style="color:green;font-weight:bold;">LOW</span></td>
85
- <td>
86
- <p>Support for less-used tags:</p>
87
- <ul>
88
- <li>cite</li>
89
- <li>sup</li>
90
- <li>...</li>
91
- </ul>
92
- </td>
93
- </tr>
94
- </table>
95
- =]
96
- ]
97
- p[Basically, if the $>[language.options.xml_fallback] is set to code[true], any macro unknown to Glyph with at most one parameter will be converted to an XML tag with the same name and any attribute will be converted to the corresponding XML attribute.]
98
- important[While macro names and attributes are validated so that an error is returned if they contain illegal character, no check is performed against any particular XML schema.]
99
- txt[Additionally, it is possible to force macro-to-XML conversion by prepending an equal sign to any macro, so for example code[=\.=snippet[test]=] will be converted into @<snippet>test</snippet>@.]
100
- ]
101
- section[
102
- @title[Blacklisted XML tags]
103
- @id[xml_blacklist]
104
- txt[
105
- By default, the following tags are blacklisted and will be ignored:
106
- %[="* "+Glyph['language.options.xml_blacklist'].join("\n* ")=]
107
-
108
- tip[You can change this list by modifying the $>[language.options.xml_blacklist].]
109
- ]
110
-
111
- ]
112
- ]