glyph 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. data/AUTHORS.textile +1 -1
  2. data/CHANGELOG.textile +119 -222
  3. data/LICENSE.textile +1 -1
  4. data/README.textile +42 -23
  5. data/Rakefile +1 -3
  6. data/VERSION +1 -1
  7. data/benchmark.rb +72 -0
  8. data/book/config.yml +4 -4
  9. data/book/document.glyph +90 -57
  10. data/book/images/document_generation.png +0 -0
  11. data/book/lib/macros/reference.rb +75 -22
  12. data/book/output/html/glyph.html +3183 -2121
  13. data/book/output/html/images/document_generation.png +0 -0
  14. data/book/output/pdf/glyph.pdf +7370 -4913
  15. data/book/resources/document_generation.txt +34 -0
  16. data/book/snippets.yml +6 -0
  17. data/book/text/changelog.glyph +45 -34
  18. data/book/text/compiling/compiling.glyph +23 -0
  19. data/book/text/compiling/lite_mode.glyph +23 -0
  20. data/book/text/compiling/programmatic_usage.glyph +77 -0
  21. data/book/text/extending/bookmarks_headers.glyph +21 -0
  22. data/book/text/extending/further_reading.glyph +13 -0
  23. data/book/text/extending/internals.glyph +79 -0
  24. data/book/text/extending/interpreting.glyph +51 -0
  25. data/book/text/extending/macro_def.glyph +64 -0
  26. data/book/text/extending/params_attrs.glyph +70 -0
  27. data/book/text/extending/placeholders.glyph +34 -0
  28. data/book/text/extending/validators.glyph +16 -0
  29. data/book/text/getting_started/configuration.glyph +49 -0
  30. data/book/text/getting_started/create_project.glyph +41 -0
  31. data/book/text/getting_started/structure.glyph +55 -0
  32. data/book/text/introduction.glyph +49 -26
  33. data/book/text/license.glyph +1 -1
  34. data/book/text/macros/macros_block.glyph +99 -0
  35. data/book/text/macros/macros_core.glyph +208 -0
  36. data/book/text/macros/macros_filters.glyph +40 -0
  37. data/book/text/macros/macros_inline.glyph +50 -0
  38. data/book/text/macros/macros_structure.glyph +100 -0
  39. data/book/text/ref_commands.glyph +94 -73
  40. data/book/text/ref_config.glyph +34 -42
  41. data/book/text/ref_macros.glyph +1 -373
  42. data/book/text/text_editing/code.glyph +51 -0
  43. data/book/text/text_editing/conditionals.glyph +49 -0
  44. data/book/text/text_editing/evaluation.glyph +13 -0
  45. data/book/text/text_editing/glyph_files.glyph +7 -0
  46. data/book/text/text_editing/images.glyph +29 -0
  47. data/book/text/text_editing/inclusions.glyph +44 -0
  48. data/book/text/text_editing/links.glyph +53 -0
  49. data/book/text/text_editing/macro_intro.glyph +111 -0
  50. data/book/text/text_editing/raw_html.glyph +112 -0
  51. data/book/text/text_editing/sections.glyph +63 -0
  52. data/book/text/text_editing/stylesheets.glyph +36 -0
  53. data/book/text/troubleshooting/errors_command.glyph +39 -0
  54. data/book/text/troubleshooting/errors_generic.glyph +29 -0
  55. data/book/text/troubleshooting/errors_intro.glyph +3 -0
  56. data/book/text/troubleshooting/errors_macro.glyph +98 -0
  57. data/book/text/troubleshooting/errors_parser.glyph +29 -0
  58. data/config.yml +77 -58
  59. data/document.glyph +25 -25
  60. data/glyph.gemspec +57 -22
  61. data/lib/glyph.rb +54 -13
  62. data/lib/glyph/commands.rb +84 -17
  63. data/lib/glyph/config.rb +3 -3
  64. data/lib/glyph/document.rb +14 -8
  65. data/lib/glyph/interpreter.rb +18 -58
  66. data/lib/glyph/macro.rb +160 -55
  67. data/lib/glyph/macro_validators.rb +104 -12
  68. data/lib/glyph/node.rb +24 -0
  69. data/lib/glyph/parser.rb +278 -0
  70. data/lib/glyph/syntax_node.rb +225 -0
  71. data/macros/core.rb +212 -0
  72. data/macros/filters.rb +66 -15
  73. data/macros/html/block.rb +43 -105
  74. data/macros/html/inline.rb +11 -12
  75. data/macros/html/structure.rb +123 -58
  76. data/macros/xml.rb +33 -0
  77. data/spec/files/container.textile +2 -2
  78. data/spec/files/document.glyph +2 -2
  79. data/spec/files/document_with_toc.glyph +3 -3
  80. data/spec/files/included.textile +1 -1
  81. data/spec/files/ligature.jpg +0 -0
  82. data/spec/files/markdown.markdown +2 -1
  83. data/spec/lib/commands_spec.rb +46 -3
  84. data/spec/lib/document_spec.rb +4 -4
  85. data/spec/lib/glyph_spec.rb +17 -46
  86. data/spec/lib/interpreter_spec.rb +6 -25
  87. data/spec/lib/macro_spec.rb +141 -43
  88. data/spec/lib/macro_validators_spec.rb +27 -5
  89. data/spec/lib/node_spec.rb +26 -1
  90. data/spec/lib/parser_spec.rb +246 -0
  91. data/spec/lib/syntax_node_spec.rb +111 -0
  92. data/spec/macros/core_spec.rb +195 -0
  93. data/spec/macros/filters_spec.rb +38 -4
  94. data/spec/macros/macros_spec.rb +20 -176
  95. data/spec/macros/textile_spec.rb +13 -71
  96. data/spec/macros/xml_spec.rb +77 -0
  97. data/spec/spec_helper.rb +50 -10
  98. data/spec/tasks/load_spec.rb +13 -2
  99. data/styles/default.css +18 -6
  100. data/styles/pagination.css +1 -19
  101. data/tasks/generate.rake +2 -2
  102. data/tasks/load.rake +27 -17
  103. data/tasks/project.rake +1 -1
  104. metadata +75 -62
  105. data/book/script/compile.rb +0 -8
  106. data/book/script/prof +0 -1
  107. data/book/script/prof_results.htm +0 -21079
  108. data/book/text/authoring.glyph +0 -548
  109. data/book/text/extending.glyph +0 -224
  110. data/book/text/getting_started.glyph +0 -158
  111. data/book/text/troubleshooting.glyph +0 -179
  112. data/lib/glyph/glyph_language.rb +0 -538
  113. data/lib/glyph/glyph_language.treetop +0 -27
  114. data/macros/common.rb +0 -160
@@ -1,96 +1,117 @@
1
+ txt[
1
2
  Glyph's command-line interface has been built using the =>[http://github.com/davetron5000/gli|gli] (Git-like interface) gem. Therefore, Glyph commands are all written like this:
2
3
 
3
- @glyph@ _global-options_ command _options_ _parameters_
4
+ strong[glyph] em[global_options] strong[command] em[options] em[parameters]
4
5
 
5
6
  Where:
6
- * _global-options_ and _options_ are in the form: @-n@ _value_ or @--name=@\._value_, e.g. @-f pdf@ or @--format=pdf@
7
+ * em[global_options] and _options_ are in the form: @-n@ _value_ or @--name=@\._value_, e.g. @-f pdf@ or @--format=pdf@
7
8
  * _parameters_ are separated by whitespaces, and can be wrapped in quotes.
8
-
9
- section[header[Global Options]
10
-
11
- section[header[@-d@, @--debug@|debug_switch]
12
- If specified, the command is executed in debug mode and additional diagnostic information is printed on the screen.
13
9
  ]
10
+ section[
11
+ @title[Global Options]
12
+ section[
13
+ @title[code[-d], code[--debug]]
14
+ @id[debug_switch]
15
+ p[If specified, the command is executed in debug mode and additional diagnostic information is printed on the screen.]
16
+ ]
14
17
  ]
15
-
16
- section[header[@add@|c_add]
17
- Creates a new text file in the @text/@ folder.
18
-
19
- example[glyph add introduction.textile]
20
-
21
- parameters[
22
- -p[_file-name_|The name (or relative path) of the new file to be created.]
23
- ]
24
- ] --[End add]
25
-
26
- section[header[@compile@|c_compile]
27
- Compiles a Glyph document into an output file. If no options are specified, the @document.glyph@ file is used as source to produce a standalone HTML file.
28
-
29
- example[glyph compile -f pdf]
30
-
31
- parameters[
32
- -p[_source_|The source glyph file to compile _(Optional)_.]
33
- -p[_destination_|The destination file _(Optional)_.]
18
+ section[
19
+ @title[code[add]]
20
+ @id[c_add]
21
+ p[Creates a new text file in the code[text/] folder.]
22
+ example[glyph add introduction.textile]
23
+ parameters[
24
+ -p[em[file_name]|The name (or relative path) of the new file to be created.]
25
+ ]
34
26
  ]
35
-
36
- options[
37
- -o[source|
27
+ section[
28
+ @title[code[compile]]
29
+ @id[c_compile]
30
+ p[Compiles a Glyph document into an output file. If no options are specified, the code[document.glyph] file is used as source to produce a standalone HTML file.]
31
+ example[glyph compile -f pdf]
32
+ parameters[
33
+ -p[em[source]|The source glyph file to compile em[(Optional)].]
34
+ -p[em[destination]|The destination file em[(Optional)].]
35
+ ]
36
+ options[
37
+ -o[source|
38
38
  The source file to compile.
39
- default[document.glyph]
40
- ]
41
- -o[format|
39
+ default[document.glyph]
40
+ ]
41
+ -o[format|
42
42
  The format of the output file.
43
- default[html]
44
- values[html, pdf]
45
- ]
46
- -o[auto|
43
+ default[html]
44
+ values[html, pdf]
45
+ ]
46
+ -o[auto|
47
47
  If specified, enable =>[#auto_regeneration|auto regeneration] (requires the =>[http://rubygems.org/gems/directory_watcher|directory_watcher] gem to be installed).
48
+ ]
49
+ ]
48
50
  ]
49
- ]
50
- ] --[End compile]
51
-
52
- section[header[@config@|c_config]
51
+ section[
52
+ @title[code[config]]
53
+ @id[c_config]
53
54
  Gets or sets a configuration setting in the project or global configuration file (\.fmi[configuration files|#cfg]).
54
-
55
- examples[
55
+ examples[
56
56
  glyph config document.filename
57
57
  glyph config -g document.author "Fabio Cevasco"
58
- ]
59
-
60
- options[
61
- -o[global|
58
+ ]
59
+ options[
60
+ -o[global|
62
61
  If specified, the global configuration file is processed instead of the project file.
63
- default[false]
64
- ]
62
+ default[false]
63
+ ]
64
+ ]
65
+ parameters[
66
+ -p[em[setting]|The name of a valid =>[#cfg_ref|configuration setting].]
67
+ -p[em[value]|The new value of the configuration setting.]
68
+ ]
65
69
  ]
66
- parameters[
67
- -p[_setting_|The name of a valid =>[#cfg_ref|configuration setting].]
68
- -p[_value_|The new value of the configuration setting.]
69
- ]
70
- ] --[End config]
71
-
72
- section[header[@help@|c_help]
70
+ section[
71
+ @title[code[help]]
72
+ @id[c_help]
73
73
  Prints information about all Glyph commands or about one specific command.
74
-
75
- examples[
74
+ examples[
76
75
  glyph help
77
76
  glyph help compile
77
+ ]
78
+ parameters[
79
+ -p[em[command]|A valid Glyph command.]
80
+ ]
78
81
  ]
79
-
80
- parameters[
81
- -p[_command_|A valid Glyph command.]
82
- ]
83
-
84
- ] --[End help]
85
-
86
- section[header[@init@|c_init]
82
+ section[
83
+ @title[code[init]]
84
+ @id[c_init]
87
85
  Creates a new Glyph project in the current directory (if empty).
88
-
89
- example[glyph init]
90
- ] --[End init]
91
-
92
- section[header[@todo@|c_todo]
86
+ example[glyph init]
87
+ ]
88
+ section[
89
+ @title[code[outline]]
90
+ @id[c_outline]
91
+ Display an outline of the current document.
92
+ options[
93
+ -o[limit|
94
+ Only display headers until the specified level.
95
+ ]
96
+ -o[ids|
97
+ Display section IDs.
98
+ ]
99
+ -o[files|
100
+ Display file names.
101
+ ]
102
+ -o[titles|
103
+ Display section titles.
104
+ ]
105
+ ]
106
+ examples[
107
+ glyph outline -it -l 1
108
+ glyph outline -l 2
109
+ glyph outline -f
110
+ ]
111
+ ]
112
+ section[
113
+ @title[code[todo]]
114
+ @id[c_todo]
93
115
  Prints all the todo items saved using the %>[todo].
94
-
95
- example[glyph todo]
96
- ] --[End todo]
116
+ example[glyph todo]
117
+ ]
@@ -1,4 +1,6 @@
1
- section[header[@document.*@]
1
+ section[
2
+ @title[document.*]
3
+ @id[cfg_document]
2
4
  The following configuration settings are related to the current Glyph document. Therefore, you should update them right after creating a project.
3
5
 
4
6
  config_table[
@@ -16,6 +18,9 @@ The format of the output file. It can be set to any value stored in the $>[docum
16
18
  ]
17
19
  ref_config[document.output_targets|
18
20
  An @Array@ containing all the possible output formats. This setting should not be changed by the user.
21
+ ]
22
+ ref_config[document.revision|
23
+ The document's revision.
19
24
  ]
20
25
  ref_config[document.source|
21
26
  The main source file to compile. It can be also be overridden by calling the #>[compile] with the @-s@ option.
@@ -28,9 +33,11 @@ The subtitle of the document, displayed using the %>[subtitle].
28
33
  The title of the document, displayed using the %>[title].
29
34
  ]
30
35
  ]
31
- ] --[End document section]
36
+ ]
32
37
 
33
- section[header[@filters.*@]
38
+ section[
39
+ @title[filters.*]
40
+ @id[cfg_filters]
34
41
  config_table[
35
42
  ref_config[filters.by_file_extension|
36
43
  If set to @true@, a filter macro is applied to included files, based on their extensions (\.fmi[including files|#incl]).
@@ -43,6 +50,12 @@ The name of the markdown converter to use with the %>[markdown]. It can be set t
43
50
  * Kramdown
44
51
 
45
52
  If not set, Glyph tests for the presence of each gem in the same order, until one is found.
53
+ ]
54
+ ref_config[filters.coderay.*|
55
+ Some &[coderay]-specific =>[http://coderay.rubychan.de/doc/classes/CodeRay/Encoders/HTML.html|options].
56
+ ]
57
+ ref_config[filters.highlighter|
58
+ The current highlighter to use. It can be set to @coderay@ or @ultraviolet@
46
59
  ]
47
60
  ref_config[filters.redcloth.restrictions|
48
61
  An @Array@ containing restrictions applied to RedCloth, used by the %>[textile] (see =>[http://redcloth.rubyforge.org/classes/RedCloth/TextileDoc.html|RedCloth Documentation] for more information).
@@ -50,59 +63,38 @@ An @Array@ containing restrictions applied to RedCloth, used by the %>[textile]
50
63
  ref_config[filters.target|
51
64
  The output target for filters. It can be set to @html@ (for RedCloth and MarkDown) or @latex@ (RedCloth-only).
52
65
  ]
53
- ]
54
- ] --[End filters section]
55
-
56
-
57
- section[header[@highlighters.*@|s_highlighters]
58
-
59
- config_table[
60
- ref_config[highlighters.coderay.*|
61
- Some &[coderay]-specific =>[http://coderay.rubychan.de/doc/classes/CodeRay/Encoders/HTML.html|options].
62
- ]
63
- ref_config[highlighters.current|
64
- The current highlighter to use. It can be set to @coderay@ or @ultraviolet@
65
- ]
66
- ref_config[highlighters.target|
67
- The target output of the =>[#s_highlighters_current|current highlighter]. It can be set to anything the highlighter supports.
68
- ]
69
- ref_config[highlighters.ultraviolet.line_numbers|
66
+ ref_config[filters.ultraviolet.line_numbers|
70
67
  Whether the &[uv] highlighter should display line numbers or not.
71
68
  ]
72
- ref_config[highlighters.ultraviolet.theme|
69
+ ref_config[filters.ultraviolet.theme|
73
70
  The theme used by the &[uv] highlighter.
74
71
  ]
75
72
  ]
73
+ ]
76
74
 
77
- ] --[End highlighters section]
78
-
79
- section[header[@structure.*@]
80
- The following configuration settings are used internally by Glyph and should not be changed by the user.
81
-
75
+ section[
76
+ @title[language.*]
82
77
  config_table[
83
- ref_config[structure.backmatter|
84
- The section types used in the document backmatter.
85
- ]
86
- ref_config[structure.bodymatter|
87
- The section types used in the document bodymatter.
78
+ ref_config[language.set|
79
+ Determines which macro set will be loaded. It can be set to:
80
+ * glyph – Loads core, filter, xml macros plus all macros necessary for the $>[document.output].
81
+ * xml – Loads core and xml macros.
82
+ * core – Loads core macros only.
88
83
  ]
89
- ref_config[structure.frontmatter|
90
- The section types used in the document frontmatter.
84
+ ref_config[language.options.xml_blacklist|
85
+ The XML tags listed here cannot be generated using Glyph code.
91
86
  ]
92
- ref_config[structure.hidden|
93
- The section types that will not be shown in the Table of Contents.
94
- ]
95
- ref_config[structure.special|
96
- The section types that will be considered _special_ and whose children will not be included in the Table of Contents.
87
+ ref_config[language.options.xml_fallback|
88
+ If set to true, any unknown macro name will considered an XML element (see =>[#other_elements]).
97
89
  ]
98
90
  ]
99
- ] --[End structure section]
91
+ ]
100
92
 
101
- section[header[@tools.*@]
93
+ section[
94
+ @title[tools.*]
102
95
  config_table[
103
96
  ref_config[tools.pdf_generator|
104
97
  The external program used to generate PDF files. It can only be set to @prince@.
105
98
  ]
106
99
  ]
107
- ] --[End tools section]
108
-
100
+ ]
@@ -1,378 +1,6 @@
1
- section[header[Common Macros]
1
+ 
2
2
 
3
- ref_macro[and|
4
- Conditional @and@ operator, to be used with the %>[condition].
5
3
 
6
- example[=?[and[true\|false]\|This is never displayed.]=]
7
- ]
8
4
 
9
- ref_macro[comment|
10
- Evaluates to nothing. Used to add comments in a Glyph document that will not be displayed in output files.
11
5
 
12
- aliases[--]
13
- example[=--[This is a comment. It will not be displayed in the output]=]
14
- ]
15
6
 
16
- ref_macro[condition|
17
- Tests a conditional expression (first parameter), and evaluates to the second parameter if the condition is satisfied. If the second parameter is an %>[escape] macro, its contents are unescaped and interpreted only if the condition is satisfied. For more information, see =>[#cond_macros].
18
-
19
- aliases[?]
20
-
21
- *Examples*
22
-
23
- See any of the following:
24
- * %>[and]
25
- * %>[or]
26
- * %>[not]
27
- * %>[match]
28
- * %>[eq]
29
-
30
- ]
31
-
32
- ref_macro[config|
33
- Evaluates to the configuration setting referenced by its value.
34
-
35
- aliases[$]
36
- example[=$[document.author]=]
37
- ]
38
-
39
- ref_macro[config:|
40
- Sets the value of a configuration setting.
41
-
42
- aliases[$:]
43
-
44
- example[=$:[document.draft\|true]=]
45
-
46
- ]
47
- ref_macro[decode|
48
- Decodes some text that was previously encoded (see %>[encode]). fmi[this topic|#encode_decode].
49
-
50
- aliases[**]
51
-
52
- example[=*[\=note‡\.‡¤\.91\.¤‡\.‡This will not be evaluated‡\.‡¤\.93\.¤‡\.‡\=]=]
53
-
54
- ]
55
-
56
- ref_macro[encode|
57
- Encodes some Glyph code to prevent its evaluation, so that it can be decoded (and interpreted) later on (see the %>[decode]). fmi[this topic|#encode_decode].
58
-
59
- aliases[*]
60
-
61
- example[=*[\=note[This will not be evaluated]\=]=]
62
-
63
- ]
64
-
65
- ref_macro[eq|
66
- Conditional equality operator, to be used with the %>[condition].
67
-
68
- example[=?[eq[$[document.draft]\|true]\|This is displayed only in draft documents.]=]
69
- ]
70
-
71
- ref_macro[escape|
72
- Evaluates to its value. Commonly used with the escaping delimiters codeph[\[\=] and codeph[\=\]].
73
-
74
- aliases[.]
75
- example[=.\[=Macros are escaped here =>[#test].=\]=]
76
- ]
77
-
78
- ref_macro[include|
79
- Evaluates to the contents of a text file stored in the @text/@ directory referenced by its value. If &[filter_by_ext], filters the contents of the file using the =>[#f_macros|filter macro] corresponding to the file extension.
80
-
81
- aliases[@]
82
- example[=@[introduction.textile]=]
83
- ]
84
-
85
- ref_macro[match|
86
- Evaluates to @true@ if the first parameter matches the second, an empty string otherwise. The second parameter must be a valid Ruby-compatible regular expression. This macro must be used with the %>[condition].
87
-
88
- example[=?[match[Hello!\|/^hell/i]\|This is always displayed]=]
89
- ]
90
-
91
- ref_macro[macro:|
92
- Defines a macro.
93
-
94
- note[The new macro &[only_after_declaration].]
95
-
96
- aliases[%:]
97
-
98
- example[=%:[test\|"<em>test: #@value</em>"]=]
99
-
100
- ]
101
-
102
- ref_macro[not|
103
- Conditional @and@ operator, to be used with the %>[condition].
104
-
105
- example[=?[not[false]\|This is always displayed.]=]
106
- ]
107
-
108
- ref_macro[or|
109
- Conditional @or@ operator, to be used with the %>[condition].
110
-
111
- example[=?[or[true\|false]\|This is always displayed.]=]
112
- ]
113
-
114
- ref_macro[ruby|
115
- Evaluates its value as Ruby code (using @Kernel#instance_eval@).
116
-
117
- aliases[%]
118
- examples[=
119
- %[Time.now]
120
- %[Glyph::VERSION]
121
- =]
122
- ]
123
-
124
- ref_macro[snippet|
125
- Evaluates to the snippet referenced by its value.
126
-
127
- aliases[&]
128
- example[=&[glang]=]
129
- ]
130
-
131
- ref_macro[snippet:|
132
- Defines a snippet.
133
-
134
- note[The new snippet &[only_after_declaration].]
135
-
136
- aliases[&:]
137
-
138
- example[=&:[test\|This is a test]=]
139
-
140
- ]
141
-
142
- ref_macro[todo|
143
- Saves the value as a TODO item, which can be printed using the #>[todo] or included in the document if the $>[document.draft] is set to @true@.
144
-
145
- example[=todo[Remember to do this.]=]
146
- ]
147
-
148
- ] --[End common macros]
149
-
150
- section[header[Filter Macros|f_macros]
151
-
152
- ref_macro[markdown|
153
- Uses a markdown converter (BlueCloth, RDiscount, Maruku or Kramdown) to transform the value into HTML if the $>[filters.target] is set to @html@.
154
-
155
- &[called_on_files] with a @.markdown@ or a @.md@ extension.
156
-
157
- example[=markdown[This is *emphasized* text.]=]
158
- ]
159
-
160
- ref_macro[textile|
161
- Uses the RedCloth gem to transform the value into HTML or LaTeX, depending on the value of the $>[filters.target].
162
-
163
- &[called_on_files] with a @.textile@ extension.
164
-
165
- example[=textile[This is a *strong emphasis*.]=]
166
- ]
167
-
168
- ] --[End filter macros]
169
-
170
- section[header[Block Macros]
171
-
172
- ref_macro[box|
173
- Creates a titled box (@<div>@ tag).
174
-
175
- *Example:*
176
-
177
- code[=
178
- box[Why boxes?\|
179
- Boxes can be used to make a section of text stand out from the rest of the document.
180
- ]
181
- =]
182
- ]
183
-
184
- ref_macro[code|
185
- Used to render a block of code within @<pre>@ and @<code>@ tags.
186
- * For inline code, see the %>[codeph].
187
- * For code highlighting, see the %>[highlight].
188
-
189
- *Example:*
190
-
191
- code[=
192
- code[
193
- def hello
194
- puts "Hello World"
195
- end
196
- ]
197
- =]
198
-
199
- ]
200
-
201
- ref_macro[fig|
202
- Includes an image in the document, with an optional caption.
203
-
204
- examples[=
205
- fig[diagram.png]
206
- fig[graph.png\|Monthly pageviews]
207
- =]
208
- ]
209
-
210
- ref_macro[highlight|
211
- Highlights a piece of source code (second parameter) according to the specified language (first parameter). fmi[code highligting|#source_code].
212
-
213
- *Example:*
214
-
215
- code[=
216
- highlight[ruby\|
217
- def hello
218
- puts "Hello World"
219
- end
220
- ]
221
- =]
222
-
223
- ]
224
-
225
- ref_macro[img|
226
- Includes an image in the document, optionally scaled according to the specified width and height. The image must be stored within the @images/@ directory of the current project.
227
-
228
- examples[=
229
- img[icon.png]
230
- img[holidays/landscape.jpg\|70%]
231
- img[logo.svg\|50%\|50%]
232
- =]
233
- ]
234
-
235
- ref_macro[note|
236
- Creates a note @div@ containing the value.
237
-
238
- aliases[important, caution, tip]
239
- example[=note[This is a note.]=]
240
- ]
241
-
242
- ref_macro[pubdate|
243
- Evaluates to a date string (in the format: _current-month_ _current-year_; or _%B_ _%Y_), within a @<div>@ tag.
244
-
245
- example[=pubdate[]=]
246
- ]
247
-
248
- ref_macro[subtitle|
249
- Renders the subtitle of the document (based on the $>[document.subtitle]) within a @<h2>@ tag.
250
-
251
- example[=subtitle[]=]
252
- ]
253
-
254
- ref_macro[table|
255
- Evaluates to an HTML table. Used in conjunction with the =>[#m_tr|@tr@], =>[#m_td|@td@] and =>[#m_th|@th@] macros.
256
-
257
- *Example:*
258
-
259
- code[=
260
- table[
261
- tr[
262
- th[Name]
263
- th[Value]
264
- ]
265
- tr[
266
- td[A]
267
- td[1]
268
- ]
269
- tr[
270
- td[B]
271
- td[2]
272
- ]
273
- ]
274
- =]
275
-
276
- ]
277
-
278
- ref_macro[td|See =>[#m_table].]
279
-
280
- ref_macro[title|
281
- Renders the title of the document (based on the $>[document.title]) within a @<h1>@ tag.
282
-
283
- example[=title[]=]
284
- ]
285
-
286
- ref_macro[th|See =>[#m_table].]
287
- ref_macro[tr|See =>[#m_table].]
288
-
289
- ] --[End block macros]
290
-
291
- section[header[Inline Macros]
292
-
293
- ref_macro[anchor|
294
- Creates a named anchor (or bookmark).
295
-
296
- aliases[bookmark, #]
297
- example[=#[test\|Test Bookmark]=]
298
- ]
299
-
300
- ref_macro[codeph|
301
- Wraps the value in a @<code>@ tag.
302
-
303
- example[=codeph[Kernel.instance_eval]=]
304
-
305
- ]
306
-
307
- ref_macro[draftcomment|
308
- If the $>[document.draft] is set to @true@, displays a draft comment within the document.
309
-
310
- aliases[dc]
311
-
312
- example[=dc[This is printed only in draft documents.]=]
313
-
314
- ]
315
-
316
- ref_macro[fmi|
317
- Creates a _For More Information_ link (for an example usage, see the %>[link]).
318
-
319
- example[=fmi[creating links\|#links]=]
320
- ]
321
-
322
- ref_macro[link|
323
- Creates an hyperlink (\.fmi[creating links|#links]).
324
-
325
- aliases[\.=>]
326
- examples[=
327
- =>[#introduction]
328
- =>[#troub\|Troubleshooting]
329
- =>[http://www.h3rald.com\|H3RALD.com]
330
- =]
331
- ]
332
-
333
- ] --[End inline macros]
334
-
335
- section[header[Structure Macros]
336
-
337
- ref_macro[body|
338
- Creates a @<body>@ tag.
339
- ]
340
-
341
- ref_macro[div|
342
- Creates a @<div>@ tag.
343
-
344
- *Aliases:* codeph[%[=Glyph['structure'].values.flatten.uniq.map{\|a\| a.to_s }.push("section").sort.join(', ')=]]
345
- ]
346
-
347
- ref_macro[document|
348
- The root macro used in every Glyph document. It creates an @<html>@ tag.
349
- ]
350
-
351
- ref_macro[head|
352
- Creates a @<head>@ tag, pre-populated with @title@ and author/copyright @<meta>@ tags.
353
- ]
354
-
355
- ref_macro[header|
356
- Creates an @h2@, @h3@, @h4@, etc. header (\.fmi[using headers|#sec_head]).
357
-
358
- examples[=
359
- header[Introduction]
360
- header[Getting Started\|gs]
361
- =]
362
- ]
363
-
364
- ref_macro[section|See =>[#m_div].]
365
-
366
- ref_macro[style|
367
- Embeds the content of a CSS or Sass file within a @<style>@ tag (\.fmi[stylesheets|#stylesheets]).
368
-
369
- example[=style[default.css]=]
370
- ]
371
-
372
- ref_macro[toc|
373
- Generates a _Table of Contents_ based on how sections and headers are nested in the current document.
374
-
375
- example[=toc[]=]
376
- ]
377
-
378
- ] --[End structure macros]