glyph 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS.textile +8 -0
- data/CHANGELOG.textile +260 -0
- data/LICENSE.textile +26 -0
- data/README.textile +49 -21
- data/Rakefile +17 -7
- data/VERSION +1 -1
- data/book/config.yml +11 -5
- data/book/document.glyph +24 -13
- data/book/lib/macros/reference.rb +41 -14
- data/book/output/html/glyph.html +2298 -687
- data/book/output/pdf/glyph.pdf +6218 -2698
- data/book/script/authors +1 -0
- data/book/script/changelog +1 -0
- data/book/script/compile.rb +8 -0
- data/book/script/license +1 -0
- data/book/script/prof +1 -0
- data/book/script/prof_results.htm +21079 -0
- data/book/script/readme +1 -0
- data/book/snippets.yml +3 -4
- data/book/text/acknowledgement.glyph +8 -0
- data/book/text/authoring.glyph +548 -0
- data/book/text/changelog.glyph +76 -0
- data/book/text/extending.glyph +224 -0
- data/book/text/{getting_started.textile → getting_started.glyph} +30 -24
- data/book/text/{introduction.textile → introduction.glyph} +22 -12
- data/book/text/license.glyph +21 -0
- data/book/text/{ref_commands.textile → ref_commands.glyph} +30 -8
- data/book/text/ref_config.glyph +108 -0
- data/book/text/ref_macros.glyph +378 -0
- data/book/text/troubleshooting.glyph +179 -0
- data/config.yml +16 -4
- data/glyph.gemspec +83 -22
- data/lib/glyph.rb +164 -31
- data/lib/glyph/commands.rb +98 -23
- data/lib/glyph/document.rb +13 -7
- data/lib/glyph/glyph_language.rb +9 -1
- data/lib/glyph/glyph_language.treetop +1 -1
- data/lib/glyph/interpreter.rb +19 -9
- data/lib/glyph/macro.rb +88 -11
- data/lib/glyph/macro_validators.rb +48 -0
- data/lib/glyph/node.rb +13 -1
- data/lib/glyph/system_extensions.rb +0 -28
- data/macros/common.rb +125 -31
- data/macros/filters.rb +19 -13
- data/macros/html/block.rb +119 -68
- data/macros/html/inline.rb +29 -3
- data/macros/html/structure.rb +40 -40
- data/spec/files/article.glyph +5 -0
- data/spec/lib/commands_spec.rb +98 -3
- data/spec/lib/document_spec.rb +15 -2
- data/spec/lib/glyph_spec.rb +39 -10
- data/spec/lib/interpreter_spec.rb +8 -2
- data/spec/lib/macro_spec.rb +54 -6
- data/spec/lib/macro_validators_spec.rb +33 -0
- data/spec/lib/node_spec.rb +11 -3
- data/spec/macros/filters_spec.rb +5 -5
- data/spec/macros/macros_spec.rb +185 -8
- data/spec/macros/textile_spec.rb +217 -0
- data/spec/spec_helper.rb +25 -15
- data/spec/tasks/generate_spec.rb +3 -3
- data/spec/tasks/load_spec.rb +11 -1
- data/spec/tasks/project_spec.rb +0 -3
- data/styles/coderay.css +121 -0
- data/styles/default.css +54 -20
- data/{book/styles/css3.css → styles/pagination.css} +35 -7
- data/styles/ultraviolet/active4d.css +114 -0
- data/styles/ultraviolet/all_hallows_eve.css +72 -0
- data/styles/ultraviolet/amy.css +147 -0
- data/styles/ultraviolet/blackboard.css +88 -0
- data/styles/ultraviolet/brilliance_black.css +605 -0
- data/styles/ultraviolet/brilliance_dull.css +599 -0
- data/styles/ultraviolet/cobalt.css +149 -0
- data/styles/ultraviolet/dawn.css +121 -0
- data/styles/ultraviolet/eiffel.css +121 -0
- data/styles/ultraviolet/espresso_libre.css +109 -0
- data/styles/ultraviolet/idle.css +62 -0
- data/styles/ultraviolet/iplastic.css +80 -0
- data/styles/ultraviolet/lazy.css +73 -0
- data/styles/ultraviolet/mac_classic.css +123 -0
- data/styles/ultraviolet/magicwb_amiga.css +104 -0
- data/styles/ultraviolet/pastels_on_dark.css +188 -0
- data/styles/ultraviolet/slush_poppies.css +85 -0
- data/styles/ultraviolet/spacecadet.css +51 -0
- data/styles/ultraviolet/sunburst.css +180 -0
- data/styles/ultraviolet/twilight.css +137 -0
- data/styles/ultraviolet/zenburnesque.css +91 -0
- data/tasks/generate.rake +45 -26
- data/tasks/load.rake +21 -18
- data/tasks/project.rake +3 -1
- metadata +210 -41
- data/book/styles/default.css +0 -190
- data/book/text/authoring.textile +0 -351
- data/book/text/extending.textile +0 -148
- data/book/text/ref_config.textile +0 -0
- data/book/text/ref_macros.textile +0 -256
- data/book/text/troubleshooting.textile +0 -118
- data/styles/css3.css +0 -220
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/book/config.yml
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
:
|
4
|
-
:
|
5
|
-
|
1
|
+
---
|
2
|
+
:highlighters:
|
3
|
+
:current: ultraviolet
|
4
|
+
:ultraviolet:
|
5
|
+
:theme: blackboard
|
6
|
+
:document:
|
7
|
+
:output: html
|
8
|
+
:title: Glyph
|
9
|
+
:subtitle: Rapid Document Authoring Framework
|
10
|
+
:author: Fabio Cevasco
|
11
|
+
:filename: glyph
|
data/book/document.glyph
CHANGED
@@ -1,54 +1,65 @@
|
|
1
1
|
document[
|
2
2
|
head[
|
3
3
|
style[default.css]
|
4
|
-
style[
|
4
|
+
?[eq[$[document.output]|pdf]|style[pagination.css]]
|
5
|
+
?[eq[$[highlighters.current]|coderay]|style[coderay.css]]
|
6
|
+
?[eq[$[highlighters.current]|ultraviolet]|style[ultraviolet/blackboard.css]]
|
5
7
|
]
|
6
8
|
body[
|
7
9
|
titlepage[
|
8
|
-
img[glyph.svg|20%|20%]
|
10
|
+
?[eq[$[document.output]|pdf]|img[glyph.svg|20%|20%]]
|
11
|
+
?[eq[$[document.output]|html]|img[glyph.png|20%|20%]]
|
9
12
|
title[]
|
10
13
|
subtitle[]
|
11
|
-
v\.%[Glyph::VERSION]
|
14
|
+
v\.%[Glyph::VERSION]
|
12
15
|
author[]
|
13
16
|
pubdate[]
|
14
17
|
]
|
15
18
|
frontmatter[
|
16
19
|
toc[]
|
17
|
-
introduction[
|
18
|
-
|
19
|
-
|
20
|
+
introduction[header[Introduction]
|
21
|
+
textile[@[introduction.glyph]]
|
22
|
+
section[header[License]
|
23
|
+
textile[@[license.glyph]]
|
24
|
+
]
|
25
|
+
]
|
26
|
+
acknowledgement[header[Acknowledgement]
|
27
|
+
textile[@[acknowledgement.glyph]]
|
20
28
|
]
|
21
29
|
]
|
22
30
|
bodymatter[
|
23
31
|
chapter[
|
24
32
|
header[Getting Started]
|
25
|
-
@[getting_started.
|
33
|
+
textile[@[getting_started.glyph]]
|
26
34
|
]
|
27
35
|
chapter[
|
28
36
|
header[Authoring Documents]
|
29
|
-
@[authoring.
|
37
|
+
textile[@[authoring.glyph]]
|
30
38
|
]
|
31
39
|
chapter[
|
32
40
|
header[Extending Glyph|extending]
|
33
|
-
@[extending.
|
41
|
+
textile[@[extending.glyph]]
|
34
42
|
]
|
35
43
|
chapter[
|
36
44
|
header[Troubleshooting]
|
37
|
-
@[troubleshooting.
|
45
|
+
textile[@[troubleshooting.glyph]]
|
38
46
|
]
|
39
47
|
]
|
40
48
|
backmatter[
|
41
49
|
appendix[
|
42
50
|
header[Command Reference|cmd_ref]
|
43
|
-
@[ref_commands.
|
51
|
+
textile[@[ref_commands.glyph]]
|
44
52
|
]
|
45
53
|
appendix[
|
46
54
|
header[Macro Reference|macro_ref]
|
47
|
-
@[ref_macros.
|
55
|
+
textile[@[ref_macros.glyph]]
|
48
56
|
]
|
49
57
|
appendix[
|
50
58
|
header[Configuration Reference|cfg_ref]
|
51
|
-
@[ref_config.
|
59
|
+
textile[@[ref_config.glyph]]
|
60
|
+
]
|
61
|
+
appendix[header[Changelog]
|
62
|
+
@[changelog.glyph]
|
52
63
|
]
|
53
64
|
]
|
54
65
|
]
|
@@ -12,7 +12,7 @@ macro :error_table do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
macro :ref_error do
|
15
|
-
error, description =
|
15
|
+
error, description = params
|
16
16
|
%{
|
17
17
|
<tr>
|
18
18
|
<td>#{error}</td>
|
@@ -22,7 +22,7 @@ macro :ref_error do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
macro :"%>" do
|
25
|
-
interpret "=>[#m_
|
25
|
+
interpret "=>[#m_#{@value.gsub(/[^a-z0-1_-]/, '_')}|#@value] macro"
|
26
26
|
end
|
27
27
|
|
28
28
|
macro :"#>" do
|
@@ -34,6 +34,10 @@ macro :"$>" do
|
|
34
34
|
interpret "=>[#s_#{val}|#@value] setting"
|
35
35
|
end
|
36
36
|
|
37
|
+
macro :default do
|
38
|
+
%{*Default Value:* @#@value@}
|
39
|
+
end
|
40
|
+
|
37
41
|
macro :"parameters" do
|
38
42
|
interpret %{
|
39
43
|
section[header[#{@name.to_s[0..0].upcase+@name.to_s[1..@name.to_s.length-1]}]
|
@@ -43,40 +47,36 @@ macro :"parameters" do
|
|
43
47
|
<th style="width:30%">#{@name.to_s[0..0].upcase+@name.to_s[1..@name.to_s.length-2]}</th>
|
44
48
|
<th>Description</th>
|
45
49
|
</tr>
|
46
|
-
|
50
|
+
#{@value}
|
47
51
|
</table>
|
48
52
|
]
|
49
53
|
}
|
50
54
|
end
|
51
55
|
|
52
56
|
macro :option do
|
53
|
-
ident, desc =
|
57
|
+
ident, desc = params
|
54
58
|
%{
|
55
59
|
<tr>
|
56
60
|
<td><notextile>-#{ident[0..0]} (--#{ident})</notextile></td>
|
57
61
|
<td>
|
58
|
-
|
62
|
+
#{desc}
|
59
63
|
</td>
|
60
64
|
</tr>
|
61
65
|
}
|
62
66
|
end
|
63
67
|
|
64
|
-
macro :default do
|
65
|
-
%{*Default:* @#@value@}
|
66
|
-
end
|
67
|
-
|
68
68
|
macro :values do
|
69
69
|
%{*Possible Values:* @#@value@}
|
70
70
|
end
|
71
71
|
|
72
72
|
macro :example do
|
73
|
-
%{*Example:*
|
73
|
+
%{*Example:* <code>#@value</code>}
|
74
74
|
end
|
75
75
|
|
76
76
|
macro :examples do
|
77
77
|
%{
|
78
78
|
*Examples:*
|
79
|
-
|
79
|
+
#{@value.split("\n").map{|i| "@#{i}@\n"}.to_s}
|
80
80
|
}
|
81
81
|
end
|
82
82
|
|
@@ -85,14 +85,41 @@ macro :aliases do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
macro :ref_macro do
|
88
|
-
m_name, m_value =
|
88
|
+
m_name, m_value = params
|
89
89
|
interpret %{
|
90
|
-
section[header[@#{m_name}@|m_#{m_name}]
|
91
|
-
|
90
|
+
section[header[@#{m_name}@|m_#{m_name.gsub(/[^a-z0-1_-]/, '_')}]
|
91
|
+
#{m_value}
|
92
92
|
]
|
93
93
|
}
|
94
94
|
end
|
95
95
|
|
96
|
+
macro :ref_config do
|
97
|
+
m_name, m_value = params
|
98
|
+
default = Glyph::SYSTEM_CONFIG.get(m_name).to_yaml.gsub(/^---/, '')
|
99
|
+
default = "nil" if default.blank?
|
100
|
+
interpret %{tr[
|
101
|
+
td[codeph[#{m_name}] #[s_#{m_name.gsub(/\./, '_')}]]
|
102
|
+
td[#{m_value}]
|
103
|
+
td[
|
104
|
+
code[=
|
105
|
+
#{default}
|
106
|
+
=]
|
107
|
+
]
|
108
|
+
]}
|
109
|
+
end
|
110
|
+
|
111
|
+
macro :config_table do
|
112
|
+
interpret %{table[
|
113
|
+
tr[
|
114
|
+
th[Name]
|
115
|
+
th[Description]
|
116
|
+
th[Default (YAML)]
|
117
|
+
]
|
118
|
+
#@value
|
119
|
+
]}
|
120
|
+
end
|
121
|
+
|
122
|
+
|
96
123
|
macro_alias :options => :parameters
|
97
124
|
macro_alias '-p' => :ref_error
|
98
125
|
macro_alias '-o' => :option
|
data/book/output/html/glyph.html
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
<head>
|
5
|
+
<title>Glyph</title>
|
6
|
+
<meta name="author" content="Fabio Cevasco" />
|
7
|
+
<meta name="copyright" content="Fabio Cevasco" />
|
8
|
+
<meta name="generator" content="Glyph v0.2.0 (http://www.h3rald.com/glyph)" />
|
9
|
+
<style type="text/css">
|
10
|
+
* {
|
10
11
|
border: none;
|
11
12
|
font-family: inherit;
|
12
13
|
font-size: 100%;
|
@@ -17,9 +18,13 @@
|
|
17
18
|
html {
|
18
19
|
background: #fff;
|
19
20
|
}
|
20
|
-
|
21
|
+
ol, ul {
|
21
22
|
margin: 0.3em 0;
|
22
23
|
}
|
24
|
+
p {
|
25
|
+
margin: 1em 0;
|
26
|
+
}
|
27
|
+
|
23
28
|
table {
|
24
29
|
border-collapse: collapse;
|
25
30
|
border-spacing: 0;
|
@@ -67,6 +72,9 @@ li {
|
|
67
72
|
ol li{
|
68
73
|
list-style-type: decimal;
|
69
74
|
}
|
75
|
+
.contents li {
|
76
|
+
list-style-type: none;
|
77
|
+
}
|
70
78
|
img {
|
71
79
|
margin: 0 5px;
|
72
80
|
padding: 2px;
|
@@ -78,22 +86,13 @@ dt {
|
|
78
86
|
dd {
|
79
87
|
font-style: italic;
|
80
88
|
}
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
}
|
87
|
-
.toc > li[class] {
|
88
|
-
font-weight: bold;
|
89
|
-
}
|
90
|
-
.toc li {
|
91
|
-
list-style-type: none;
|
92
|
-
margin-left: 0;
|
93
|
-
}
|
94
|
-
.toc li a, .toc li a:hover {
|
95
|
-
color: #000;
|
89
|
+
|
90
|
+
blockquote {
|
91
|
+
margin: 1em 1em;
|
92
|
+
font-style: italic;
|
93
|
+
color: #121212;
|
96
94
|
}
|
95
|
+
|
97
96
|
table {
|
98
97
|
border: 1px solid #E6E6E6;
|
99
98
|
}
|
@@ -152,6 +151,26 @@ sup {
|
|
152
151
|
padding: 0.5em;
|
153
152
|
width: 600px;
|
154
153
|
}
|
154
|
+
.comment {
|
155
|
+
display: block;
|
156
|
+
border: 1px solid #004D00;
|
157
|
+
background: #7AFF7A;
|
158
|
+
padding: 3px;
|
159
|
+
margin: 1px;
|
160
|
+
}
|
161
|
+
.comment .comment-pre {
|
162
|
+
color: #004D00;
|
163
|
+
}
|
164
|
+
.todo {
|
165
|
+
display: block;
|
166
|
+
border: 1px solid #990000;
|
167
|
+
background: #FF9999;
|
168
|
+
padding: 3px;
|
169
|
+
margin: 1px;
|
170
|
+
}
|
171
|
+
.todo .todo-pre {
|
172
|
+
color: #990000;
|
173
|
+
}
|
155
174
|
/* TEXT */
|
156
175
|
body {
|
157
176
|
color: #000;
|
@@ -165,12 +184,12 @@ h2 {
|
|
165
184
|
}
|
166
185
|
h3 {
|
167
186
|
font-size: 1.6em;
|
168
|
-
font-weight:
|
187
|
+
font-weight: bold;
|
169
188
|
margin: 3em 0 1em 0;
|
170
189
|
}
|
171
190
|
h4 {
|
172
191
|
font-size: 1.3em;
|
173
|
-
font-weight:
|
192
|
+
font-weight: bold;
|
174
193
|
margin: 3em 0 1em 0;
|
175
194
|
}
|
176
195
|
em {
|
@@ -183,29 +202,61 @@ a {
|
|
183
202
|
a:hover {
|
184
203
|
color: #CF282D;
|
185
204
|
}
|
186
|
-
code {
|
205
|
+
code, pre {
|
187
206
|
font-size: 0.75em;
|
188
207
|
}
|
208
|
+
pre{
|
209
|
+
margin: 1em;
|
210
|
+
padding: 1em;
|
211
|
+
}
|
212
|
+
|
213
|
+
pre>code {
|
214
|
+
font-size: 1em;
|
215
|
+
}
|
216
|
+
td p, td ul, td ol {
|
217
|
+
margin: 0;
|
218
|
+
}
|
219
|
+
td>div.code, td>code {
|
220
|
+
width: auto;
|
221
|
+
margin: 0.2em;
|
222
|
+
padding: 0.2em;
|
223
|
+
}
|
189
224
|
|
190
225
|
/* FONTS */
|
191
226
|
body {
|
192
227
|
font-family: "Book Antiqua", "Times New Roman", "Serif";
|
193
228
|
}
|
194
229
|
|
195
|
-
code {
|
230
|
+
code, pre {
|
196
231
|
font-family: "Droid Sans Mono", "Consolas", "Monaco", "Courier", "Monospace";
|
197
232
|
}
|
198
233
|
|
199
234
|
|
200
|
-
|
201
|
-
|
202
|
-
|
235
|
+
</style>
|
203
236
|
<style type="text/css">
|
204
|
-
|
237
|
+
/* FONTS */
|
238
|
+
|
239
|
+
@font-face {
|
240
|
+
font-family: "Serif"
|
241
|
+
src: local("Book Antiqua")
|
242
|
+
}
|
243
|
+
|
244
|
+
@font-face {
|
245
|
+
font-family: "Monospace"
|
246
|
+
src: local("Droid Sans Mono")
|
247
|
+
}
|
248
|
+
body {
|
249
|
+
font-family: "Book Antiqua", "Times New Roman", "Serif";
|
250
|
+
}
|
251
|
+
|
252
|
+
code, pre {
|
253
|
+
font-family: "Droid Sans Mono", "Consolas", "Monaco", "Courier", "Monospace";
|
254
|
+
}
|
255
|
+
@page {
|
205
256
|
size: A4;
|
206
257
|
margin: 40pt 30pt 40pt 30pt;
|
207
258
|
@top {
|
208
|
-
content: string(book-title) "
|
259
|
+
content: string(book-title) " - " string(chapter-title);
|
209
260
|
font-style: italic;
|
210
261
|
}
|
211
262
|
@bottom { content: counter(page, decimal); }
|
@@ -220,23 +271,33 @@ code {
|
|
220
271
|
}
|
221
272
|
|
222
273
|
@page:first {
|
223
|
-
padding-top:
|
274
|
+
padding-top: 10%;
|
224
275
|
@top { content: normal; }
|
225
276
|
@bottom { content: normal; }
|
226
277
|
}
|
227
278
|
|
279
|
+
ol.toc {
|
280
|
+
margin-left: 1.5em;
|
281
|
+
}
|
282
|
+
.toc > li[class] {
|
283
|
+
font-weight: bold;
|
284
|
+
}
|
285
|
+
.toc li {
|
286
|
+
list-style-type: none;
|
287
|
+
margin-left: 0;
|
288
|
+
}
|
289
|
+
.toc li a, .toc li a:hover {
|
290
|
+
color: #000;
|
291
|
+
}
|
292
|
+
|
228
293
|
.toc li a::after {
|
229
294
|
content: leader('.') target-counter(attr(href), page);
|
230
295
|
}
|
231
296
|
|
232
|
-
.titlepage h1 {
|
297
|
+
.titlepage h1, .halftitlepage h1 {
|
233
298
|
string-set: book-title content();
|
234
299
|
}
|
235
300
|
|
236
|
-
.titlepage h2 {
|
237
|
-
string-set: book-subtitle content();
|
238
|
-
}
|
239
|
-
|
240
301
|
.toc>li[class~=chapter] {
|
241
302
|
counter-increment: toc1;
|
242
303
|
counter-reset: toc2;
|
@@ -422,153 +483,287 @@ table, .box, .note, .important, .tip, .caution, .code { page-break-inside: avoid
|
|
422
483
|
margin-right: 0.5em;
|
423
484
|
}
|
424
485
|
|
425
|
-
|
426
|
-
</head>
|
427
|
-
|
428
|
-
|
429
|
-
<body>
|
430
|
-
<div class="titlepage">
|
431
|
-
|
432
|
-
<img src="images/glyph.svg" width="20%" height="20%" alt="-"/>
|
486
|
+
</style>
|
433
487
|
|
488
|
+
<style type="text/css">
|
489
|
+
pre.blackboard .LatexSupport {
|
490
|
+
color: #FBDE2D;
|
491
|
+
}
|
492
|
+
pre.blackboard .OcamlInfixOperator {
|
493
|
+
color: #8DA6CE;
|
494
|
+
}
|
495
|
+
pre.blackboard .MetaFunctionCallPy {
|
496
|
+
color: #BECDE6;
|
497
|
+
}
|
498
|
+
pre.blackboard .Superclass {
|
499
|
+
color: #FF6400;
|
500
|
+
font-style: italic;
|
501
|
+
}
|
502
|
+
pre.blackboard .Constant {
|
503
|
+
color: #D8FA3C;
|
504
|
+
}
|
505
|
+
pre.blackboard {
|
506
|
+
background-color: #0C1021;
|
507
|
+
color: #F8F8F8;
|
508
|
+
}
|
509
|
+
pre.blackboard .OcamlFPConstant {
|
510
|
+
text-decoration: underline;
|
511
|
+
}
|
512
|
+
pre.blackboard .OcamlFPInfixOperator {
|
513
|
+
text-decoration: underline;
|
514
|
+
}
|
515
|
+
pre.blackboard .Support {
|
516
|
+
color: #8DA6CE;
|
517
|
+
}
|
518
|
+
pre.blackboard .OcamlOperator {
|
519
|
+
color: #F8F8F8;
|
520
|
+
}
|
521
|
+
pre.blackboard .Storage {
|
522
|
+
color: #FBDE2D;
|
523
|
+
}
|
524
|
+
pre.blackboard .line-numbers {
|
525
|
+
background-color: #253B76;
|
526
|
+
color: #FFFFFF;
|
527
|
+
}
|
528
|
+
pre.blackboard .StringInterpolation {
|
529
|
+
color: #FF6400;
|
530
|
+
}
|
531
|
+
pre.blackboard .InvalidIllegal {
|
532
|
+
background-color: #9D1E15;
|
533
|
+
color: #F8F8F8;
|
534
|
+
}
|
535
|
+
pre.blackboard .PlistUnquotedString {
|
536
|
+
color: #FFFFFF;
|
537
|
+
}
|
538
|
+
pre.blackboard .OcamlVariant {
|
539
|
+
color: #D5E0F3;
|
540
|
+
}
|
541
|
+
pre.blackboard .MetaTag {
|
542
|
+
color: #7F90AA;
|
543
|
+
}
|
544
|
+
pre.blackboard .LatexEnvironment {
|
545
|
+
background-color: #F7F7F8;
|
546
|
+
}
|
547
|
+
pre.blackboard .OcamlFPPrefixOperator {
|
548
|
+
text-decoration: underline;
|
549
|
+
}
|
550
|
+
pre.blackboard .OcamlPrefixOperator {
|
551
|
+
color: #8DA6CE;
|
552
|
+
}
|
553
|
+
pre.blackboard .EntityNameSection {
|
554
|
+
color: #FFFFFF;
|
555
|
+
}
|
556
|
+
pre.blackboard .String {
|
557
|
+
color: #61CE3C;
|
558
|
+
}
|
559
|
+
pre.blackboard .Keyword {
|
560
|
+
color: #FBDE2D;
|
561
|
+
}
|
562
|
+
pre.blackboard .LatexEnvironmentNested {
|
563
|
+
background-color: #7691F3;
|
564
|
+
}
|
565
|
+
pre.blackboard .InvalidDeprecated {
|
566
|
+
color: #AB2A1D;
|
567
|
+
font-style: italic;
|
568
|
+
}
|
569
|
+
pre.blackboard .Variable {
|
570
|
+
}
|
571
|
+
pre.blackboard .Entity {
|
572
|
+
color: #FF6400;
|
573
|
+
}
|
574
|
+
pre.blackboard .Comment {
|
575
|
+
color: #AEAEAE;
|
576
|
+
}
|
577
|
+
|
578
|
+
</style>
|
579
|
+
</head>
|
580
|
+
|
581
|
+
<body>
|
582
|
+
<div class="titlepage">
|
583
|
+
<img src="images/glyph.svg" width="20%" height="20%" alt="-"/>
|
434
584
|
|
435
|
-
|
585
|
+
<h1>
|
436
586
|
Glyph
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
by <em>Fabio Cevasco</em>
|
449
|
-
</div>
|
450
|
-
|
451
|
-
|
452
|
-
<div class="pubdate">
|
453
|
-
April 2010
|
454
|
-
</div>
|
587
|
+
</h1>
|
588
|
+
<h2>
|
589
|
+
Rapid Document Authoring Framework
|
590
|
+
</h2>
|
591
|
+
v0.2.0
|
592
|
+
<div class="author">
|
593
|
+
by <em>Fabio Cevasco</em>
|
594
|
+
</div>
|
595
|
+
<div class="pubdate">
|
596
|
+
May 2010
|
597
|
+
</div>
|
455
598
|
|
456
|
-
|
599
|
+
</div>
|
457
600
|
<div class="frontmatter">
|
458
|
-
|
459
|
-
|
460
601
|
<div class="contents">
|
461
602
|
<h2 class="toc-header" id="h_toc">Table of Contents</h2>
|
462
603
|
<ol class="toc">
|
463
|
-
|
464
|
-
<li class="
|
465
|
-
<li
|
604
|
+
<li class="frontmatter introduction"><a href="#h_1">Introduction</a></li>
|
605
|
+
<li><ol><li class="frontmatter section"><a href="#h_2">Main Features</a></li>
|
606
|
+
<li class="frontmatter section"><a href="#h_3">Installation</a></li>
|
607
|
+
<li class="frontmatter section"><a href="#h_4">Essential Glyph commands</a></li>
|
608
|
+
<li class="frontmatter section"><a href="#macros_nutshell">Glyph macros in a nutshell</a></li>
|
609
|
+
<li class="frontmatter section"><a href="#h_6">Resources</a></li>
|
610
|
+
<li class="frontmatter section"><a href="#h_7">License</a></li>
|
611
|
+
</ol></li>
|
612
|
+
<li class="frontmatter acknowledgement"><a href="#h_8">Acknowledgement</a></li>
|
613
|
+
<li class="bodymatter chapter"><a href="#h_9">Getting Started</a></li>
|
614
|
+
<li><ol><li class="bodymatter section"><a href="#h_10">Creating your first Glyph Project</a></li>
|
466
615
|
<li class="bodymatter section"><a href="#struct">Document Structure</a></li>
|
467
616
|
<li class="bodymatter section"><a href="#cfg">Project Configuration</a></li>
|
468
617
|
</ol></li>
|
469
|
-
<li class="bodymatter chapter"><a href="#
|
470
|
-
<li><ol><li class="bodymatter section"><a href="#
|
471
|
-
<li><ol><li class="bodymatter section"><a href="#
|
618
|
+
<li class="bodymatter chapter"><a href="#h_13">Authoring Documents</a></li>
|
619
|
+
<li><ol><li class="bodymatter section"><a href="#h_14">Text Editing</a></li>
|
620
|
+
<li><ol><li class="bodymatter section"><a href="#h_15">Introducing Glyph Macros</a></li>
|
472
621
|
<li class="bodymatter section"><a href="#esc_quot">Escaping and Quoting</a></li>
|
473
622
|
<li class="bodymatter section"><a href="#sec_head">Sections and Headers</a></li>
|
474
|
-
<li class="bodymatter section"><a href="#
|
623
|
+
<li class="bodymatter section"><a href="#incl">Including Files and Snippets</a></li>
|
475
624
|
<li class="bodymatter section"><a href="#links">Links and Bookmarks</a></li>
|
476
|
-
<li class="bodymatter section"><a href="#
|
625
|
+
<li class="bodymatter section"><a href="#h_20">Evaluating Ruby code and Configuration Settings</a></li>
|
626
|
+
<li class="bodymatter section"><a href="#cond_macros">Conditional Macros</a></li>
|
627
|
+
<li><ol><li class="bodymatter section"><a href="#h_22">Using macros inside the condition macro</a></li>
|
628
|
+
<li class="bodymatter section"><a href="#h_23">Results of conditional expressions</a></li>
|
629
|
+
</ol></li>
|
477
630
|
<li class="bodymatter section"><a href="#img_fig">Images and Figures</a></li>
|
631
|
+
<li class="bodymatter section"><a href="#source_code">Source code</a></li>
|
632
|
+
<li><ol><li class="bodymatter section"><a href="#h_26">Inline code</a></li>
|
633
|
+
<li class="bodymatter section"><a href="#h_27">Code block</a></li>
|
634
|
+
</ol></li>
|
478
635
|
</ol></li>
|
479
636
|
<li class="bodymatter section"><a href="#compile">Compiling your project</a></li>
|
480
637
|
<li><ol><li class="bodymatter section"><a href="#stylesheets">Adding Stylesheets</a></li>
|
481
|
-
<li class="bodymatter section"><a href="#
|
482
|
-
|
638
|
+
<li><ol><li class="bodymatter section"><a href="#default_styles">Default Stylesheets</a></li>
|
639
|
+
</ol></li>
|
640
|
+
<li class="bodymatter section"><a href="#h_31">HTML output</a></li>
|
641
|
+
<li class="bodymatter section"><a href="#h_32">PDF Output</a></li>
|
642
|
+
<li class="bodymatter section"><a href="#auto_regeneration">Auto Regeneration</a></li>
|
483
643
|
</ol></li>
|
644
|
+
<li class="bodymatter section"><a href="#lite_mode">Compiling single Glyph files</a></li>
|
645
|
+
<li><ol><li class="bodymatter section"><a href="#lite_limitations">Limitations</a></li>
|
646
|
+
</ol></li>
|
647
|
+
<li class="bodymatter section"><a href="#h_36">Using Glyph programmatically</a></li>
|
484
648
|
</ol></li>
|
485
649
|
<li class="bodymatter chapter"><a href="#extending">Extending Glyph</a></li>
|
486
|
-
<li><ol><li class="bodymatter section"><a href="#
|
487
|
-
<li class="bodymatter section"><a href="#
|
488
|
-
<li class="bodymatter section"><a href="#
|
489
|
-
<li class="bodymatter section"><a href="#
|
490
|
-
<li class="bodymatter section"><a href="#
|
650
|
+
<li><ol><li class="bodymatter section"><a href="#h_38">Anatomy of a Macro</a></li>
|
651
|
+
<li class="bodymatter section"><a href="#h_39">Bookmarks and Headers</a></li>
|
652
|
+
<li class="bodymatter section"><a href="#h_40">Using Placeholders</a></li>
|
653
|
+
<li class="bodymatter section"><a href="#h_41">Using Validators</a></li>
|
654
|
+
<li class="bodymatter section"><a href="#h_42">Interpreting Glyph Code</a></li>
|
655
|
+
<li><ol><li class="bodymatter section"><a href="#encode_decode">Encoding and Decoding Glyph Code</a></li>
|
656
|
+
</ol></li>
|
657
|
+
<li class="bodymatter section"><a href="#h_44">Further Reading</a></li>
|
491
658
|
</ol></li>
|
492
|
-
<li class="bodymatter chapter"><a href="#
|
493
|
-
<li><ol><li class="bodymatter section"><a href="#
|
494
|
-
<li class="bodymatter section"><a href="#
|
495
|
-
<li class="bodymatter section"><a href="#
|
659
|
+
<li class="bodymatter chapter"><a href="#h_45">Troubleshooting</a></li>
|
660
|
+
<li><ol><li class="bodymatter section"><a href="#h_46">Generic Errors</a></li>
|
661
|
+
<li class="bodymatter section"><a href="#h_47">Command Errors</a></li>
|
662
|
+
<li class="bodymatter section"><a href="#h_48">Macro Errors</a></li>
|
496
663
|
</ol></li>
|
497
664
|
<li class="backmatter appendix"><a href="#cmd_ref">Command Reference</a></li>
|
498
|
-
<li><ol><li class="appendix section"><a href="#
|
499
|
-
<li><ol><li class="appendix section"><a href="#
|
665
|
+
<li><ol><li class="appendix section"><a href="#h_50">Global Options</a></li>
|
666
|
+
<li><ol><li class="appendix section"><a href="#debug_switch">-d, --debug</a></li>
|
500
667
|
</ol></li>
|
501
|
-
<li class="appendix section"><a href="#
|
502
|
-
<li><ol><li class="appendix section"><a href="#
|
668
|
+
<li class="appendix section"><a href="#c_add">add</a></li>
|
669
|
+
<li><ol><li class="appendix section"><a href="#h_53">Parameters</a></li>
|
503
670
|
</ol></li>
|
504
|
-
<li class="appendix section"><a href="#
|
505
|
-
<li><ol><li class="appendix section"><a href="#
|
671
|
+
<li class="appendix section"><a href="#c_compile">compile</a></li>
|
672
|
+
<li><ol><li class="appendix section"><a href="#h_55">Parameters</a></li>
|
673
|
+
<li class="appendix section"><a href="#h_56">Options</a></li>
|
506
674
|
</ol></li>
|
507
|
-
<li class="appendix section"><a href="#
|
508
|
-
<li><ol><li class="appendix section"><a href="#
|
509
|
-
<li class="appendix section"><a href="#
|
675
|
+
<li class="appendix section"><a href="#c_config">config</a></li>
|
676
|
+
<li><ol><li class="appendix section"><a href="#h_58">Options</a></li>
|
677
|
+
<li class="appendix section"><a href="#h_59">Parameters</a></li>
|
510
678
|
</ol></li>
|
511
|
-
<li class="appendix section"><a href="#
|
679
|
+
<li class="appendix section"><a href="#c_help">help</a></li>
|
680
|
+
<li><ol><li class="appendix section"><a href="#h_61">Parameters</a></li>
|
681
|
+
</ol></li>
|
682
|
+
<li class="appendix section"><a href="#c_init">init</a></li>
|
512
683
|
<li class="appendix section"><a href="#c_todo">todo</a></li>
|
513
684
|
</ol></li>
|
514
685
|
<li class="backmatter appendix"><a href="#macro_ref">Macro Reference</a></li>
|
515
|
-
<li><ol><li class="appendix section"><a href="#
|
516
|
-
<li><ol><li class="appendix section"><a href="#
|
517
|
-
<li class="appendix section"><a href="#
|
518
|
-
<li class="appendix section"><a href="#
|
519
|
-
<li class="appendix section"><a href="#m_include">include</a></li>
|
520
|
-
<li class="appendix section"><a href="#m_ruby">ruby</a></li>
|
686
|
+
<li><ol><li class="appendix section"><a href="#h_65">Common Macros</a></li>
|
687
|
+
<li><ol><li class="appendix section"><a href="#m_and">and</a></li>
|
688
|
+
<li class="appendix section"><a href="#m_comment">comment</a></li>
|
689
|
+
<li class="appendix section"><a href="#m_condition">condition</a></li>
|
521
690
|
<li class="appendix section"><a href="#m_config">config</a></li>
|
691
|
+
<li class="appendix section"><a href="#m_config_">config:</a></li>
|
692
|
+
<li class="appendix section"><a href="#m_decode">decode</a></li>
|
693
|
+
<li class="appendix section"><a href="#m_encode">encode</a></li>
|
694
|
+
<li class="appendix section"><a href="#m_eq">eq</a></li>
|
522
695
|
<li class="appendix section"><a href="#m_escape">escape</a></li>
|
696
|
+
<li class="appendix section"><a href="#m_include">include</a></li>
|
697
|
+
<li class="appendix section"><a href="#m_match">match</a></li>
|
698
|
+
<li class="appendix section"><a href="#m_macro_">macro:</a></li>
|
699
|
+
<li class="appendix section"><a href="#m_not">not</a></li>
|
700
|
+
<li class="appendix section"><a href="#m_or">or</a></li>
|
701
|
+
<li class="appendix section"><a href="#m_ruby">ruby</a></li>
|
702
|
+
<li class="appendix section"><a href="#m_snippet">snippet</a></li>
|
703
|
+
<li class="appendix section"><a href="#m_snippet_">snippet:</a></li>
|
704
|
+
<li class="appendix section"><a href="#m_todo">todo</a></li>
|
523
705
|
</ol></li>
|
524
706
|
<li class="appendix section"><a href="#f_macros">Filter Macros</a></li>
|
525
|
-
<li><ol><li class="appendix section"><a href="#
|
526
|
-
<li class="appendix section"><a href="#
|
707
|
+
<li><ol><li class="appendix section"><a href="#m_markdown">markdown</a></li>
|
708
|
+
<li class="appendix section"><a href="#m_textile">textile</a></li>
|
527
709
|
</ol></li>
|
528
|
-
<li class="appendix section"><a href="#
|
529
|
-
<li><ol><li class="appendix section"><a href="#
|
530
|
-
<li class="appendix section"><a href="#m_box">box</a></li>
|
710
|
+
<li class="appendix section"><a href="#h_87">Block Macros</a></li>
|
711
|
+
<li><ol><li class="appendix section"><a href="#m_box">box</a></li>
|
531
712
|
<li class="appendix section"><a href="#m_code">code</a></li>
|
532
|
-
<li class="appendix section"><a href="#m_title">title</a></li>
|
533
|
-
<li class="appendix section"><a href="#m_subtitle">subtitle</a></li>
|
534
|
-
<li class="appendix section"><a href="#m_pubdate">pubdate</a></li>
|
535
|
-
<li class="appendix section"><a href="#m_img">img</a></li>
|
536
713
|
<li class="appendix section"><a href="#m_fig">fig</a></li>
|
714
|
+
<li class="appendix section"><a href="#m_highlight">highlight</a></li>
|
715
|
+
<li class="appendix section"><a href="#m_img">img</a></li>
|
716
|
+
<li class="appendix section"><a href="#m_note">note</a></li>
|
717
|
+
<li class="appendix section"><a href="#m_pubdate">pubdate</a></li>
|
718
|
+
<li class="appendix section"><a href="#m_subtitle">subtitle</a></li>
|
537
719
|
<li class="appendix section"><a href="#m_table">table</a></li>
|
538
|
-
<li class="appendix section"><a href="#m_tr">tr</a></li>
|
539
|
-
<li class="appendix section"><a href="#m_th">th</a></li>
|
540
720
|
<li class="appendix section"><a href="#m_td">td</a></li>
|
721
|
+
<li class="appendix section"><a href="#m_title">title</a></li>
|
722
|
+
<li class="appendix section"><a href="#m_th">th</a></li>
|
723
|
+
<li class="appendix section"><a href="#m_tr">tr</a></li>
|
541
724
|
</ol></li>
|
542
|
-
<li class="appendix section"><a href="#
|
725
|
+
<li class="appendix section"><a href="#h_101">Inline Macros</a></li>
|
543
726
|
<li><ol><li class="appendix section"><a href="#m_anchor">anchor</a></li>
|
544
|
-
<li class="appendix section"><a href="#m_link">link</a></li>
|
545
727
|
<li class="appendix section"><a href="#m_codeph">codeph</a></li>
|
728
|
+
<li class="appendix section"><a href="#m_draftcomment">draftcomment</a></li>
|
546
729
|
<li class="appendix section"><a href="#m_fmi">fmi</a></li>
|
730
|
+
<li class="appendix section"><a href="#m_link">link</a></li>
|
547
731
|
</ol></li>
|
548
|
-
<li class="appendix section"><a href="#
|
549
|
-
<li><ol><li class="appendix section"><a href="#
|
550
|
-
<li class="appendix section"><a href="#
|
732
|
+
<li class="appendix section"><a href="#h_107">Structure Macros</a></li>
|
733
|
+
<li><ol><li class="appendix section"><a href="#m_body">body</a></li>
|
734
|
+
<li class="appendix section"><a href="#m_div">div</a></li>
|
551
735
|
<li class="appendix section"><a href="#m_document">document</a></li>
|
552
|
-
<li class="appendix section"><a href="#m_body">body</a></li>
|
553
736
|
<li class="appendix section"><a href="#m_head">head</a></li>
|
737
|
+
<li class="appendix section"><a href="#m_header">header</a></li>
|
738
|
+
<li class="appendix section"><a href="#m_section">section</a></li>
|
554
739
|
<li class="appendix section"><a href="#m_style">style</a></li>
|
555
740
|
<li class="appendix section"><a href="#m_toc">toc</a></li>
|
556
741
|
</ol></li>
|
557
742
|
</ol></li>
|
558
743
|
<li class="backmatter appendix"><a href="#cfg_ref">Configuration Reference</a></li>
|
744
|
+
<li><ol><li class="appendix section"><a href="#h_117">document.*</a></li>
|
745
|
+
<li class="appendix section"><a href="#h_118">filters.*</a></li>
|
746
|
+
<li class="appendix section"><a href="#s_highlighters">highlighters.*</a></li>
|
747
|
+
<li class="appendix section"><a href="#h_120">structure.*</a></li>
|
748
|
+
<li class="appendix section"><a href="#h_121">tools.*</a></li>
|
749
|
+
</ol></li>
|
750
|
+
<li class="backmatter appendix"><a href="#h_122">Changelog</a></li>
|
751
|
+
<li><ol><li class="appendix section"><a href="#h_123">v0.2.0 – May 9th 2010</a></li>
|
752
|
+
<li><ol><li class="appendix section"><a href="#h_124">11 Features Implemented</a></li>
|
753
|
+
<li class="appendix section"><a href="#h_125">8 Bugs Fixed</a></li>
|
754
|
+
</ol></li>
|
755
|
+
<li class="appendix section"><a href="#h_126">v0.1.0 – April 8th 2010</a></li>
|
756
|
+
</ol></li>
|
559
757
|
|
560
758
|
</ol>
|
561
759
|
</div>
|
562
760
|
<div class="introduction">
|
563
|
-
|
564
|
-
<h2 id="h_1">Introduction</h2>
|
565
|
-
|
761
|
+
<h2 id="h_1">Introduction</h2>
|
566
762
|
<p>Glyph is a <em>Rapid Document Authoring Framework</em>.</p>
|
567
763
|
<p>Think of it like a sort of <a href="http://www.rubyonrails.org">Ruby on Rails</a> but for creating text documents instead of web sites. With Glyph, you can manage your documents tidily in <em>projects</em> that can be used to generate deliverables in different formats such as <span class="caps">HTML</span> or <span class="caps">PDF</span> (through <a href="http://www.princexml.com/">Prince</a>).</p>
|
568
764
|
<div class="section">
|
569
|
-
|
570
|
-
|
571
|
-
<p>Glyph uses a <a href="#macros_nutshell">simple macro system</a> to perform a wide variety of advanced tasks:</p>
|
765
|
+
<h3 id="h_2">Main Features</h3>
|
766
|
+
<p>Glyph uses a simple macro system to perform a wide variety of advanced tasks:</p>
|
572
767
|
<ul>
|
573
768
|
<li>Generate block-level <span class="caps">HTML</span> tags not commonly managed by lightweight markups, like <code>head</code>, <code>body</code>, <code>div</code> and <code>table</code>.</li>
|
574
769
|
<li>Create and validate internal and external links.</li>
|
@@ -578,35 +773,39 @@ table, .box, .note, .important, .tip, .caution, .code { page-break-inside: avoid
|
|
578
773
|
<li>Store common snippets of text in a single <span class="caps">YAML</span> file and use them anywhere in your document, as many times as you need.</li>
|
579
774
|
<li>Store configuration settings in a <span class="caps">YAML</span> file and use them anywhere in your document, as many times as you need.</li>
|
580
775
|
<li>Evaluate Ruby code within your document.</li>
|
581
|
-
<li>
|
776
|
+
<li>Include content only if certain conditions are satisfied.</li>
|
777
|
+
<li>Define macros, snippets and configuration settings directly within your document.</li>
|
778
|
+
<li>Highlight source code.</li>
|
779
|
+
<li>Call macros from other macros (including snippets), avoiding mutual calls.</li>
|
582
780
|
<li>Include text files in other text files.</li>
|
583
|
-
<li>Include the
|
781
|
+
<li>Include the value of any configuration setting (like author, title) in the document.</li>
|
584
782
|
<li>Filter input explicitly or implicitly, based on file extensions when including files.</li>
|
585
|
-
<li>Manage comments and todo items.</li>
|
783
|
+
<li>Manage draft comments and todo items.</li>
|
586
784
|
</ul>
|
587
785
|
</div>
|
588
786
|
<div class="section">
|
589
|
-
|
590
|
-
|
787
|
+
<h3 id="h_3">Installation</h3>
|
591
788
|
<p><code>gem install glyph</code> — simple, as always.</p>
|
592
789
|
</div>
|
593
790
|
<div class="section">
|
594
|
-
|
595
|
-
|
596
|
-
<p>Glyph is 100% command line. Its interface resambles <a href="http://git-scm.com/">Git’s</a> for its simplicity and power (thanks to the <a href="http://github.com/davetron5000/gli">Gli</a> gem). Here are some example commands:</p>
|
791
|
+
<h3 id="h_4">Essential Glyph commands</h3>
|
792
|
+
<p>Glyph is 100% command line. Its interface resambles <a href="http://git-scm.com/">Git’s</a> for its simplicity and power (thanks to the <a href="http://github.com/davetron5000/gli">gli</a> gem). Here are some example commands:</p>
|
597
793
|
<ul>
|
598
794
|
<li><code>glyph init</code> — to initialize a new Glyph project in the current (empty) directory.</li>
|
599
795
|
<li><code>glyph add introduction.textile</code> — to create a new file called <em>introduction.textile</em>.</li>
|
600
796
|
<li><code>glyph compile</code> — to compile the current document into a single <span class="caps">HTML</span> file.</li>
|
797
|
+
<li><code>glyph compile --auto</code> — to keep recompiling the current document every time a file is changed.</li>
|
601
798
|
<li><code>glyph compile -f pdf</code> — to compile the current document into <span class="caps">HTML</span> and then transform it into <span class="caps">PDF</span> using <a href="http://www.princexml.com/">Prince</a>.</li>
|
799
|
+
<li><code>glyph compile readme.glyph</code> — to compile a <em>readme.glyph</em> located in the current directory into a single <span class="caps">HTML</span> file.</li>
|
602
800
|
</ul>
|
603
801
|
</div>
|
604
802
|
<div class="section">
|
605
|
-
|
606
|
-
|
803
|
+
<h3 id="macros_nutshell">Glyph macros in a nutshell</h3>
|
607
804
|
<p>Format your documents using Textile or Markdown, and use Glyph Macros to do everything else:</p>
|
608
805
|
<p><b>Glyph Source:</b></p>
|
609
|
-
<div class="code"
|
806
|
+
<div class="code">
|
807
|
+
<pre>
|
808
|
+
<code>
|
610
809
|
section[header[Something about Glyph]
|
611
810
|
You can use Glyph macros in conjunction
|
612
811
|
with _Textile_ or _Markdown_ to
|
@@ -615,12 +814,16 @@ produce HTML files effortlessly.
|
|
615
814
|
Once you have a single, well-formatted HTML
|
616
815
|
file, converting it to PDF is
|
617
816
|
extremely easy with a 3rd-party
|
618
|
-
renderer like =&
|
817
|
+
renderer like =>[http://www.princexml.com|Prince].
|
619
818
|
]
|
620
819
|
]
|
621
|
-
</code
|
820
|
+
</code>
|
821
|
+
</pre>
|
822
|
+
</div>
|
622
823
|
<p><b><span class="caps">HTML</span> Output:</b></p>
|
623
|
-
<div class="code"
|
824
|
+
<div class="code">
|
825
|
+
<pre>
|
826
|
+
<code>
|
624
827
|
<div class="section">
|
625
828
|
<h2 id="h_10">Something about Glyph</h2>
|
626
829
|
<p>You can use Glyph macros in conjunction with
|
@@ -634,48 +837,91 @@ renderer like =&gt;[http://www.princexml.com|Prince].
|
|
634
837
|
like <a href="http://www.princexml.com">Prince</a>.</p>
|
635
838
|
</div>
|
636
839
|
</div>
|
637
|
-
</code
|
840
|
+
</code>
|
841
|
+
</pre>
|
842
|
+
</div>
|
843
|
+
</div>
|
638
844
|
<div class="section">
|
639
|
-
|
640
|
-
|
845
|
+
<h3 id="h_6">Resources</h3>
|
641
846
|
<ul>
|
642
847
|
<li>Home Page: <a href="http://www.h3rald.com/glyph/">http://www.h3rald.com/glyph/</a></li>
|
643
848
|
<li>Repository: <a href="http://www.github.com/h3rald/glyph/">http://www.github.com/h3rald/glyph/</a></li>
|
644
849
|
<li>Bug Tracking: <a href="http://www.github.com/h3rald/glyph/issues">http://www.github.com/h3rald/glyph/issues</a></li>
|
645
|
-
<li>
|
646
|
-
<li>
|
850
|
+
<li>Development Wiki <a href="http://wiki.github.com/h3rald/glyph">http://wiki.github.com/h3rald/glyph</a></li>
|
851
|
+
<li>RubyGem Download <a href="http://www.rubygems.org/gems/glyph">http://www.rubygems.org/gems/glyph</a></li>
|
852
|
+
<li>Book (<span class="caps">PDF</span>): <a href="http://github.com/h3rald/glyph/raw/0.2.0/book/output/pdf/glyph.pdf">http://github.com/h3rald/glyph/raw/0.2.0/book/output/pdf/glyph.pdf</a></li>
|
853
|
+
<li>Reference Documentation: <a href="http://yardoc.org/docs/glyph/">http://yardoc.org/docs/glyph/</a></li>
|
647
854
|
<li>User Group: <a href="http://groups.google.com/group/glyph-framework">http://groups.google.com/group/glyph-framework</a></li>
|
648
855
|
</ul>
|
649
856
|
</div>
|
857
|
+
<div class="section">
|
858
|
+
<h3 id="h_7">License</h3>
|
859
|
+
<p>Copyright © 2010 <b>Fabio Cevasco</b>, <a href="http://www.h3rald.com">http://www.h3rald.com</a></p>
|
860
|
+
<div class="code">
|
861
|
+
<pre>
|
862
|
+
<code>
|
863
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
864
|
+
of this software and associated documentation files (the "Software"), to deal
|
865
|
+
in the Software without restriction, including without limitation the rights
|
866
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
867
|
+
copies of the Software, and to permit persons to whom the Software is
|
868
|
+
furnished to do so, subject to the following conditions:
|
869
|
+
|
870
|
+
The above copyright notice and this permission notice shall be included in
|
871
|
+
all copies or substantial portions of the Software.
|
872
|
+
|
873
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
874
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
875
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
876
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
877
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
878
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
879
|
+
THE SOFTWARE.
|
880
|
+
</code>
|
881
|
+
</pre>
|
882
|
+
</div>
|
883
|
+
|
884
|
+
</div>
|
885
|
+
|
886
|
+
</div>
|
887
|
+
<div class="acknowledgement">
|
888
|
+
<h2 id="h_8">Acknowledgement</h2>
|
889
|
+
<p>Glyph was designed and developed by <a href="http://www.h3rald.com">Fabio Cevasco</a> (h3rald).</p>
|
890
|
+
<p>Special thanks to the following individuals who contributed to Glyph by reporting and fixing issues and/or proposing and implementing new features:</p>
|
891
|
+
<ul>
|
892
|
+
<li><a href="http://www.jabbslad.com">Jamie Atkinson</a> (Jabbslad)</li>
|
893
|
+
<li><a href="http://koraktor.github.com">Sebastian Staudt</a> (koraktor)</li>
|
894
|
+
</ul>
|
650
895
|
|
651
|
-
|
896
|
+
</div>
|
652
897
|
|
653
|
-
|
898
|
+
</div>
|
654
899
|
<div class="bodymatter">
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
<h2 id="h_7">Getting Started</h2>
|
659
|
-
|
900
|
+
<div class="chapter">
|
901
|
+
<h2 id="h_9">Getting Started</h2>
|
660
902
|
<div class="section">
|
661
|
-
|
662
|
-
|
903
|
+
<h3 id="h_10">Creating your first Glyph Project</h3>
|
663
904
|
<p>To install Glyph, simply run <code>gem install glyph</code>, like with any other Ruby gem. Then, create a new directory and initialize a new Glyph project, like so:</p>
|
664
905
|
<p><code>mkdir</code> <em>test_document</em></p>
|
665
906
|
<p><code>cd</code> <em>test_document</em></p>
|
666
907
|
<p><code>glyph init</code></p>
|
667
908
|
<p>That’s it. You just created a new Glyph project in the <code>test_document</code> directory.</p>
|
668
|
-
<div class="box"
|
669
|
-
Glyph
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
<
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
909
|
+
<div class="box">
|
910
|
+
<div class="box-title">Glyph’s dependencies</div>
|
911
|
+
<p>Glyph requires the following gems:</p>
|
912
|
+
<ul>
|
913
|
+
<li>extlib</li>
|
914
|
+
<li>gli</li>
|
915
|
+
<li>treetop</li>
|
916
|
+
<li>rake</li>
|
917
|
+
</ul>
|
918
|
+
<p>Additionally, some Glyph macros may require additional gems, such as:</p>
|
919
|
+
<ul>
|
920
|
+
<li>RedCloth (<a href="#m_textile">textile</a> macro)</li>
|
921
|
+
<li>BlueCloth <em>or</em> RDiscount <em>or</em> Maruku <em>or</em> Kramdown (<a href="#m_markdown">markdown</a> macro)</li>
|
922
|
+
<li>Haml (if you want to load .sass files with the <a href="#m_style">style</a> macro)</li>
|
923
|
+
</ul>
|
924
|
+
</div>
|
679
925
|
<p>Every Glyph project is comprised of the following directories:</p>
|
680
926
|
<ul>
|
681
927
|
<li><code>images/</code> — used to store the image files used in your document.</li>
|
@@ -688,15 +934,16 @@ Additionally, some Glyph macros may require additional gems, such as:<br />
|
|
688
934
|
<ul>
|
689
935
|
<li><code>config.yml</code> — containing your <a href="#cfg">Project Configuration</a>.</li>
|
690
936
|
<li><code>document.glyph</code> — containing your <a href="#struct">Document Structure</a></li>
|
691
|
-
<li><code>snippets.yml</code> — containing your text snippets
|
937
|
+
<li><code>snippets.yml</code> — containing your text <a href="#incl">snippets</a>.</li>
|
692
938
|
</ul>
|
693
939
|
</div>
|
694
940
|
<div class="section">
|
695
|
-
|
941
|
+
<h3 id="struct">Document Structure</h3>
|
942
|
+
<p>Every Glyph project contains a <code>document.glyph</code> file that is typically used to define the document structure. The default <code>document.glyph</code> generated automatically when creating a new project is the following:</p>
|
696
943
|
|
697
|
-
<
|
698
|
-
|
699
|
-
<
|
944
|
+
<div class="code">
|
945
|
+
<pre>
|
946
|
+
<code>
|
700
947
|
document[
|
701
948
|
head[style[default.css]]
|
702
949
|
body[
|
@@ -726,26 +973,27 @@ document[
|
|
726
973
|
]
|
727
974
|
]
|
728
975
|
]
|
729
|
-
</code
|
976
|
+
</code>
|
977
|
+
</pre>
|
978
|
+
</div>
|
730
979
|
<p>Even without knowing anything about Glyph Language, you can easily figure out that this file defines a document with a Table of Contents, a Preface and some Chapters. <code>frontmatter[]</code>, <code>preface[]</code>, <code>chapter[]</code>, etc. are all Glyph <em>macros</em> used to define — in this case — some structural elements. In practice, this means that if you plan to generate an <span class="caps">HTML</span> document, they’ll be converted into <code><div></code> tags.</p>
|
731
980
|
<p>Be aware that other macros, on the other hand, are used to do something completely different, e.g.:</p>
|
732
981
|
<ul>
|
733
982
|
<li><code>toc[]</code> generates the document’s Table of Contents</li>
|
734
|
-
<li><code>@[]</code> or its alias <code>include[]</code> is used to copy the contents of another file stored anywhere in the <code
|
983
|
+
<li><code>@[]</code> or its alias <code>include[]</code> is used to copy the contents of another file stored anywhere in the <code>text/</code> directory.</li>
|
735
984
|
</ul>
|
736
985
|
<p>Let’s now analyze this <code>document.glyph</code> more in detail.</p>
|
737
986
|
<ul>
|
738
987
|
<li>The <code>document[]</code> macro wraps every other macro. This is necessary to create the initial <code><html></code> tag.</li>
|
739
988
|
<li>Similarly, <code>head[]</code> and <code>body[]</code> are used to generate the respective <span class="caps">HTML</span> tags. Actually, <code>head[]</code> already sets some metadata for you, by default (author and copyright).</li>
|
740
|
-
<li>Within <code>head[]</code>, the <code>style[]</code> macro is used to load the <code>default.css</code> stylesheet, which is
|
989
|
+
<li>Within <code>head[]</code>, the <code>style[]</code> macro is used to load the <code>default.css</code> stylesheet, which is one of the <a href="#default_styles">default Glyph styleseets</a>.</li>
|
741
990
|
<li>Immediately after the <code>body[]</code> macro, the <code>titlepage[]</code> macro is used to define (guess…) the first page of your document. <code>title[]</code>, <code>author[]</code> and <code>pubdate[]</code> insert the title of the document, its author and the publication date (retrieved from the project’s <a href="#cfg">configuration settings</a>).</li>
|
742
991
|
<li>Then, the <code>frontmatter[]</code>, <code>bodymatter[]</code> and <code>backmatter[]</code> macros are used to further divide the portions of your document according to the rules of <a href="http://en.wikipedia.org/wiki/Book_design">book design</a>. They are not mandatory, but they can be used, for example, to number your appendixes with letters instead of numbers and similar.</li>
|
743
992
|
<li><code>preface[]</code>, <code>chapter[]</code>, <code>appendix[]</code> are just a way to wrap content in <code><div></code> tags, from an <span class="caps">HTML</span> point of view, but they are also necessary to nest the content of your document and generate the Table of Contents automatically, together with the <code>header[]</code> macro.</li>
|
744
993
|
</ul>
|
745
994
|
</div>
|
746
995
|
<div class="section">
|
747
|
-
|
748
|
-
|
996
|
+
<h3 id="cfg">Project Configuration</h3>
|
749
997
|
<p>Glyph stores configuration settings in the following <span class="caps">YAML</span> files:</p>
|
750
998
|
<ol>
|
751
999
|
<li>Your <em>Project Configuration</em> is stored in the <code>config.yml</code> file, included in each Glyph Project.</li>
|
@@ -757,73 +1005,84 @@ document[
|
|
757
1005
|
<li>A setting configured in the <em>Project Configuration</em> overrides the same setting in both Global and System configuration.</li>
|
758
1006
|
<li>A setting configured in the <em>Global Configuration</em> overrides the same setting in the <em>System Configuration</em></li>
|
759
1007
|
</ul>
|
760
|
-
<p>Typically, you should use the <em>Project Configuration</em> for all project-specific settings and the <em>Global Configuration</em> for settings affecting all your projects (for example, you may want to set
|
761
|
-
<p>Instead of editing your configuration settings directly, you can use the <
|
1008
|
+
<p>Typically, you should use the <em>Project Configuration</em> for all project-specific settings and the <em>Global Configuration</em> for settings affecting all your projects (for example, you may want to set the <a href="#s_document_author">document.author</a> setting in the Global Configuration instead of setting it in the Project Configuration of all your Glyph projects). The <em>System Configuration</em> is best left untouched.</p>
|
1009
|
+
<p>Instead of editing your configuration settings directly, you can use the <a href="#c_config">config</a> command, as follows:</p>
|
762
1010
|
<p><code>glyph config</code> <em>setting</em> <em>[value]</em></p>
|
763
1011
|
<p>If no <em>value</em> is specified, glyph just prints the value of the configuration setting, so typing <code>glyph config document.author</code> right after creating a project (assuming you didn’t set this in the Global Configuration) will print nothing, because this setting is blank by default.</p>
|
764
1012
|
<p>To change the value of a configuration setting, specify a value right after the setting, like this:</p>
|
765
1013
|
<p><code>glyph config document.author "John Smith"</code></p>
|
1014
|
+
<div class="tip">
|
1015
|
+
<p><span class="note-title">Tip</span>It is also possible to change configuration settings inside your document, using the <a href="#m_config_">config:</a> macro.</p>
|
1016
|
+
</div>
|
766
1017
|
<p>In this way, the document author will be set to <em>John Smith</em> for the current project. To save this setting globally, add a <code>-g</code> option, like this:</p>
|
767
1018
|
<p><code>glyph config -g document.author "John Smith"</code></p>
|
768
|
-
<div class="box"
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
<
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
1019
|
+
<div class="box">
|
1020
|
+
<div class="box-title">Regarding configuration values and data types…</div>
|
1021
|
+
<p>Glyph attempts to “guess” the data type of a configuration values by evaluation (<code>Kernel#instance_eval</code>) if the value:</p>
|
1022
|
+
<ul>
|
1023
|
+
<li>is wrapped in quotes (<code>"</code> or <code>'</code>) → <code>String</code></li>
|
1024
|
+
<li>starts with a colon (<code>:</code>) → <code>Symbol</code></li>
|
1025
|
+
<li>is wrapped in square brackets (<code>[</code> and <code>]</code>) → <code>Array</code></li>
|
1026
|
+
<li>is wrapped in curly brackets (<code>{</code> and <code>}</code>) → <code>Hash</code></li>
|
1027
|
+
<li>is <em>true</em> or <em>false</em> → <code>Boolean</code></li>
|
1028
|
+
<li>is <em>nil</em> → <code>NilClass</code></li>
|
1029
|
+
</ul>
|
1030
|
+
<p>Note that this guessing is far from being foolproof: If you type something like <em>{:test, 2}</em>, for example, you’ll get an error.</p>
|
1031
|
+
</div>
|
1032
|
+
<p>There are plenty of configuration settings that can be modified, but most of them are best if left alone (and in the System Configuration file).</p>
|
1033
|
+
<p>For a complete reference, see <a href="#cfg_ref">Configuration Reference</a>. Normally, you may just want to change the following ones:</p>
|
1034
|
+
<table>
|
1035
|
+
<tr>
|
1036
|
+
<th>Setting</th>
|
1037
|
+
<th>Description</th>
|
782
1038
|
</tr>
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
1039
|
+
<tr>
|
1040
|
+
<th><code>document.author</code></th>
|
1041
|
+
<td>
|
1042
|
+
<p>The author of the document</p>
|
1043
|
+
</td>
|
787
1044
|
</tr>
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
1045
|
+
<tr>
|
1046
|
+
<th><code>document.title</code></th>
|
1047
|
+
<td>
|
1048
|
+
<p>The title of the document</p>
|
1049
|
+
</td>
|
792
1050
|
</tr>
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
1051
|
+
<tr>
|
1052
|
+
<th><code>document.filename</code></th>
|
1053
|
+
<td>
|
1054
|
+
<p>The document file name</p>
|
1055
|
+
</td>
|
797
1056
|
</tr>
|
798
1057
|
</table>
|
799
1058
|
</div>
|
800
1059
|
|
801
|
-
|
1060
|
+
</div>
|
802
1061
|
<div class="chapter">
|
803
|
-
|
804
|
-
<h2 id="h_11">Authoring Documents</h2>
|
805
|
-
|
1062
|
+
<h2 id="h_13">Authoring Documents</h2>
|
806
1063
|
<div class="section">
|
807
|
-
|
808
|
-
|
809
|
-
<p>One of the aims of Glyph is streamlining text editing. Glyph accomplishes this through its own macro language that can be used in conjunction with Textile or Markdown.</p>
|
1064
|
+
<h3 id="h_14">Text Editing</h3>
|
1065
|
+
<p>One of the main purposes of Glyph is streamlining text editing. Glyph accomplishes this through its own macro language that can be used in conjunction with Textile or Markdown.</p>
|
810
1066
|
<div class="section">
|
811
|
-
|
812
|
-
|
1067
|
+
<h4 id="h_15">Introducing Glyph Macros</h4>
|
813
1068
|
<p>By now you probably figured out what a macro looks like: it’s an identifier of some kind that wraps a value or parameters within square brackets. More specifically:</p>
|
814
1069
|
<ul>
|
815
1070
|
<li>The macro identifier can contain <em>any</em> character except for: <code>[</code>, <code>]</code>, <code>\</code>, <code>|</code> or spaces.</li>
|
816
1071
|
<li>The delimiters can be either <code>[</code> and <code>]</code> or <code>[=</code> and <code>=]</code> (<span class="fmi">for more information on differences between delimiters, see <a href="#esc_quot">Escaping and Quoting</a></span>).</li>
|
817
|
-
<li>The value can be anything, even other macros. If a macro supports more than one parameter, they must be separated with <code>|</code>. For example, the <
|
1072
|
+
<li>The value can be anything, even other macros. If a macro supports more than one parameter, they must be separated with <code>|</code>. For example, the <a href="#m_link">link</a> macro can take an optional second parameter for the link text: <code>link[#link_id|This is the link text]</code>.</li>
|
818
1073
|
</ul>
|
819
|
-
</
|
820
|
-
<
|
821
|
-
|
822
|
-
|
823
|
-
<
|
824
|
-
<
|
825
|
-
<p>
|
826
|
-
<
|
1074
|
+
<p>A macro can often have one or more aliases. For example, <code>=></code> is an alias for the <a href="#m_link">link</a> macro, so the following macro calls are equivalent:</p>
|
1075
|
+
<p><code>=>[#test|Test Section]</code><br />
|
1076
|
+
<code>link[#test|Test Section]</code></p>
|
1077
|
+
</div>
|
1078
|
+
<div class="section">
|
1079
|
+
<h4 id="esc_quot">Escaping and Quoting</h4>
|
1080
|
+
<p>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 <em>too</em> bad if you think about it, unless you’re writing programming code, in which case escaping every single square bracket can be painful.</p>
|
1081
|
+
<p>If a portion of your text contains an excessive amount of square brackets, you may consider using the <a href="#m_escape">escape</a> macro (or its alias <code>.</code>) with the <code>[=</code> and <code>=]</code> 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 <code>[=</code> and <code>=]</code> will <em>not</em> be evaluated.</p>
|
1082
|
+
<p>You can use the quoting delimiters with <em>any</em> macro identifier. Obviously, using them as delimiters for things like <a href="#m_section">section</a> macros may not be a good idea, but they should be more or less mandatory with the <a href="#m_code">code</a> macro, like this:</p>
|
1083
|
+
<div class="code">
|
1084
|
+
<pre>
|
1085
|
+
<code>
|
827
1086
|
code[=
|
828
1087
|
section[header[A section]
|
829
1088
|
|
@@ -834,66 +1093,94 @@ This is another section.
|
|
834
1093
|
]
|
835
1094
|
]
|
836
1095
|
=]
|
837
|
-
</code
|
838
|
-
|
1096
|
+
</code>
|
1097
|
+
</pre>
|
1098
|
+
</div>
|
1099
|
+
<div class="note">
|
1100
|
+
<p><span class="note-title">Note</span>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.</p>
|
1101
|
+
</div>
|
839
1102
|
<p>Besides square brackets, there are other characters that must or can be escaped with backslashes, as shown in the following table</p>
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
</tr>
|
846
|
-
|
847
|
-
<tr><td><code>\[</code> </td>
|
848
|
-
|
849
|
-
<td><code>[</code> </td>
|
850
|
-
|
851
|
-
<td>Square brackets must be escaped unless used as macro delimiters or within a quoting macro. </td>
|
852
|
-
</tr>
|
853
|
-
|
854
|
-
<tr><td><code>\]</code> </td>
|
855
|
-
|
856
|
-
<td><code>]</code> </td>
|
857
|
-
|
858
|
-
<td>Square brackets must be escaped unless used as macro delimiters or within a quoting macro. </td>
|
859
|
-
</tr>
|
860
|
-
|
861
|
-
<tr><td><code>\\</code> </td>
|
862
|
-
|
863
|
-
<td><code>\</code> </td>
|
864
|
-
|
865
|
-
<td>Backslashes do not have to be escaped by default, but an escaped backslash will evaluate to itself. </td>
|
1103
|
+
<table>
|
1104
|
+
<tr>
|
1105
|
+
<th>Escape Sequence</th>
|
1106
|
+
<th>Evaluates to…</th>
|
1107
|
+
<th>Notes</th>
|
866
1108
|
</tr>
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
1109
|
+
<tr>
|
1110
|
+
<td>
|
1111
|
+
<p><code>[</code></p>
|
1112
|
+
</td>
|
1113
|
+
<td>
|
1114
|
+
<p><code>[</code></p>
|
1115
|
+
</td>
|
1116
|
+
<td>
|
1117
|
+
<p>Square brackets must be escaped unless used as macro delimiters or within a quoting macro.</p>
|
1118
|
+
</td>
|
873
1119
|
</tr>
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
1120
|
+
<tr>
|
1121
|
+
<td>
|
1122
|
+
<p><code>]</code></p>
|
1123
|
+
</td>
|
1124
|
+
<td>
|
1125
|
+
<p><code>]</code></p>
|
1126
|
+
</td>
|
1127
|
+
<td>
|
1128
|
+
<p>Square brackets must be escaped unless used as macro delimiters or within a quoting macro.</p>
|
1129
|
+
</td>
|
880
1130
|
</tr>
|
881
|
-
|
882
|
-
<tr><td><code>\.</code> </td>
|
883
|
-
|
1131
|
+
<tr>
|
884
1132
|
<td>
|
1133
|
+
<p><code>\\</code></p>
|
1134
|
+
</td>
|
1135
|
+
<td>
|
1136
|
+
<p><code>\</code></p>
|
1137
|
+
</td>
|
1138
|
+
<td>
|
1139
|
+
<p>Backslashes do not have to be escaped by default, but an escaped backslash will evaluate to itself.</p>
|
885
1140
|
</td>
|
886
|
-
|
887
|
-
<td>An escaped dot evaluates to nothing. Useful to separate macro identifiers from other characters:<br />
|
888
|
-
<code>_=>[#link|This is an emphasized link]_</code> </td>
|
889
1141
|
</tr>
|
890
|
-
|
891
|
-
|
892
|
-
<
|
893
|
-
|
894
|
-
|
895
|
-
<p
|
896
|
-
|
1142
|
+
<tr>
|
1143
|
+
<td>
|
1144
|
+
<p><code>\=</code></p>
|
1145
|
+
</td>
|
1146
|
+
<td>
|
1147
|
+
<p><code>=</code></p>
|
1148
|
+
</td>
|
1149
|
+
<td>
|
1150
|
+
<p>Equal signs do not have to be escaped by default, but an escaped equal sign will evaluate to iself.</p>
|
1151
|
+
</td>
|
1152
|
+
</tr>
|
1153
|
+
<tr>
|
1154
|
+
<td>
|
1155
|
+
<p><code>|</code></p>
|
1156
|
+
</td>
|
1157
|
+
<td>
|
1158
|
+
<p><code>|</code></p>
|
1159
|
+
</td>
|
1160
|
+
<td>
|
1161
|
+
<p>Pipes must be escaped (even within quoting macros) unless they are used to separate macro parameters.</p>
|
1162
|
+
</td>
|
1163
|
+
</tr>
|
1164
|
+
<tr>
|
1165
|
+
<td>
|
1166
|
+
<p><code>\.</code></p>
|
1167
|
+
</td>
|
1168
|
+
<td>
|
1169
|
+
<p> </p>
|
1170
|
+
</td>
|
1171
|
+
<td>
|
1172
|
+
<p>An escaped dot evaluates to nothing. Useful to separate macro identifiers from other characters:<br />
|
1173
|
+
<code>_\.=>[#link|This link is emphasized using Textile]_</code></p>
|
1174
|
+
</td>
|
1175
|
+
</tr>
|
1176
|
+
</table>
|
1177
|
+
</div>
|
1178
|
+
<div class="section">
|
1179
|
+
<h4 id="sec_head">Sections and Headers</h4>
|
1180
|
+
<p>Glyph documents are normally organized as a hierarchical tree of nested chapters, appendixes, sections, etc. To define a section, use the <a href="#m_section">section</a> macro, like so:</p>
|
1181
|
+
<div class="code">
|
1182
|
+
<pre>
|
1183
|
+
<code>
|
897
1184
|
section[
|
898
1185
|
header[Section #1]
|
899
1186
|
|
@@ -906,356 +1193,692 @@ This section is nested into the previous one.
|
|
906
1193
|
|
907
1194
|
] --[End of Section #2]
|
908
1195
|
] --[End of Section #1]
|
909
|
-
</code
|
1196
|
+
</code>
|
1197
|
+
</pre>
|
1198
|
+
</div>
|
910
1199
|
<p>This example defines two nested sections, each with its own header. The header is <em>mandatory</em>: it will be displayed at the start of the section and in the Table of Contents.</p>
|
911
1200
|
<p>Note an important difference from <span class="caps">HTML</span>: there is no explicit level for the headers, as it will be determined at runtime when the document is compiled, based on how sections are nested. The previous code snippet (taken as it is), for example, will be transformed into the following <span class="caps">HTML</span> code:</p>
|
912
|
-
<
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
</
|
1201
|
+
<pre class="blackboard">
|
1202
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">div</span> <span class="MetaTag">class</span>=<span class="String"><span class="String">"</span>section<span class="String">"</span></span><span class="MetaTag">></span></span>
|
1203
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">h2</span><span class="MetaTag">></span></span>Section #1<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">h2</span><span class="MetaTag">></span></span>
|
1204
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>Write the section contents here...<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>
|
1205
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">div</span> <span class="MetaTag">class</span>=<span class="String"><span class="String">"</span>section<span class="String">"</span></span><span class="MetaTag">></span></span>
|
1206
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">h3</span><span class="MetaTag">></span></span>Section #2<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">h3</span><span class="MetaTag">></span></span>
|
1207
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>This section is nested in the previous one<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>
|
1208
|
+
<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">div</span><span class="MetaTag">></span></span>
|
1209
|
+
<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">div</span><span class="MetaTag">></span></span>
|
1210
|
+
</pre>
|
922
1211
|
<p>By default, in Glyph the first header level is <em>2</em>, so the two headers are rendered as <code>h2</code> and <code>h3</code>, respectively (<code>--[...]</code> macros are <em>comments</em>, therefore they are not included in the final output).</p>
|
923
|
-
<p>There are <em>a lot</em> of macros that can be used in the same way as <code>section</code>, one for each element
|
1212
|
+
<p>There are <em>a lot</em> of macros that can be used in the same way as <code>section</code>, one for each element commonly used in <a href="http://en.wikipedia.org/wiki/Book_design">Book Design</a>. Each one of them is a simple wrapper for a <code><div></code> tag with a <code>class</code> attribute set to its name.</p>
|
924
1213
|
<p>The following table lists the identifiers of all section-like macros, divided according to the part of the book they should be placed in:</p>
|
925
|
-
|
926
|
-
|
927
|
-
|
1214
|
+
<table>
|
1215
|
+
<tr>
|
1216
|
+
<td>
|
1217
|
+
<p><strong>Frontmatter</strong></p>
|
1218
|
+
</td>
|
1219
|
+
<td>
|
1220
|
+
<p><code>imprint</code> <sup>†</sup>, <code>dedication</code> <sup>†</sup>, <code>inspiration</code> <sup>†</sup>, <code>foreword</code> <sup>‡</sup>, <code>introduction</code> <sup>‡</sup>, <code>acknowledgement</code> <sup>‡</sup>, <code>prologue</code> <sup>‡</sup>, <code>toc</code> <sup>*</sup></p>
|
1221
|
+
</td>
|
928
1222
|
</tr>
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
1223
|
+
<tr>
|
1224
|
+
<td>
|
1225
|
+
<p><strong>Bodymatter</strong></p>
|
1226
|
+
</td>
|
1227
|
+
<td>
|
1228
|
+
<p><code>volume</code>, <code>book</code>, <code>part</code>, <code>chapter</code></p>
|
1229
|
+
</td>
|
933
1230
|
</tr>
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
1231
|
+
<tr>
|
1232
|
+
<td>
|
1233
|
+
<p><strong>Backmatter</strong></p>
|
1234
|
+
</td>
|
1235
|
+
<td>
|
1236
|
+
<p><code>epilogue</code> <sup>‡</sup>, <code>afterword</code> <sup>‡</sup>, <code>postscript</code> <sup>†</sup>, <code>appendix</code>, <code>addendum</code> <sup>‡</sup>, <code>glossary</code> <sup>**‡</sup>, <code>colophon</code> <sup>†</sup>, <code>bibliography</code> <sup>**‡</sup>, <code>promotion</code> <sup>†</sup>, <code>references</code> <sup>**‡</sup>, <code>index</code> <sup>**‡</sup>, <code>lot</code> <sup>**‡</sup>, <code>lof</code> <sup>**‡</sup></p>
|
1237
|
+
</td>
|
938
1238
|
</tr>
|
939
1239
|
</table>
|
940
|
-
|
941
|
-
<p>*: The <code>toc</code> macro is to generate the Table of Contents automatically, and it must be used with no contents (<code>toc[]</code>).</p>
|
1240
|
+
<p>*: The <a href="#m_toc">toc</a> macro is used to generate the Table of Contents automatically, and it must be used with no contents (i.e.: <code>toc[]</code>).</p>
|
942
1241
|
<p>**: This macro is likely to be extended in future versions to generate/aggregate content automatically.</p>
|
943
1242
|
<p>†: This section is not listed in the Table of Contents.</p>
|
944
1243
|
<p>‡: Any subsection of this section is not listed in the Table of Contents.</p>
|
945
|
-
<div class="note"
|
1244
|
+
<div class="note">
|
1245
|
+
<p><span class="note-title">Note</span><code>frontmatter</code>, <code>bodymatter</code> and <code>backmatter</code> are also valid (and mandatory!) macro identifiers, typically already included in the default <code>document.glyph</code> file of every project.</p>
|
1246
|
+
</div>
|
946
1247
|
</div>
|
947
1248
|
<div class="section">
|
948
|
-
|
949
|
-
|
950
|
-
<p>If you’re authoring a user manual, a long article or a book, writing everything inside a single file (<code>document.glyph</code>) may not be optimal. For this reason, Glyph provides an <code>include</code> macro (aliased by <code>@</code>) that can be used to include the contents of any file within the <code>text/</code> directory:</p>
|
1249
|
+
<h4 id="incl">Including Files and Snippets</h4>
|
1250
|
+
<p>If you’re authoring a user manual, a long article or a book, writing everything inside a single file (<code>document.glyph</code>) may not be optimal. For this reason, Glyph provides an <a href="#m_include">include</a> macro (aliased by <code>@</code>) that can be used to include the contents of any file within the <code>text/</code> directory:</p>
|
951
1251
|
<p><code>@[introduction.textile]</code></p>
|
952
|
-
<p>The macro above loads the contents of the <code>introduction.textile</code> file, that can be stored <em>anywhere</em> within the <code>text/</code> directory.</p>
|
953
|
-
<div class="note"
|
954
|
-
<
|
955
|
-
A possible downside of this behavior is that file names must be unique within the entire <code>text/</code> directory
|
956
|
-
|
1252
|
+
<p>The macro call above loads the contents of the <code>introduction.textile</code> file, that can be stored <em>anywhere</em> within the <code>text/</code> directory.</p>
|
1253
|
+
<div class="note">
|
1254
|
+
<p><span class="note-title">Note</span>Unlike with <a href="img_fig">image and figures</a> that must be included with their <em>relative</em> path to the <code>images/</code> folder, you must not specify a relative path when including text files. This is due to the fact that images are copied <em>as they are</em> in the <code>output/<format>/images/</code> directory and they have to be linked from the output file.</p>
|
1255
|
+
<p>A possible downside of this behavior is that file names must be unique within the entire <code>text/</code> directory and any of its subdirectories</p>
|
1256
|
+
</div>
|
1257
|
+
<p>When including a text file, an input filter macro is applied to its contents by default, based on the file extension used:</p>
|
957
1258
|
<ul>
|
958
|
-
<li><code>.textile</code> → <
|
959
|
-
<li><code>.markdown</code> or <code>.md</code> → <
|
1259
|
+
<li><code>.textile</code> → <a href="#m_textile">textile</a> macro</li>
|
1260
|
+
<li><code>.markdown</code> or <code>.md</code> → <a href="#m_markdown">markdown</a> macro</li>
|
960
1261
|
</ul>
|
961
|
-
<div class="tip"
|
962
|
-
<
|
963
|
-
<code>glyph config filters.by_file_extensions false</code>
|
1262
|
+
<div class="tip">
|
1263
|
+
<p><span class="note-title">Tip</span>You can override this behavior by setting the <code>filters.by_file_extensions</code> configuration setting to <code>false</code>, like this:</p>
|
1264
|
+
<p><code>glyph config filters.by_file_extensions false</code></p>
|
1265
|
+
</div>
|
964
1266
|
<p>While including the context of an entire file is definitely a useful feature for content reuse, sometimes it can be an overkill. What if, for example, you just want to reuse a short procedure or even a sentence? In this case, you may want to consider using a <em>snippet</em> instead.</p>
|
965
|
-
<p>Snippets are text strings saved in <span class="caps">YAML</span> format in the <code>snippets.yml</code> file. They can be included anywhere in your document using the <
|
966
|
-
<div class="
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
1267
|
+
<p>Snippets are text strings saved in <span class="caps">YAML</span> format in the <code>snippets.yml</code> file. They can be included anywhere in your document using the <a href="#m_snippet">snippet</a> macro (or its alias <code>&</code>).</p>
|
1268
|
+
<div class="tip">
|
1269
|
+
<p><span class="note-title">Tip</span>Besides storing snippets in the <code>snippets.yml</code> file, you can also define them right in your document, using the <a href="#m_snippet_">snippet:</a> macro.</p>
|
1270
|
+
</div>
|
1271
|
+
<div class="box">
|
1272
|
+
<div class="box-title">Example</div>
|
1273
|
+
<p>Consider the following <code>snippets.yml</code> file:</p>
|
1274
|
+
<pre class="blackboard">
|
1275
|
+
<span class="Keyword">-</span><span class="Keyword">-</span><span class="Keyword">-</span><span class="InvalidDeprecated"> </span>
|
1276
|
+
:<span class="String"><span class="Entity">glang<span class="Entity">:</span></span> <span class="String">Glyph Language</span></span>
|
1277
|
+
:<span class="String"><span class="Entity">macros<span class="Entity">:</span></span> <span class="String">Glyph Macros</span></span>
|
1278
|
+
:<span class="MetaTag"><span class="MetaTag">sq_esc</span><span class="MetaTag">:</span> </span>|<span class="Keyword">-</span>
|
1279
|
+
Square brackets must be escaped<span class="InvalidDeprecated"> </span>
|
974
1280
|
unless used as macro delimiters or within a quoting macro.
|
975
|
-
|
976
|
-
|
977
|
-
This is a
|
1281
|
+
:<span class="String"><span class="Entity">markups<span class="Entity">:</span></span> <span class="String">Textile or Markdown</span></span>
|
1282
|
+
:<span class="MetaTag"><span class="MetaTag">test</span><span class="MetaTag">:</span> </span>|<span class="Keyword">-</span>
|
1283
|
+
This is a<span class="InvalidDeprecated"> </span>
|
978
1284
|
Test snippet
|
979
|
-
</
|
1285
|
+
</pre>
|
980
1286
|
<p>You can use <code>&[markups]</code> anywhere in your document instead of having to type “Textile or Markdown” every time. Additionally, later on you can change the value of the <code>markups</code> snippets only in the <code>snippets.yml</code> file to change it everywhere else in the document.</p>
|
981
1287
|
</div>
|
982
|
-
<div class="tip"
|
1288
|
+
<div class="tip">
|
1289
|
+
<p><span class="note-title">Tip</span>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.</p>
|
1290
|
+
</div>
|
983
1291
|
</div>
|
984
1292
|
<div class="section">
|
985
|
-
|
986
|
-
|
1293
|
+
<h4 id="links">Links and Bookmarks</h4>
|
987
1294
|
<p>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:</p>
|
988
1295
|
<ul>
|
989
1296
|
<li>There is no built-in way to check if they are valid</li>
|
990
1297
|
<li>There is no built-in way to determine the title of a link automatically</li>
|
991
1298
|
</ul>
|
992
|
-
<p>If you care about link validation and you want to save some keystrokes, then you should use the following markup-agnostic
|
1299
|
+
<p>If you care about link validation and you want to save some keystrokes, then you should use the following markup-agnostic macros:</p>
|
993
1300
|
<ul>
|
994
1301
|
<li><code>link</code> (aliased to <code>=></code>) — to create internal and external links.</li>
|
995
1302
|
<li><code>anchor</code> (aliased to <code>#</code>) — to create named anchors (bookmarks) within your document.</li>
|
996
1303
|
</ul>
|
997
|
-
<div class="box"
|
998
|
-
|
999
|
-
<
|
1000
|
-
<div class="code"
|
1001
|
-
|
1304
|
+
<div class="box">
|
1305
|
+
<div class="box-title">Example</div>
|
1306
|
+
<p>The following Glyph code:</p>
|
1307
|
+
<div class="code">
|
1308
|
+
<pre>
|
1309
|
+
<code>
|
1310
|
+
This is a link to link[#test].
|
1002
1311
|
|
1003
1312
|
...
|
1004
1313
|
|
1005
|
-
This is
|
1314
|
+
This is link[#wrong].
|
1006
1315
|
|
1007
1316
|
This is a #[test|test anchor].
|
1008
|
-
</code
|
1317
|
+
</code>
|
1318
|
+
</pre>
|
1319
|
+
</div>
|
1009
1320
|
<p>Is translated into the following <span class="caps">HTML</span> code:</p>
|
1010
|
-
<
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
</
|
1321
|
+
<pre class="blackboard">
|
1322
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>This is a link to <span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">a</span> <span class="MetaTag">href</span>=<span class="String"><span class="String">"</span>#test<span class="String">"</span></span><span class="MetaTag">></span></span>test anchor<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">a</span><span class="MetaTag">></span></span>.<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>
|
1323
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>...<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>
|
1324
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>This is <span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">a</span> <span class="MetaTag">href</span>=<span class="String"><span class="String">"</span>#wrong<span class="String">"</span></span><span class="MetaTag">></span></span>#wrong<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">a</span><span class="MetaTag">></span></span>.<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>
|
1325
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>This is a <span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">a</span> <span class="MetaTag"><span class="MetaTag">id</span><span class="MetaTag">=</span><span class="String"><span class="String">"</span><span class="String">test</span><span class="String">"</span></span></span><span class="MetaTag">></span></span>test anchor<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">a</span><span class="MetaTag">></span></span>.<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">p</span><span class="MetaTag">></span></span>
|
1326
|
+
</pre>
|
1016
1327
|
<p>Additionally, the following warning message is displayed when <a href="#compile">compiling</a>:</p>
|
1017
|
-
|
1328
|
+
|
1329
|
+
<div class="code">
|
1330
|
+
<pre>
|
1331
|
+
<code>
|
1018
1332
|
warning: Bookmark 'wrong' does not exist
|
1019
|
-
|
1020
|
-
|
1021
|
-
</code
|
1333
|
+
-> source: @: aurhoting.textile
|
1334
|
+
-> path: document/body/bodymatter/chapter/@/textile/section/section/box/link
|
1335
|
+
</code>
|
1336
|
+
</pre>
|
1022
1337
|
</div>
|
1023
|
-
|
1338
|
+
</div>
|
1339
|
+
<p>Basically, if you use the <a href="#m_link">link</a> macro and the <a href="#m_anchor">anchor</a> macro, Glyph makes sure that:</p>
|
1024
1340
|
<ul>
|
1025
1341
|
<li>All links point to valid anchors within the document (regardless if the anchors are before or after the link, in snippets or included files).</li>
|
1026
1342
|
<li>There are no duplicate anchors within the documents.</li>
|
1027
|
-
<li>If no title is specified as second parameter for the <
|
1343
|
+
<li>If no title is specified as second parameter for the <a href="#m_link">link</a> macro, the anchor’s title is used as such.</li>
|
1028
1344
|
</ul>
|
1029
|
-
<p>Besides using the <
|
1030
|
-
<div class="note"
|
1345
|
+
<p>Besides using the <a href="#m_anchor">anchor</a> macro macro, you can also create an anchor for a header by passing an extra parameter to the <a href="#m_header">header</a> macro, like this: <code>header[Header Title|my_anchor]</code>.</p>
|
1346
|
+
<div class="note">
|
1347
|
+
<p><span class="note-title">Note</span>At present, link validation and automatic title retrieval only works with internal links (i.e. the check occurs if the first parameter of the <a href="#m_link">link</a> macro starts with a <code>#</code>). In the future, the macro could be extended to support external links as well.</p>
|
1348
|
+
</div>
|
1031
1349
|
</div>
|
1032
1350
|
<div class="section">
|
1033
|
-
|
1034
|
-
|
1351
|
+
<h4 id="h_20">Evaluating Ruby code and Configuration Settings</h4>
|
1035
1352
|
<p>Glyph Language is not a full-blown programming language, as it does not provide control flow or variables, for example. <br />
|
1036
1353
|
However, it is possible to evaluate simple ruby code snippets using the <code>ruby</code> macro (aliased to <code>%</code>), like this:</p>
|
1037
1354
|
<ul>
|
1038
1355
|
<li><code>%[2 + 2]</code> → 4</li>
|
1039
|
-
<li><code>%[Time.now]</code> → Sun
|
1040
|
-
<li><code>%[Glyph::VERSION]</code> → 0.
|
1356
|
+
<li><code>%[Time.now]</code> → Sun May 09 15:39:56 +0200 2010</li>
|
1357
|
+
<li><code>%[Glyph::VERSION]</code> → 0.2.0</li>
|
1041
1358
|
</ul>
|
1042
1359
|
<p>The scope for the code evaluation is the Kernel module, (with all inclusions required by Glyph itself).</p>
|
1043
|
-
<p>Although it is possible to retrieve Glyph configuration settings in this way (e.g. <code>%[cfg('document.author')]</code>), the <
|
1360
|
+
<p>Although it is possible to retrieve Glyph configuration settings in this way (e.g. <code>%[cfg('document.author')]</code>), the <a href="#m_config">config</a> macro (aliased to <code>$</code>) makes things slightly simpler (e.g. <code>$[document.author]</code>).</p>
|
1044
1361
|
</div>
|
1045
1362
|
<div class="section">
|
1046
|
-
|
1047
|
-
|
1048
|
-
<p>
|
1049
|
-
<
|
1050
|
-
|
1051
|
-
<
|
1052
|
-
<
|
1363
|
+
<h4 id="cond_macros">Conditional Macros</h4>
|
1364
|
+
<p>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 <a href="#s_document_draft">document.draft</a> setting), or use a particular stylesheet only if when you generate a <span class="caps">PDF</span> document.</p>
|
1365
|
+
<p>To do so, you can use the <a href="#m_condition">condition</a> macro (aliased by <code>?</code>), and a set of additional macros that can be used as conditional operators i.e.:</p>
|
1366
|
+
<ul>
|
1367
|
+
<li><a href="#m_eq">eq</a> macro</li>
|
1368
|
+
<li><a href="#m_not">not</a> macro</li>
|
1369
|
+
<li><a href="#m_and">and</a> macro</li>
|
1370
|
+
<li><a href="#m_or">or</a> macro</li>
|
1371
|
+
<li><a href="#m_match">match</a> macro</li>
|
1372
|
+
</ul>
|
1373
|
+
<p>Consider the following code:</p>
|
1374
|
+
<div class="code">
|
1375
|
+
<pre>
|
1376
|
+
<code>
|
1377
|
+
?[$[document.draft]|
|
1378
|
+
This is a first draft of the Glyph Book]
|
1379
|
+
?[not[$[document.draft]]|
|
1380
|
+
This is the official version of the Glyph Book]
|
1381
|
+
</code>
|
1382
|
+
</pre>
|
1383
|
+
</div>
|
1384
|
+
<p>In this case, if <code>document.draft</code> is set to <code>true</code>, “This is a first draft of the Glyph Book” will be displayed; if not, “This is the official version of the Glyph Book” will be displayed instead.</p>
|
1385
|
+
<p>The <a href="#m_condition">condition</a> macro takes two parameters:</p>
|
1386
|
+
<ul>
|
1387
|
+
<li>the first one is the condition to evaluate</li>
|
1388
|
+
<li>the second one is the text to include in the document only if the condition is satisfied.</li>
|
1389
|
+
</ul>
|
1390
|
+
<p>Note that <em>both</em> parameters can contain macros, of course, so you can write things like:</p>
|
1391
|
+
<div class="code">
|
1392
|
+
<pre>
|
1393
|
+
<code>
|
1394
|
+
?[and[
|
1395
|
+
eq[$[document.output]|pdf]
|
1396
|
+
|
|
1397
|
+
eq[$[tools.pdf_generator]|prince]
|
1398
|
+
]
|
1399
|
+
|
|
1400
|
+
style[pagination.css]]
|
1401
|
+
</code>
|
1402
|
+
</pre>
|
1403
|
+
</div>
|
1404
|
+
<p>In this case, the <code>pagination.css</code> stylesheet is included only when you’re generating a <span class="caps">PDF</span> document using Prince <span class="caps">XML</span>.</p>
|
1405
|
+
<div class="section">
|
1406
|
+
<h5 id="h_22">Using macros inside the condition macro</h5>
|
1407
|
+
<p>Conditionals are not implemented at parser level. This means that macros specified as the second parameter of a <a href="#m_condition">condition</a> macro are <em>always</em> parsed and <em>executed</em>, even <em>before</em> that the condition is evaluated! Besides being inefficient, this can also lead to dangerous results if you’re the <a href="#m_config_">config:</a> macro or the <a href="#m_ruby">ruby</a> macro, for example: because in that case a configuration setting or a piece of Ruby code is always executed…</p>
|
1408
|
+
<p>To avoid this potentially dangerous side effect, you can <em><a href="#m_encode">encode</a></em> the second parameter of the condition macro, like this:</p>
|
1409
|
+
<div class="code">
|
1410
|
+
<pre>
|
1411
|
+
<code>
|
1412
|
+
?[$[document.draft]|
|
1413
|
+
*[= $:[document.output|html] =]]
|
1414
|
+
</code>
|
1415
|
+
</pre>
|
1416
|
+
</div>
|
1417
|
+
<p>If you do so, if the condition is satisfied, the condition macro decodes the second parameter and interprets its contents. In this way, if <code>document.draft</code> is true, <code>document.output</code> will be set to <code>html</code>, otherwise it will be left unchanged.</p>
|
1418
|
+
</div>
|
1419
|
+
<div class="section">
|
1420
|
+
<h5 id="h_23">Results of conditional expressions</h5>
|
1421
|
+
<p>The <a href="#m_condition">condition</a> macro in Glyph works in a similar way as conditionals in programming languages: if the conditional expression (supplied as first parameter) is satisfied then the second parameter is executed or displayed. But when is a conditional expression satisfied? Glyph is a simple mini-language to perform text manipulation, and has no types, it can only understand text, therefore:</p>
|
1422
|
+
<ul>
|
1423
|
+
<li>A conditional expression is satisfied if it evaluates to a non-empty string except “false”.</li>
|
1424
|
+
<li>A conditional expression is not satisfied if it evaluates to an empty string or the string “false”.</li>
|
1425
|
+
</ul>
|
1426
|
+
</div>
|
1427
|
+
</div>
|
1428
|
+
<div class="section">
|
1429
|
+
<h4 id="img_fig">Images and Figures</h4>
|
1430
|
+
<p>Same as for <a href="#links">links</a>, you can also include images and figures using Textile or Markdown. If you want additional features, you can use the <a href="#m_img">img</a> macro and the <a href="#m_fig">fig</a> macro, as shown in the following example:</p>
|
1431
|
+
<div class="box">
|
1432
|
+
<div class="box-title">Example</div>
|
1433
|
+
<p>The following Glyph code:</p>
|
1434
|
+
<div class="code">
|
1435
|
+
<pre>
|
1436
|
+
<code>
|
1053
1437
|
img[glyph.svg|20%|20%]
|
1054
1438
|
|
1055
1439
|
fig[example.png|An example figure.]
|
1056
|
-
</code
|
1440
|
+
</code>
|
1441
|
+
</pre>
|
1442
|
+
</div>
|
1057
1443
|
<p>Is translated into the following <span class="caps">HTML</span> code:</p>
|
1058
|
-
<
|
1059
|
-
|
1444
|
+
<pre class="blackboard">
|
1445
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">img</span> <span class="MetaTag">src</span>=<span class="String"><span class="String">"</span>images/glyph.svg<span class="String">"</span></span> <span class="MetaTag">width</span>=<span class="String"><span class="String">"</span>20%<span class="String">"</span></span> <span class="MetaTag">height</span>=<span class="String"><span class="String">"</span>20%<span class="String">"</span></span> <span class="MetaTag">alt</span>=<span class="String"><span class="String">"</span>-<span class="String">"</span></span> /<span class="MetaTag">></span></span>
|
1060
1446
|
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
</
|
1447
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">div</span> <span class="MetaTag">class</span>=<span class="String"><span class="String">"</span>figure<span class="String">"</span></span><span class="MetaTag">></span></span>
|
1448
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">img</span> <span class="MetaTag">src</span>=<span class="String"><span class="String">"</span>images/example.png<span class="String">"</span></span> <span class="MetaTag">alt</span>=<span class="String"><span class="String">"</span>-<span class="String">"</span></span>/<span class="MetaTag">></span></span>
|
1449
|
+
<span class="MetaTag"><span class="MetaTag"><</span><span class="MetaTag">div</span> <span class="MetaTag">class</span>=<span class="String"><span class="String">"</span>caption<span class="String">"</span></span><span class="MetaTag">></span></span>An example figure.<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">div</span><span class="MetaTag">></span></span>
|
1450
|
+
<span class="MetaTag"><span class="MetaTag"></</span><span class="MetaTag">div</span><span class="MetaTag">></span></span>
|
1451
|
+
</pre>
|
1066
1452
|
</div>
|
1067
|
-
<div class="note"
|
1453
|
+
<div class="note">
|
1454
|
+
<p><span class="note-title">Note</span>In future releases, figures will be numbered automatically and included in a <em>List of Figures</em> section.</p>
|
1068
1455
|
</div>
|
1069
1456
|
</div>
|
1070
1457
|
<div class="section">
|
1071
|
-
|
1072
|
-
|
1073
|
-
<p>By default, a Glyph project can be <em>compiled</em> into an <span class="caps">HTML</span> document. Additionally, Glyph can also be used to produce <span class="caps">PDF</span> documents through <a href="http://www.princexml.com/">Prince</a>, and in future releases more formats are likely to be supported.</p>
|
1458
|
+
<h4 id="source_code">Source code</h4>
|
1459
|
+
<p>If you’re a programmer, chances are that you’re going to include some source code in your articles and books. Glyph providers different ways to format source code, as described in the following sections.</p>
|
1074
1460
|
<div class="section">
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
<
|
1079
|
-
<
|
1461
|
+
<h5 id="h_26">Inline code</h5>
|
1462
|
+
<p>The <a href="#m_codeph">codeph</a> macro can be used to format inline code. That’s exactly the same as using <code><code></code> tags, just remember to use <a href="#esc_quot">escaping delimiters</a> and to escape pipes.</p>
|
1463
|
+
</div>
|
1464
|
+
<div class="section">
|
1465
|
+
<h5 id="h_27">Code block</h5>
|
1466
|
+
<p>For code blocks, you have two choices: the <a href="#m_code">code</a> macro, which simply wraps text into <code><pre></code> and <code><code></code> tags, or the <a href="#m_highlight">highlight</a> macro macro. The last one requires either <a href="http://coderay.rubychan.de/">Coderay</a> or <a href="http://ultraviolet.rubyforge.org/">Ultraviolet</a>, but it highlights the most common programming language.</p>
|
1467
|
+
<p>Cosider the following piece of ruby code:</p>
|
1468
|
+
<div class="code">
|
1469
|
+
<pre>
|
1470
|
+
<code>
|
1471
|
+
def find_child(&block)
|
1472
|
+
children.each do |c|
|
1473
|
+
c.descend do |node, level|
|
1474
|
+
return node if block.call(node)
|
1475
|
+
end
|
1476
|
+
end
|
1477
|
+
nil
|
1478
|
+
end
|
1479
|
+
</code>
|
1480
|
+
</pre>
|
1481
|
+
</div>
|
1482
|
+
<p>It can be wrapped in a highlight macro, like so:</p>
|
1483
|
+
<div class="code">
|
1484
|
+
<pre>
|
1485
|
+
<code>
|
1486
|
+
highlight[=ruby|
|
1487
|
+
def find_child(&block)
|
1488
|
+
children.each do \|c\|
|
1489
|
+
c.descend do \|node, level\|
|
1490
|
+
return node if block.call(node)
|
1491
|
+
end
|
1492
|
+
end
|
1493
|
+
nil
|
1494
|
+
end
|
1495
|
+
=]
|
1496
|
+
</code>
|
1497
|
+
</pre>
|
1498
|
+
</div>
|
1499
|
+
<p>…to produce the following, using the ultraviolet highlighter:</p>
|
1500
|
+
<pre class="blackboard">
|
1501
|
+
<span class="Keyword">def</span> <span class="Entity">find_child</span>(<span class="Variable"><span class="Keyword">&</span>block</span>)
|
1502
|
+
children.<span class="Entity">each</span> <span class="Keyword">do </span>|<span class="Variable">c</span>|
|
1503
|
+
c.<span class="Entity">descend</span> <span class="Keyword">do </span>|<span class="Variable">node</span>, <span class="Variable">level</span>|
|
1504
|
+
<span class="Keyword">return</span> node <span class="Keyword">if</span> block.<span class="Entity">call</span>(node)
|
1505
|
+
<span class="Keyword">end</span>
|
1506
|
+
<span class="Keyword">end</span>
|
1507
|
+
<span class="Constant">nil</span>
|
1508
|
+
<span class="Keyword">end</span>
|
1509
|
+
</pre>
|
1510
|
+
<div class="box">
|
1511
|
+
<div class="box-title">Some Remarks</div>
|
1512
|
+
<ul>
|
1513
|
+
<li>Highlighters require some configuration. For more information on relevant configuration settings, see the <code>highlighters.*</code> configuration settings.</li>
|
1514
|
+
<li>If you’re using the <a href="#m_highlight">highlight</a> macro together with <a href="#m_textile">textile</a> macro, you must wrap the macro call within <code><notextile></code> tags.</li>
|
1515
|
+
<li>You must always escape pipes (<code>|</code>) with the code or the highlight macro.</li>
|
1516
|
+
</ul>
|
1517
|
+
</div>
|
1518
|
+
</div>
|
1519
|
+
</div>
|
1520
|
+
</div>
|
1521
|
+
<div class="section">
|
1522
|
+
<h3 id="compile">Compiling your project</h3>
|
1523
|
+
<p>By default, a Glyph project can be <em>compiled</em> into an <span class="caps">HTML</span> document. Additionally, Glyph can also be used to produce <span class="caps">PDF</span> documents through <a href="http://www.princexml.com/">Prince</a>, and in future releases more formats could be supported.</p>
|
1524
|
+
<div class="section">
|
1525
|
+
<h4 id="stylesheets">Adding Stylesheets</h4>
|
1526
|
+
<p>Currently, Glyph does not provide any native way to format text and pages. The reason is that there’s absolutely no need for that: <span class="caps">CSS</span> does the job just fine. In particular, CSS3 offers specific attributes and elements that can be used specifically for paginated documents. That’s no replacement for LaTeX by any means, but it is enough if you’re not looking for advanced typographical features.</p>
|
1527
|
+
<p>You can embed <span class="caps">CSS</span> files using the <a href="#m_style">style</a> macro, like this:</p>
|
1528
|
+
<div class="code">
|
1529
|
+
<pre>
|
1530
|
+
<code>
|
1080
1531
|
style[default.css]
|
1081
|
-
</code
|
1082
|
-
|
1532
|
+
</code>
|
1533
|
+
</pre>
|
1083
1534
|
</div>
|
1535
|
+
<p>In this case, the <a href="#m_style">style</a> macro looks for a <code>default.css</code> file in the <code>/styles</code> folder of your Glyph project <em>and</em> among the default Glyph stylesheets, and embeds it within a <code><style></code> tag. If you supply a file with a <code>.sass</code> extension, it will interpret it as a Sass file and convert it to <span class="caps">CSS</span> automatically (if the <em>Haml</em> gem is installed).</p>
|
1084
1536
|
<div class="section">
|
1085
|
-
|
1086
|
-
|
1087
|
-
<
|
1088
|
-
<
|
1089
|
-
<
|
1090
|
-
|
1091
|
-
</
|
1537
|
+
<h5 id="default_styles">Default Stylesheets</h5>
|
1538
|
+
<p>Glyph provides the following default stylesheets, that can be referenced directly using the <a href="#m_style">style</a> macro macro:</p>
|
1539
|
+
<table>
|
1540
|
+
<tr>
|
1541
|
+
<th>File name</th>
|
1542
|
+
<th>Notes</th>
|
1543
|
+
</tr>
|
1544
|
+
<tr>
|
1545
|
+
<td>
|
1546
|
+
<p><code>default.css</code></p>
|
1547
|
+
</td>
|
1548
|
+
<td>
|
1549
|
+
<p>The default stylesheet used for this book.</p>
|
1550
|
+
</td>
|
1551
|
+
</tr>
|
1552
|
+
<tr>
|
1553
|
+
<td>
|
1554
|
+
<p><code>pagination.css</code></p>
|
1555
|
+
</td>
|
1556
|
+
<td>
|
1557
|
+
<p>A CSS3-compliant stylesheet used for pagination, suitable for <span class="caps">PDF</span> generation using Prince.</p>
|
1558
|
+
</td>
|
1559
|
+
</tr>
|
1560
|
+
<tr>
|
1561
|
+
<td>
|
1562
|
+
<p><code>coderay.css</code></p>
|
1563
|
+
</td>
|
1564
|
+
<td>
|
1565
|
+
<p>The default <a href="http://coderay.rubychan.de/">Coderay</a> stylesheet, used for syntax highlighting.</p>
|
1566
|
+
</td>
|
1567
|
+
</tr>
|
1568
|
+
<tr>
|
1569
|
+
<td>
|
1570
|
+
<p><code>ultraviolet/*</code></p>
|
1571
|
+
</td>
|
1572
|
+
<td>
|
1573
|
+
<p>This folder contains the following <a href="http://ultraviolet.rubyforge.org/">Ultraviolet</a> stylesheets, used for syntax highlighting: <code>active4d.css, all_hallows_eve.css, amy.css, blackboard.css, brilliance_black.css, brilliance_dull.css, cobalt.css, dawn.css, eiffel.css, espresso_libre.css, idle.css, iplastic.css, lazy.css, mac_classic.css, magicwb_amiga.css, pastels_on_dark.css, slush_poppies.css, spacecadet.css, sunburst.css, twilight.css, zenburnesque.css</code></p>
|
1574
|
+
</td>
|
1575
|
+
</tr>
|
1576
|
+
</table>
|
1577
|
+
</div>
|
1092
1578
|
</div>
|
1093
1579
|
<div class="section">
|
1094
|
-
|
1095
|
-
|
1580
|
+
<h4 id="h_31"><span class="caps">HTML</span> output</h4>
|
1581
|
+
<p>To compile a Glyph project to an <span class="caps">HTML</span> document, use the <a href="#c_compile">compile</a> command command within your Glyph project folder. Glyph parses the <code>document.glyph</code> file (and all included files and snippets); if no errors are found, Glyph creates an <span class="caps">HTML</span> document in the <code>/output/html</code> folder.</p>
|
1582
|
+
<p>The name of the <span class="caps">HTML</span> file can be set in the configuration (<code>document.filename</code> setting).</p>
|
1583
|
+
</div>
|
1584
|
+
<div class="section">
|
1585
|
+
<h4 id="h_32"><span class="caps">PDF</span> Output</h4>
|
1096
1586
|
<p>To generate a <span class="caps">PDF</span> document, you must specify <code>pdf</code> as format, like this:</p>
|
1097
|
-
<div class="code"
|
1587
|
+
<div class="code">
|
1588
|
+
<pre>
|
1589
|
+
<code>
|
1098
1590
|
glyph compile -f pdf
|
1099
|
-
</code
|
1591
|
+
</code>
|
1592
|
+
</pre>
|
1593
|
+
</div>
|
1100
1594
|
<p>The command above will attempt to compile the project into an <span class="caps">HTML</span> document and then call Prince to generate a <span class="caps">PDF</span> document from it. In order for this to work, you must download and install <a href="http://www.princexml.com/">Prince</a>. It’s not open source, but the free version is fully functional, and it just adds a small logo on the first page.</p>
|
1101
|
-
<div class="note"
|
1595
|
+
<div class="note">
|
1596
|
+
<p><span class="note-title">Note</span>Glyph v0.2.0 has been successfully tested with Prince v7.0, and the <span class="caps">PDF</span> version of this very book was generated with it.</p>
|
1597
|
+
</div>
|
1598
|
+
</div>
|
1599
|
+
<div class="section">
|
1600
|
+
<h4 id="auto_regeneration">Auto Regeneration</h4>
|
1601
|
+
<p>You can also call the <a href="#c_compile">compile</a> command with a <code>--auto</code> switch. If you do so, your project will be recompiled automatically every time any source file is changed.</p>
|
1602
|
+
<div class="note">
|
1603
|
+
<p><span class="note-title">Note</span>Auto regeneration requires the <a href="http://rubygems.org/gems/directory_watcher">directory_watcher</a> gem to be installed.</p>
|
1604
|
+
</div>
|
1605
|
+
</div>
|
1606
|
+
</div>
|
1607
|
+
<div class="section">
|
1608
|
+
<h3 id="lite_mode">Compiling single Glyph files</h3>
|
1609
|
+
<p>Glyph’s primary goal is to author complex documents like books or manuals. In order to do so, a Glyph project is required to keep everything organized and automated via a set of predefined conventions, exactly like Ruby on Rails or other similar frameworks do.</p>
|
1610
|
+
<p>If you want to write a one-page article or a short draft, however, creating and managing Glyph projects can be an unnecessary burden. Luckily, you don’t have to: you can use Glyph to compile single files containing Glyph code, by adding one parameter (or two if you want to specify a custom destination file) to the <a href="#c_compile">compile</a> command, like this:</p>
|
1611
|
+
<p><code>glyph compile source.glyph destination.htm</code></p>
|
1612
|
+
<p>This command will process a file called <code>source.glyph</code> and produce an <span class="caps">HTML</span> file called <code>destination.htm</code>.</p>
|
1613
|
+
<div class="section">
|
1614
|
+
<h4 id="lite_limitations">Limitations</h4>
|
1615
|
+
<p>This sort of “lite” mode comes with a few minor limitations:</p>
|
1616
|
+
<ul>
|
1617
|
+
<li>Snippets can only be defined inside the source file, using the <a href="#m_snippet_">snippet:</a> macro macro.</li>
|
1618
|
+
<li>Project configuration settings can only be defined inside the source file, using the <a href="#m_config_">config:</a> macro macro.</li>
|
1619
|
+
<li>Custom macros can only be defined inside the source file, using the <a href="#m_macro_">macro:</a> macro macro.</li>
|
1620
|
+
<li>Images must be linked with their absolute path, or a path relative to the current directory, and will not be copied anywhere when the output file is generated.</li>
|
1621
|
+
<li>Stylesheets must be referenced with their absolute path, a path relative to the current directory, or the name of an existing Glyph system stylesheet .</li>
|
1622
|
+
<li>The <a href="#m_include">include</a> macro cannot be used (if you need to include other text files, you should probably use a Glyph project…)</li>
|
1623
|
+
</ul>
|
1624
|
+
</div>
|
1625
|
+
</div>
|
1626
|
+
<div class="section">
|
1627
|
+
<h3 id="h_36">Using Glyph programmatically</h3>
|
1628
|
+
<p>Besides using Glyph from the command line, you can also use it straight from your code. Glyph’s public <a href="http://yardoc.org/docs/glyph/Glyph"><span class="caps">API</span></a> is simple and can be used to:</p>
|
1629
|
+
<ul>
|
1630
|
+
<li>Retrieve and update configuration settings (using <code>Glyph[]</code> and <code>Glyph[]=</code>)</li>
|
1631
|
+
<li>Filter text to <span class="caps">HTML</span> (using <code>Glyph#filter</code>)</li>
|
1632
|
+
<li>Compile Glyph source files into <span class="caps">HTML</span> or <span class="caps">PDF</span> files (using <code>Glyph#compile</code>)</li>
|
1633
|
+
</ul>
|
1634
|
+
<p>That’s pretty much it. Of course, both the <code>filter</code> and <code>compile</code> method cause Glyph to run in <a href="#lite_mode"><em>lite</em> mode</a>, so the same <a href="#lite_limitations">limitations</a> apply.</p>
|
1635
|
+
<div class="tip">
|
1636
|
+
<p><span class="note-title">Tip</span>For an example on how to use Glyph programmatically (specifically in conjunction with the <a href="http://nanoc.stoneship.org/">nanoc</a> static site generator), see <a href="http://github.com/h3rald/h3rald">h3rald.com source code</a>, in particular:</p>
|
1637
|
+
<ul>
|
1638
|
+
<li><a href="http://github.com/h3rald/h3rald/blob/master/lib/glyph-data.rb">lib/glyph-data.rb</a> — updating configuration settings.</li>
|
1639
|
+
<li><a href="http://github.com/h3rald/h3rald/blob/master/lib/glyph-filter.rb">lib/glyph-data.rb</a> — using the <code>Glyph#filter</code> method.</li>
|
1640
|
+
<li><a href="http://github.com/h3rald/h3rald/blob/master/Rules">Rules</a> — using the <code>Glyph#compile</code> method to generate <span class="caps">PDF</span> files.</li>
|
1641
|
+
</ul>
|
1102
1642
|
</div>
|
1103
1643
|
</div>
|
1104
1644
|
|
1105
|
-
|
1645
|
+
</div>
|
1106
1646
|
<div class="chapter">
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1647
|
+
<h2 id="extending">Extending Glyph</h2>
|
1648
|
+
<p>Glyph was created wih extensibility in mind. You can freely extend Glyph Language by creating or overriding macros, to do whatever you like. Macro definitions are written in pure Ruby code and placed in <code>.rb</code> files within the <code>lib/macros/</code> folder of your project.</p>
|
1649
|
+
<div class="tip">
|
1650
|
+
<p><span class="note-title">Tip</span>Alternatively, you can also define macros right in your document, using the <a href="#m_macro_">macro:</a> macro.</p>
|
1651
|
+
</div>
|
1111
1652
|
<div class="section">
|
1112
|
-
|
1113
|
-
|
1653
|
+
<h3 id="h_38">Anatomy of a Macro</h3>
|
1114
1654
|
<p>This is the source code of a fairly simple macro used to format a note :</p>
|
1115
|
-
<
|
1116
|
-
macro
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
</
|
1122
|
-
|
1123
|
-
<p>The
|
1124
|
-
<
|
1125
|
-
|
1126
|
-
<
|
1127
|
-
<code>
|
1655
|
+
<pre class="blackboard">
|
1656
|
+
macro <span class="Constant"><span class="Constant">:</span>note</span> <span class="Keyword">do</span>
|
1657
|
+
<span class="String"><span class="String">%{</span><div class="<span class="String"><span class="String">#{</span><span class="Variable"><span class="Variable">@</span>name</span><span class="String">}</span></span>"><span class="note-title"><span class="String"><span class="String">#{</span><span class="Variable"><span class="Variable">@</span>name</span><span class="String"><span class="String">.</span><span class="Entity">to_s</span></span><span class="String"><span class="String">.</span><span class="Entity">capitalize</span></span><span class="String">}</span></span></span></span>
|
1658
|
+
<span class="String"> <span class="String"><span class="String">#{</span><span class="Variable"><span class="Variable">@</span>value</span><span class="String">}</span></span></span>
|
1659
|
+
<span class="String"></span>
|
1660
|
+
<span class="String"> </div><span class="String">}</span></span>
|
1661
|
+
<span class="Keyword">end</span>
|
1662
|
+
</pre>
|
1663
|
+
<p>The <code>macro</code> method takes a single <code>Symbol</code> or <code>String</code> parameter, corresponding to the name of the macro. In this case, the entire block (or <em>body</em> of the macro) is a <code>String</code> corresponding to what we want the macro to evaluate to: a <code><div></code> tag containing a note.</p>
|
1664
|
+
<p>The body of the macro is evaluated in the context of the <a href="http://yardoc.org/docs/glyph/Glyph/Macro"><code>Glyph::Macro</code></a> class, therefore its instance variables (like <code>@name</code> or <code>@value</code>) can be used directly.</p>
|
1665
|
+
<div class="box">
|
1666
|
+
<div class="box-title">Why using <code>@name</code> instead of just “note”?</div>
|
1667
|
+
<p>For the <code>note</code> macro, it absolutely makes no difference. However, by using <code>@name</code> it is possible to re-use the same code for the <code>tip</code>, <code>important</code> and <code>caution</code> macros as well, which are in fact only aliases of the <code>note</code> macro:</p>
|
1668
|
+
<p><code>macro_alias :important => :note</code><br />
|
1128
1669
|
<code>macro_alias :tip => :note</code><br />
|
1129
|
-
<code>macro_alias :caution => :note</code>
|
1670
|
+
<code>macro_alias :caution => :note</code></p>
|
1671
|
+
</div>
|
1130
1672
|
<p>The following table lists all the instance variables that can be used inside macros:</p>
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1673
|
+
<table>
|
1674
|
+
<tr>
|
1675
|
+
<th>Variable</th>
|
1676
|
+
<th>Description</th>
|
1134
1677
|
</tr>
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
<
|
1144
|
-
|
1678
|
+
<tr>
|
1679
|
+
<td>
|
1680
|
+
<p><code>@node</code></p>
|
1681
|
+
</td>
|
1682
|
+
<td>
|
1683
|
+
<p>A <a href="http://yardoc.org/docs/glyph/Node"><code>Node</code></a> containing information about the macro, within the document syntax tree. Useful for accessing parent and child macros, and the current <a href="http://yardoc.org/docs/glyph/Glyph/Document"><code>Document</code></a>. Normally, macro nodes contain the following keys:</p>
|
1684
|
+
<ul>
|
1685
|
+
<li><code>:name</code>, the name of the macro.</li>
|
1686
|
+
<li><code>:value</code>, the value (i.e. the contents, within the delimiters) of the macro</li>
|
1687
|
+
<li><code>:source</code>, a <code>String</code> identifying the source of the macro (a file, a snippet, etc.)</li>
|
1688
|
+
<li><code>:document</code>, the parsed document tree.</li>
|
1689
|
+
</ul>
|
1690
|
+
<p>Note that the first three keys can also be accessed via instance variables.</p>
|
1691
|
+
</td>
|
1145
1692
|
</tr>
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1693
|
+
<tr>
|
1694
|
+
<td>
|
1695
|
+
<p><code>@name</code></p>
|
1696
|
+
</td>
|
1697
|
+
<td>
|
1698
|
+
<p>The name of the macro</p>
|
1699
|
+
</td>
|
1150
1700
|
</tr>
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1701
|
+
<tr>
|
1702
|
+
<td>
|
1703
|
+
<p><code>@value</code></p>
|
1704
|
+
</td>
|
1705
|
+
<td>
|
1706
|
+
<p>The full contents (including parameters and nested macros) inside the macro delimiters.</p>
|
1707
|
+
</td>
|
1155
1708
|
</tr>
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1709
|
+
<tr>
|
1710
|
+
<td>
|
1711
|
+
<p><code>@source</code></p>
|
1712
|
+
</td>
|
1713
|
+
<td>
|
1714
|
+
<p>A <code>String</code> identifying the source of the macro (a file, a snippet, etc.)</p>
|
1715
|
+
</td>
|
1160
1716
|
</tr>
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1717
|
+
<tr>
|
1718
|
+
<td>
|
1719
|
+
<p><code>@params</code></p>
|
1720
|
+
</td>
|
1721
|
+
<td>
|
1722
|
+
<p>The parameters passed to the macro. In other words, the value of the macro split by pipes (<code>|</code>).</p>
|
1723
|
+
</td>
|
1165
1724
|
</tr>
|
1166
1725
|
</table>
|
1167
1726
|
</div>
|
1168
1727
|
<div class="section">
|
1169
|
-
|
1170
|
-
|
1171
|
-
<
|
1172
|
-
<
|
1173
|
-
|
1174
|
-
ident
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
</div>
|
1181
|
-
<div class="section">
|
1182
|
-
|
1183
|
-
|
1184
|
-
<p>
|
1185
|
-
<
|
1186
|
-
<
|
1187
|
-
|
1188
|
-
href
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
title
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1728
|
+
<h3 id="h_39">Bookmarks and Headers</h3>
|
1729
|
+
<p>The <a href="http://yardoc.org/docs/glyph/Glyph/Macro"><code>Glyph::Macro</code></a> class also includes a few methods to check and store bookmarks and headers. Consider for example the following source code for the <a href="#m_anchor">anchor</a> macro:</p>
|
1730
|
+
<pre class="blackboard">
|
1731
|
+
macro <span class="Constant"><span class="Constant">:</span>anchor</span> <span class="Keyword">do </span>
|
1732
|
+
ident, title <span class="Keyword">=</span> <span class="Variable"><span class="Variable">@</span>params</span>
|
1733
|
+
macro_error <span class="String"><span class="String">"</span>Bookmark '<span class="String"><span class="String">#{</span>ident<span class="String">}</span></span>' already exists<span class="String">"</span></span> <span class="Keyword">if</span> bookmark? ident
|
1734
|
+
bookmark <span class="Constant"><span class="Constant">:</span>id</span> => ident, <span class="Constant"><span class="Constant">:</span>title</span> => title
|
1735
|
+
<span class="String"><span class="String">%{</span><a id="<span class="String"><span class="String">#{</span>ident<span class="String">}</span></span>"><span class="String"><span class="String">#{</span>title<span class="String">}</span></span></a><span class="String">}</span></span>
|
1736
|
+
<span class="Keyword">end</span>
|
1737
|
+
</pre>
|
1738
|
+
<p>The <code>bookmark?</code> method can be used to check the existance of a particular ID within the whole document, while the <code>bookmark</code> method is used to store bookmark IDs and titles. In a similar way, you can use <code>header?</code> and <code>header</code> methods to check the existance of headers within the documents or store new ones.</p>
|
1739
|
+
</div>
|
1740
|
+
<div class="section">
|
1741
|
+
<h3 id="h_40">Using Placeholders</h3>
|
1742
|
+
<p>Sometimes you may need to access some data that will not be available until the entire document has been fully parsed and analyzed. For example, in order to be able to validate internal links, it is necessary to know in advance if the bookmark ID referenced in the link exists or not, either before (that’s easy) or even <em>after</em> the link.</p>
|
1743
|
+
<p>Here’s the source code of the <a href="#m_link">link</a> macro:</p>
|
1744
|
+
<pre class="blackboard">
|
1745
|
+
macro <span class="Constant"><span class="Constant">:</span>link</span> <span class="Keyword">do</span>
|
1746
|
+
href, title <span class="Keyword">=</span> <span class="Variable"><span class="Variable">@</span>params</span>
|
1747
|
+
<span class="Keyword">if</span> href.<span class="Entity">match</span> <span class="String"><span class="String">/</span></span><span class="String">^#</span><span class="String"><span class="String">/</span></span> <span class="Keyword">then</span>
|
1748
|
+
anc <span class="Keyword">=</span> href.<span class="Entity">gsub</span>(<span class="String"><span class="String">/</span></span><span class="String">^#</span><span class="String"><span class="String">/</span></span>, <span class="String"><span class="String">'</span><span class="String">'</span></span>).<span class="Entity">to_sym</span>
|
1749
|
+
bmk <span class="Keyword">=</span> bookmark? anc
|
1750
|
+
<span class="Keyword">if</span> bmk <span class="Keyword">then</span>
|
1751
|
+
title <span class="Keyword">||=</span> bmk[<span class="Constant"><span class="Constant">:</span>title</span>]
|
1752
|
+
<span class="Keyword">else</span>
|
1753
|
+
plac <span class="Keyword">=</span> placeholder <span class="Keyword">do </span>|<span class="Variable">document</span>|
|
1754
|
+
macro_error <span class="String"><span class="String">"</span>Bookmark '<span class="String"><span class="String">#{</span>anc<span class="String">}</span></span>' does not exist<span class="String">"</span></span> <span class="Keyword">unless</span> document.<span class="Entity">bookmarks</span>[anc]
|
1755
|
+
document.<span class="Entity">bookmarks</span>[anc][<span class="Constant"><span class="Constant">:</span>title</span>]
|
1756
|
+
<span class="Keyword">end</span>
|
1757
|
+
title <span class="Keyword">||=</span> plac
|
1758
|
+
<span class="Keyword">end</span>
|
1759
|
+
<span class="Keyword">end</span>
|
1760
|
+
title <span class="Keyword">||=</span> href
|
1761
|
+
<span class="String"><span class="String">%{</span><a href="<span class="String"><span class="String">#{</span>href<span class="String">}</span></span>"><span class="String"><span class="String">#{</span>title<span class="String">}</span></span></a><span class="String">}</span></span>
|
1762
|
+
<span class="Keyword">end</span>
|
1763
|
+
</pre>
|
1764
|
+
<p>If there’s already a bookmark stored in the current document, then it is possible to retrieve its title and use it as link text. Otherwise, it is necessary to wait until the entire document has been fully processed and then check if the bookmark exists. To do so, use the <code>placeholder</code> method. When called, this method returns an unique placeholder, which is then substituted with the value of the block, right before the document is finalized.</p>
|
1206
1765
|
<p>Within the <code>placeholder</code> block, the <code>document</code> parameter is, by all means, the fully analyzed document.</p>
|
1207
1766
|
</div>
|
1208
1767
|
<div class="section">
|
1209
|
-
|
1210
|
-
|
1768
|
+
<h3 id="h_41">Using Validators</h3>
|
1769
|
+
<p>If you need to make sure that a macro is used properly, consider using <a href="http://yardoc.org/docs/glyph/Glyph/Macro/Validators">validators</a>. These methods can be used anywhere within the macro code to check whether certain conditions are met or not. Some default validators are provided to check the number of parameters of a macro, and they are actually used in some system macros.</p>
|
1770
|
+
<p>If you want to create your own validators, you can call the generic <code>validate</code> method which takes the message to display in case of error, a Hash of options and a block containing the validation to perform.</p>
|
1771
|
+
<div class="box">
|
1772
|
+
<div class="box-title">Validating macro placement</div>
|
1773
|
+
<p>You can, of course, create your own validators to check whether a macro is used within another. While this may seem a good idea to enforce constraints into the way documents are created, it has one major drawback: if you define a macro with such validation, you’re effectively limiting its usage, so for example you won’t be able to use within snippets or other custom macros.</p>
|
1774
|
+
<p>Suppose, for example, that the <a href="#m_header">header</a> macro is only allowed within a <code>section</code> macro. This means that, for example:</p>
|
1775
|
+
<ul>
|
1776
|
+
<li>the macro cannot be used within <code>chapter</code> or <code>appendix</code> macros.</li>
|
1777
|
+
<li>the macro cannot be used in snippets</li>
|
1778
|
+
</ul>
|
1779
|
+
<p>Even if you consider all the possibilities within the scope of the default macros provided with Glyph, this would also make the <code>header</code> macro unusable within custom macros.</p>
|
1780
|
+
</div>
|
1781
|
+
</div>
|
1782
|
+
<div class="section">
|
1783
|
+
<h3 id="h_42">Interpreting Glyph Code</h3>
|
1211
1784
|
<p>What if you need to evaluate some Glyph code <em>within</em> a macro? Say for example you want to transform a parameter in a link, and you want to make sure that link gets validated exactly like the others, in this case, you can use the <code>interpret</code> method, as follows:</p>
|
1212
|
-
<
|
1213
|
-
macro
|
1214
|
-
topic, href =
|
1215
|
-
link = placeholder do
|
1216
|
-
interpret "link[
|
1217
|
-
end
|
1218
|
-
|
1219
|
-
end
|
1220
|
-
</
|
1785
|
+
<pre class="blackboard">
|
1786
|
+
macro <span class="Constant"><span class="Constant">:</span>fmi</span> <span class="Keyword">do</span>
|
1787
|
+
topic, href <span class="Keyword">=</span> <span class="Variable"><span class="Variable">@</span>params</span>
|
1788
|
+
link <span class="Keyword">=</span> placeholder <span class="Keyword">do </span>|<span class="Variable">document</span>|
|
1789
|
+
interpret <span class="String"><span class="String">"</span>link[<span class="String"><span class="String">#{</span>href<span class="String">}</span></span>]<span class="String">"</span></span>
|
1790
|
+
<span class="Keyword">end</span>
|
1791
|
+
<span class="String"><span class="String">%{</span><span class="fmi">for more information on <span class="String"><span class="String">#{</span>topic<span class="String">}</span></span>, see <span class="String"><span class="String">#{</span>link<span class="String">}</span></span></span><span class="String">}</span></span>
|
1792
|
+
<span class="Keyword">end</span>
|
1793
|
+
</pre>
|
1794
|
+
<p>When the <code>interpret</code> method is called, the following happens:</p>
|
1221
1795
|
<ol>
|
1222
|
-
<li>A new Glyph document is created from the String passed to the method.</li>
|
1223
|
-
<li>The bookmarks, headers and placeholders are passed from the main document to the new one. Because they are stored in
|
1224
|
-
<li>Any macro included in the String is evaluated, and the resulting text is returned by the method. Note that this new document does not get finalized: in other words, placeholders will be left as they are, and they’ll eventually be replaced when <em>the main document</em> is finalized.</li>
|
1796
|
+
<li>A new Glyph document is created from the <code>String</code> passed to the method.</li>
|
1797
|
+
<li>The bookmarks, headers and placeholders are passed from the main document to the new one. Because they are stored in arrays and hashes, they are passed by reference, so for example any new bookmark stored in the new document will also become available in the main document.</li>
|
1798
|
+
<li>Any macro included in the <code>String</code> is evaluated, and the resulting text is returned by the method. Note that this new document does not get finalized: in other words, placeholders will be left as they are, and they’ll eventually be replaced when <em>the main document</em> is finalized.</li>
|
1225
1799
|
</ol>
|
1800
|
+
<div class="section">
|
1801
|
+
<h4 id="encode_decode">Encoding and Decoding Glyph Code</h4>
|
1802
|
+
<p>When you use the <code>interpret</code> method, keep in mind that the code is interpreted <em>before</em> the macro execution ends. This may not always be what you want: if you’re nesting macros interpreting <code>section</code> and <code>header</code> macros,for example, your Table of Contents may get messed up, with child sections showing up before their parents.</p>
|
1803
|
+
<p>To avoid this, you can use the <code>encode</code> and <code>decode</code> methods, as shown in the macros defined for Glyph’s <a href="http://github.com/h3rald/glyph/blob/master/book/text/changelog.glyph">Changelog</a>:</p>
|
1804
|
+
<pre class="blackboard">
|
1805
|
+
macro <span class="Constant"><span class="Constant">:</span>issue</span> <span class="Keyword">do</span>
|
1806
|
+
exact_parameters <span class="Constant">2</span>
|
1807
|
+
ident, desc <span class="Keyword">=</span> <span class="Variable"><span class="Variable">@</span>params</span>
|
1808
|
+
encode <span class="String"><span class="String">%{</span></span>
|
1809
|
+
<span class="String"> tr[</span>
|
1810
|
+
<span class="String"> td[=>[http://github.com/h3rald/glyph/issues/closed#issue/<span class="String"><span class="String">#{</span>ident<span class="String">}</span></span>|#<span class="String"><span class="String">#{</span>ident<span class="String">}</span></span>]]</span>
|
1811
|
+
<span class="String"> td[textile[<span class="String"><span class="String">#{</span>desc<span class="String">}</span></span>]]</span>
|
1812
|
+
<span class="String"> ]</span>
|
1813
|
+
<span class="String"> <span class="String">}</span></span>
|
1814
|
+
<span class="Keyword">end</span>
|
1815
|
+
|
1816
|
+
macro <span class="Constant"><span class="Constant">:</span>features</span> <span class="Keyword">do</span>
|
1817
|
+
verb <span class="Keyword">=</span> (<span class="Variable"><span class="Variable">@</span>name</span> <span class="Keyword">==</span> <span class="Constant"><span class="Constant">:</span>features</span>) <span class="Keyword">?</span> <span class="String"><span class="String">"</span>Implemented<span class="String">"</span></span> : <span class="String"><span class="String">"</span>Fixed<span class="String">"</span></span>
|
1818
|
+
total <span class="Keyword">=</span> <span class="Variable"><span class="Variable">@</span>node</span>.<span class="Entity">children</span>.<span class="Entity">length</span>
|
1819
|
+
encode <span class="String"><span class="String">%{</span></span>
|
1820
|
+
<span class="String"> section[header[<span class="String"><span class="String">#{</span>total<span class="String">}</span></span> <span class="String"><span class="String">#{</span><span class="Variable"><span class="Variable">@</span>name</span><span class="String"><span class="String">.</span><span class="Entity">to_s</span></span><span class="String"><span class="String">.</span><span class="Entity">capitalize</span></span><span class="String">}</span></span> <span class="String"><span class="String">#{</span>verb<span class="String">}</span></span>]</span>
|
1821
|
+
<span class="String"> table[</span>
|
1822
|
+
<span class="String"> tr[</span>
|
1823
|
+
<span class="String"> th[ID]</span>
|
1824
|
+
<span class="String"> th[Description]</span>
|
1825
|
+
<span class="String"> ]</span>
|
1826
|
+
<span class="String"> <span class="Variable"><span class="Variable">#@</span>value</span></span>
|
1827
|
+
<span class="String"> ]</span>
|
1828
|
+
<span class="String"> ]</span>
|
1829
|
+
<span class="String"> <span class="String">}</span></span>
|
1830
|
+
<span class="Keyword">end</span>
|
1831
|
+
|
1832
|
+
macro <span class="Constant"><span class="Constant">:</span>release</span> <span class="Keyword">do</span>
|
1833
|
+
exact_parameters <span class="Constant">3</span>
|
1834
|
+
number, date, contents <span class="Keyword">=</span> <span class="Variable"><span class="Variable">@</span>params</span>
|
1835
|
+
interpret <span class="String"><span class="String">%{</span></span>
|
1836
|
+
<span class="String"> section[header[v<span class="String"><span class="String">#{</span>number<span class="String">}</span></span> &ndash; <span class="String"><span class="String">#{</span>date<span class="String">}</span></span>]</span>
|
1837
|
+
<span class="String"> <span class="String"><span class="String">#{</span>decode contents<span class="String">}</span></span></span>
|
1838
|
+
<span class="String"> ]</span>
|
1839
|
+
<span class="String"> <span class="String">}</span></span>
|
1840
|
+
<span class="Keyword">end</span>
|
1841
|
+
</pre>
|
1842
|
+
<p>In this case, <code>issue</code> macros are nested within a <code>features</code> macro, which in turn is nested within a <code>release</code> macro. Note that none of these macros have any side effect: they are just used for text expansion. Because we’re always going to nest these macros in this way, there’s no to have each one interpret Glyph code: it will be the <code>release</code> macro’s job to do so. Instead, the <code>features</code> and <code>issue</code> macros just encode text which will then be decoded by the <code>release</code> macro, before being interpreted.</p>
|
1843
|
+
<p>When you <em>encode</em> a macro, its delimiters (<code>[</code>, <code>]</code>, and <code>|</code>) will be escaped (into ‡‡¤91¤‡‡, ‡‡¤93¤‡‡, and ‡‡¤124¤‡‡ respectively), and when you <em>decode</em> it, they will be unescaped. In a nutshell, you may want to use the encode/decode mechanism when:</p>
|
1844
|
+
<ul>
|
1845
|
+
<li>When you’re nesting macros interpreting Glyph code, without side effects.</li>
|
1846
|
+
<li>When all you want is to copy some Glyph code from child macros into their parents.</li>
|
1847
|
+
</ul>
|
1848
|
+
<div class="note">
|
1849
|
+
<p><span class="note-title">Note</span>These methods are also wrapped in the <a href="#m_encode">encode</a> macro and in the <a href="#m_decode">decode</a> macro.</p>
|
1850
|
+
</div>
|
1851
|
+
</div>
|
1226
1852
|
</div>
|
1227
1853
|
<div class="section">
|
1228
|
-
|
1229
|
-
|
1854
|
+
<h3 id="h_44">Further Reading</h3>
|
1230
1855
|
<p>For more examples on how to create more complex macros, have a look at the <a href="http://github.com/h3rald/glyph/tree/master/macros/">source code</a> of the existing ones.</p>
|
1231
1856
|
<p>To gain a deeper understanding on how macros are executed, have a look at the following Glyph classes:</p>
|
1232
1857
|
<ul>
|
1233
|
-
<li><a href="http://yardoc.org/docs/
|
1234
|
-
<li><a href="http://yardoc.org/docs/
|
1235
|
-
<li><a href="http://yardoc.org/docs/
|
1236
|
-
<li><a href="http://yardoc.org/docs/
|
1858
|
+
<li><a href="http://yardoc.org/docs/glyph/Glyph/Macro"><code>Glyph::Macro</code></a></li>
|
1859
|
+
<li><a href="http://yardoc.org/docs/glyph/Glyph/Interpreter"><code>Glyph::Interpreter</code></a></li>
|
1860
|
+
<li><a href="http://yardoc.org/docs/glyph/Glyph/Document"><code>Glyph::Document</code></a></li>
|
1861
|
+
<li><a href="http://yardoc.org/docs/glyph/Glyph/Node"><code>Node</code></a></li>
|
1237
1862
|
</ul>
|
1238
1863
|
</div>
|
1239
1864
|
|
1240
|
-
|
1865
|
+
</div>
|
1241
1866
|
<div class="chapter">
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1867
|
+
<h2 id="h_45">Troubleshooting</h2>
|
1868
|
+
<p>This chapter lists the most common error messages that can be returned when running a Glyph command. It does not aim to be an exhaustive list, especially if you <a href="#extending">extended</a> Glyph by creating your own macros or you’re embedding Ruby code using the <a href="#m_ruby">ruby</a> macro macro.</p>
|
1869
|
+
<div class="tip">
|
1870
|
+
<p><span class="note-title">Tip</span>As a general rule, more diagnostic information is provided if Glyph is run in <a href="#debug_switch">debug mode</a>.</p>
|
1871
|
+
</div>
|
1246
1872
|
<div class="section">
|
1247
|
-
|
1248
|
-
|
1873
|
+
<h3 id="h_46">Generic Errors</h3>
|
1249
1874
|
<table style="width:100%;">
|
1250
1875
|
<tr>
|
1251
1876
|
<th style="width:30%">Error Message</th>
|
1252
1877
|
<th>Description</th>
|
1253
1878
|
</tr>
|
1254
1879
|
<tr>
|
1255
|
-
<td>
|
1256
|
-
<td>This error is returned if the document
|
1257
|
-
<br />
|
1258
|
-
<strong>At present, no indication on the exact location of the error(s) is provided</strong>, so the only way to determine what went wrong is to try compiling a single file at a time (<code>glyph compile -s source-file</code>), and examine more closely the source of the files that do not compile.</td>
|
1880
|
+
<td>Incorrect macro syntax</td>
|
1881
|
+
<td>This error is returned if the parsing of the document (or one of its included files) failed. In 99% of the cases, this means there is an extra or missing macro delimiter somewhere.</td>
|
1259
1882
|
</tr>
|
1260
1883
|
|
1261
1884
|
<tr>
|
@@ -1274,8 +1897,8 @@ end
|
|
1274
1897
|
</tr>
|
1275
1898
|
|
1276
1899
|
<tr>
|
1277
|
-
<td>Glyph cannot generate <span class="caps">PDF</span>. Please specify a valid
|
1278
|
-
<td>Returned if the <
|
1900
|
+
<td>Glyph cannot generate <span class="caps">PDF</span>. Please specify a valid tools.pdf_generator setting</td>
|
1901
|
+
<td>Returned if the <a href="#s_tools_pdf_generator">tools.pdf_generator</a> setting has not be set to a valid <span class="caps">PDF</span> renderer. Currently, the only supported value for this setting is <code>prince</code>.</td>
|
1279
1902
|
</tr>
|
1280
1903
|
|
1281
1904
|
<tr>
|
@@ -1285,65 +1908,88 @@ end
|
|
1285
1908
|
|
1286
1909
|
<tr>
|
1287
1910
|
<td>Invalid snippet file</td>
|
1288
|
-
<td>The <code>snippet.yml</code> file contains invalid data. Most likely, it does not evaluate to a Ruby Hash
|
1911
|
+
<td>The <code>snippet.yml</code> file contains invalid data. Most likely, it does not evaluate to a Ruby <code>Hash</code>.</td>
|
1289
1912
|
</tr>
|
1290
1913
|
|
1291
1914
|
<tr>
|
1292
1915
|
<td>Directory ‘<em>directory-name</em>’ is not empty</td>
|
1293
|
-
<td>Returned when executing <
|
1916
|
+
<td>Returned when executing the <a href="#c_init">init</a> command in a directory that is not empty.</td>
|
1294
1917
|
</tr>
|
1295
1918
|
|
1296
1919
|
<tr>
|
1297
1920
|
<td>File ‘<em>file-name</em>’ already exists</td>
|
1298
|
-
<td>Returned if the name of an existing file was specified as a parameter for the <
|
1921
|
+
<td>Returned if the name of an existing file was specified as a parameter for the <a href="#c_add">add</a> command.</td>
|
1299
1922
|
</tr>
|
1300
1923
|
</table>
|
1301
1924
|
</div>
|
1302
1925
|
<div class="section">
|
1303
|
-
|
1304
|
-
|
1926
|
+
<h3 id="h_47">Command Errors</h3>
|
1305
1927
|
<table style="width:100%;">
|
1306
1928
|
<tr>
|
1307
1929
|
<th style="width:30%">Error Message</th>
|
1308
1930
|
<th>Description</th>
|
1309
1931
|
</tr>
|
1932
|
+
<tr>
|
1933
|
+
<td>Source file ‘<em>source-file</em>’ does not exist</td>
|
1934
|
+
<td>Returned if Glyph is running in <a href="#lite_mode">lite mode</a> and the specified source file was not found.</td>
|
1935
|
+
</tr>
|
1936
|
+
|
1937
|
+
<tr>
|
1938
|
+
<td>Source and destination file are the same</td>
|
1939
|
+
<td>Returned if Glyph is running in <a href="#lite_mode">lite mode</a> and you specified the same source and destination files.</td>
|
1940
|
+
</tr>
|
1941
|
+
|
1942
|
+
<tr>
|
1943
|
+
<td>DirectoryWatcher is not available. Install it with: gem install directory_watcher</td>
|
1944
|
+
<td>Returned if <a href="#auto_regeneration">auto regeneration</a> is enabled but the <code>directory_watcher</code> gem in not installed.</td>
|
1945
|
+
</tr>
|
1946
|
+
|
1947
|
+
<tr>
|
1948
|
+
<td>Document cannot be finalized due to previous errors</td>
|
1949
|
+
<td>Returned if one or more errors occurred in the document prevented finalization.</td>
|
1950
|
+
</tr>
|
1951
|
+
|
1310
1952
|
<tr>
|
1311
1953
|
<td>Please specify a file name</td>
|
1312
|
-
<td>No file name was specified for the <
|
1954
|
+
<td>No file name was specified for the <a href="#c_add">add</a> command.</td>
|
1313
1955
|
</tr>
|
1314
1956
|
|
1315
1957
|
<tr>
|
1316
1958
|
<td>Output target not specified</td>
|
1317
|
-
<td>Returned if no target was specified for the <
|
1959
|
+
<td>Returned if no target was specified for the <a href="#c_compile">compile</a> command <em>and</em> if the <a href="#s_document_output">document.output</a> setting is not set.</td>
|
1318
1960
|
</tr>
|
1319
1961
|
|
1320
1962
|
<tr>
|
1321
1963
|
<td>Unknown output target ‘<em>target-name</em>’</td>
|
1322
|
-
<td>An unsupported output target was specified for the <
|
1964
|
+
<td>An unsupported output target was specified for the <a href="#c_compile">compile</a> command. Only the following output targets are supported:<br />
|
1323
1965
|
- <code>html</code><br />
|
1324
1966
|
- <code>pdf</code></td>
|
1325
1967
|
</tr>
|
1326
1968
|
|
1327
1969
|
<tr>
|
1328
1970
|
<td>Too few/too many arguments</td>
|
1329
|
-
<td>Returned if the <
|
1971
|
+
<td>Returned if the <a href="#c_config">config</a> command was used with no arguments or more than two arguments respectively.</td>
|
1330
1972
|
</tr>
|
1331
1973
|
|
1332
1974
|
<tr>
|
1333
1975
|
<td>Unknown setting ‘<em>setting-name</em>’</td>
|
1334
|
-
<td>The name of an unknown setting was specified for the <
|
1976
|
+
<td>The name of an unknown setting was specified for the <a href="#c_config">config</a> command.</td>
|
1335
1977
|
</tr>
|
1336
1978
|
</table>
|
1337
1979
|
</div>
|
1338
1980
|
<div class="section">
|
1339
|
-
|
1340
|
-
|
1981
|
+
<h3 id="h_48">Macro Errors</h3>
|
1341
1982
|
<p>The following errors are displayed in the form:</p>
|
1342
|
-
<p><em>
|
1983
|
+
<p><em>message</em><br />
|
1984
|
+
→ source: <em>macro-source</em><br />
|
1985
|
+
→ path: <em>macro-path</em> <br />
|
1986
|
+
→ value: <em>macro-value</em></p>
|
1343
1987
|
<p>Where:</p>
|
1344
1988
|
<ul>
|
1345
|
-
<li><em>macro-path</em> is the full path to the macro that returned the error, within the document syntax tree, e.g. <code>document/body/bodymatter/chapter/section/header/&</code> if the error occurrent in a snippet within the header of a section in the <code>bodymatter</code> part of the document.</li>
|
1346
1989
|
<li><em>message</em> is the error message.</li>
|
1990
|
+
<li><em>macro-source</em> is the file or snippet where the error occurred.</li>
|
1991
|
+
<li><em>macro-path</em> is the full path to the macro that returned the error, within the document syntax tree, e.g. <code>document/body/bodymatter/chapter/section/header/&</code> if the error occurrent in a snippet within the header of a section in the <code>bodymatter</code> part of the document.</li>
|
1992
|
+
<li><em>macro-value</em> is the value of the macro (shown only if Glyph is running in <a href="#debug_switch">debug mode</a>).</li>
|
1347
1993
|
</ul>
|
1348
1994
|
<table style="width:100%;">
|
1349
1995
|
<tr>
|
@@ -1351,73 +1997,120 @@ end
|
|
1351
1997
|
<th>Description</th>
|
1352
1998
|
</tr>
|
1353
1999
|
<tr>
|
1354
|
-
<td>
|
1355
|
-
<td>
|
2000
|
+
<td>Macro ‘<em>name</em>’ takes up to <em>x</em> parameter(s) (<em>y</em> given)</td>
|
2001
|
+
<td>Returned if the macro was called with extra parameters.</td>
|
1356
2002
|
</tr>
|
1357
2003
|
|
1358
2004
|
<tr>
|
1359
|
-
<td>
|
1360
|
-
<td>Returned
|
2005
|
+
<td>Macro ‘<em>name</em>’ takes at least <em>x</em> parameter(s) (<em>y</em> given)</td>
|
2006
|
+
<td>Returned if the macro was called with fewer parameters than expected.</td>
|
1361
2007
|
</tr>
|
1362
2008
|
|
1363
2009
|
<tr>
|
1364
|
-
<td>
|
1365
|
-
<td>Returned
|
2010
|
+
<td>Macro ‘<em>name</em>’ takes exactly <em>x</em> parameter(s) (<em>y</em> given)</td>
|
2011
|
+
<td>Returned if the macro was called with a different number of parameters than.</td>
|
1366
2012
|
</tr>
|
1367
2013
|
|
1368
2014
|
<tr>
|
1369
|
-
<td>
|
1370
|
-
<td>Returned by the <a href="#m_include">include</a> macro
|
2015
|
+
<td>Macro not available when compiling a single file.</td>
|
2016
|
+
<td>Returned by the <a href="#m_include">include</a> macro if used in <a href="#lite_mode">lite mode</a>.</td>
|
1371
2017
|
</tr>
|
1372
2018
|
|
1373
2019
|
<tr>
|
1374
|
-
<td>
|
1375
|
-
<td>Returned by
|
2020
|
+
<td>Filter macro ‘<em>extension</em>’ not available</td>
|
2021
|
+
<td>Returned by a filter macro if <a href="#s_filters_by_file_extension">filters.by_file_extension</a> setting is set to <code>true</code>, but the extension was not recognized.</td>
|
1376
2022
|
</tr>
|
1377
2023
|
|
1378
2024
|
<tr>
|
1379
|
-
<td>
|
1380
|
-
<td>Returned by the <a href="#
|
1381
|
-
<br />
|
1382
|
-
Glyph checks for: BlueCloth, Maruku, Kramdown and RDiscount.</td>
|
2025
|
+
<td>Invalid regular expression: <em>regexp</em></td>
|
2026
|
+
<td>Returned by the <a href="#m_match">match</a> macro macro if an invalid regular expression was supplied.</td>
|
1383
2027
|
</tr>
|
1384
2028
|
|
1385
2029
|
<tr>
|
1386
|
-
<td>
|
1387
|
-
<td>
|
2030
|
+
<td>Macro ‘<em>name</em>’ takes no parameters (<em>x</em> given)</td>
|
2031
|
+
<td>Returned if the macro was called with parameters but none are requested.</td>
|
1388
2032
|
</tr>
|
1389
2033
|
|
1390
2034
|
<tr>
|
1391
|
-
<td>
|
1392
|
-
<td>Returned by the <a href="#
|
2035
|
+
<td>No highlighter installed. Please run: gem install coderay</td>
|
2036
|
+
<td>Returned by the <a href="#m_highlight">highlight</a> macro macro if no highlighters are installed.</td>
|
1393
2037
|
</tr>
|
1394
2038
|
|
1395
2039
|
<tr>
|
1396
|
-
<td>
|
2040
|
+
<td>CodeRay highlighter not installed. Please run: gem install coderay</td>
|
2041
|
+
<td>Returned by the <a href="#m_highlight">highlight</a> macro macro if <a href="#s_highlighters_current">highlighters.current</a> setting is set to <code>coderay</code> but <a href="http://coderay.rubychan.de/">Coderay</a> is not installed.</td>
|
2042
|
+
</tr>
|
2043
|
+
|
2044
|
+
<tr>
|
2045
|
+
<td>UltraViolet highlighter not installed. Please run: gem install ultraviolet</td>
|
2046
|
+
<td>Returned by the <a href="#m_highlight">highlight</a> macro macro if <a href="#s_highlighters_current">highlighters.current</a> setting is set to <code>ultraviolet</code> but <a href="http://ultraviolet.rubyforge.org/">Ultraviolet</a> is not installed.</td>
|
2047
|
+
</tr>
|
2048
|
+
|
2049
|
+
<tr>
|
2050
|
+
<td>Mutual inclusion</td>
|
2051
|
+
<td>Returned if a catch-22 situation occurs with macro inclusion, for example if the body of a snippet includes a reference to the same snippet.</td>
|
2052
|
+
</tr>
|
2053
|
+
|
2054
|
+
<tr>
|
2055
|
+
<td>Snippet ‘<em>snippet-id</em>’ does not exist</td>
|
2056
|
+
<td>Returned by the <a href="#m_snippet">snippet</a> macro if an invalid snippet was supplied.</td>
|
2057
|
+
</tr>
|
2058
|
+
|
2059
|
+
<tr>
|
2060
|
+
<td>File ‘<em>file-name</em>’ not found</td>
|
2061
|
+
<td>Returned by the <a href="#m_include">include</a> macro if an invalid file was supplied.</td>
|
2062
|
+
</tr>
|
2063
|
+
|
2064
|
+
<tr>
|
2065
|
+
<td>Filter macro ‘<em>macro-name</em>’ not found</td>
|
2066
|
+
<td>Returned by the <a href="#m_include">include</a> macro macro if the <a href="#s_filters_by_file_extension">filters.by_file_extension</a> setting is set to <code>true</code> but the file extension of the included file is not recognized as a filter macro.</td>
|
2067
|
+
</tr>
|
2068
|
+
|
2069
|
+
<tr>
|
2070
|
+
<td>RedCloth gem not installed. Please run: gem insall RedCloth</td>
|
2071
|
+
<td>Returned by the <a href="#m_textile">textile</a> macro if the RedCloth gem is not installed.</td>
|
2072
|
+
</tr>
|
2073
|
+
|
2074
|
+
<tr>
|
2075
|
+
<td>No MarkDown converter installed. Please run: gem insall bluecloth</td>
|
2076
|
+
<td>Returned by the <a href="#m_markdown">markdown</a> macro if no valid Markdown converter gem is installed. <br />
|
2077
|
+
<br />
|
2078
|
+
Glyph checks for: BlueCloth, Maruku, Kramdown and RDiscount.</td>
|
2079
|
+
</tr>
|
2080
|
+
|
2081
|
+
<tr>
|
2082
|
+
<td>Image/Figure not found</td>
|
2083
|
+
<td>Retured by the <a href="#m_img">img</a> macro or the <a href="#m_fig">fig</a> macro respectively, if the specified image file could not be found within the <code>images/</code> folder.</td>
|
2084
|
+
</tr>
|
2085
|
+
|
2086
|
+
<tr>
|
2087
|
+
<td>Bookmark ‘<em>bookmark-name</em>’ already exists</td>
|
2088
|
+
<td>Returned by the <a href="#m_anchor">anchor</a> macro or by the <a href="#m_header">header</a> macro if the anchor ID supplied as parameter has already been used in the document.</td>
|
2089
|
+
</tr>
|
2090
|
+
|
2091
|
+
<tr>
|
2092
|
+
<td>Bookmark ‘<em>bookmark-name</em>’ already exists</td>
|
1397
2093
|
<td>Returned by the <a href="#m_link">link</a> macro if the anchor ID supplied as parameter has not been used in the document.</td>
|
1398
2094
|
</tr>
|
1399
2095
|
|
1400
2096
|
<tr>
|
1401
2097
|
<td>Stylesheet ‘<em>file-name</em>’ not found</td>
|
1402
|
-
<td>Returned by the <a href="#m_style">style</a> macro if the
|
2098
|
+
<td>Returned by the <a href="#m_style">style</a> macro if the <code>.css</code> or <code>.sass</code> file supplied as parameter was not found in the <code>styles/</code> directory.</td>
|
1403
2099
|
</tr>
|
1404
2100
|
|
1405
2101
|
<tr>
|
1406
2102
|
<td>Haml is not installed. Please run: gem install haml</td>
|
1407
|
-
<td>Returned by the <a href="#m_style">style</a> macro
|
2103
|
+
<td>Returned by the <a href="#m_style">style</a> macro if a <code>.sass</code> file was passed as parameter but the Haml gem is not installed.</td>
|
1408
2104
|
</tr>
|
1409
2105
|
</table>
|
1410
2106
|
</div>
|
1411
2107
|
|
1412
|
-
|
2108
|
+
</div>
|
1413
2109
|
|
1414
|
-
|
2110
|
+
</div>
|
1415
2111
|
<div class="backmatter">
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
<h2 id="cmd_ref">Command Reference</h2>
|
1420
|
-
|
2112
|
+
<div class="appendix">
|
2113
|
+
<h2 id="cmd_ref">Command Reference</h2>
|
1421
2114
|
<p>Glyph’s command-line interface has been built using the <a href="http://github.com/davetron5000/gli">gli</a> (Git-like interface) gem. Therefore, Glyph commands are all written like this:</p>
|
1422
2115
|
<p><code>glyph</code> <em>global-options</em> command <em>options</em> <em>parameters</em></p>
|
1423
2116
|
<p>Where:</p>
|
@@ -1426,39 +2119,55 @@ Glyph checks for: BlueCloth, Maruku, Kramdown and RDiscount.</td>
|
|
1426
2119
|
<li><em>parameters</em> are separated by whitespaces, and can be wrapped in quotes.</li>
|
1427
2120
|
</ul>
|
1428
2121
|
<div class="section">
|
1429
|
-
|
1430
|
-
|
2122
|
+
<h3 id="h_50">Global Options</h3>
|
1431
2123
|
<div class="section">
|
1432
|
-
|
2124
|
+
<h4 id="debug_switch"><code>-d</code>, <code>--debug</code></h4>
|
1433
2125
|
<p>If specified, the command is executed in debug mode and additional diagnostic information is printed on the screen.</p>
|
1434
2126
|
</div>
|
1435
2127
|
</div>
|
1436
2128
|
<div class="section">
|
1437
|
-
|
2129
|
+
<h3 id="c_add"><code>add</code></h3>
|
1438
2130
|
<p>Creates a new text file in the <code>text/</code> folder.</p>
|
1439
2131
|
<p><strong>Example:</strong> <code>glyph add introduction.textile</code></p>
|
1440
2132
|
<div class="section">
|
1441
|
-
|
1442
|
-
|
2133
|
+
<h4 id="h_53">Parameters</h4>
|
1443
2134
|
<table style="width:100%;">
|
1444
2135
|
<tr>
|
1445
2136
|
<th style="width:30%">Parameter</th>
|
1446
2137
|
<th>Description</th>
|
1447
2138
|
</tr>
|
1448
2139
|
<tr>
|
1449
|
-
<td>file-name</td>
|
2140
|
+
<td><em>file-name</em></td>
|
1450
2141
|
<td>The name (or relative path) of the new file to be created.</td>
|
1451
2142
|
</tr>
|
1452
2143
|
</table>
|
1453
2144
|
</div>
|
1454
2145
|
</div>
|
1455
2146
|
<div class="section">
|
1456
|
-
|
2147
|
+
<h3 id="c_compile"><code>compile</code></h3>
|
1457
2148
|
<p>Compiles a Glyph document into an output file. If no options are specified, the <code>document.glyph</code> file is used as source to produce a standalone <span class="caps">HTML</span> file.</p>
|
1458
2149
|
<p><strong>Example:</strong> <code>glyph compile -f pdf</code></p>
|
1459
2150
|
<div class="section">
|
1460
|
-
|
2151
|
+
<h4 id="h_55">Parameters</h4>
|
2152
|
+
<table style="width:100%;">
|
2153
|
+
<tr>
|
2154
|
+
<th style="width:30%">Parameter</th>
|
2155
|
+
<th>Description</th>
|
2156
|
+
</tr>
|
2157
|
+
<tr>
|
2158
|
+
<td><em>source</em></td>
|
2159
|
+
<td>The source glyph file to compile <em>(Optional)</em>.</td>
|
2160
|
+
</tr>
|
2161
|
+
|
2162
|
+
<tr>
|
2163
|
+
<td><em>destination</em></td>
|
2164
|
+
<td>The destination file <em>(Optional)</em>.</td>
|
2165
|
+
</tr>
|
2166
|
+
</table>
|
2167
|
+
</div>
|
1461
2168
|
|
2169
|
+
<div class="section">
|
2170
|
+
<h4 id="h_56">Options</h4>
|
1462
2171
|
<table style="width:100%;">
|
1463
2172
|
<tr>
|
1464
2173
|
<th style="width:30%">Option</th>
|
@@ -1468,7 +2177,7 @@ Glyph checks for: BlueCloth, Maruku, Kramdown and RDiscount.</td>
|
|
1468
2177
|
<td>-s (--source)</td>
|
1469
2178
|
<td>
|
1470
2179
|
<p>The source file to compile. <br />
|
1471
|
-
<strong>Default:</strong> <code>document.glyph</code></p>
|
2180
|
+
<strong>Default Value:</strong> <code>document.glyph</code></p>
|
1472
2181
|
</td>
|
1473
2182
|
</tr>
|
1474
2183
|
|
@@ -1476,23 +2185,29 @@ Glyph checks for: BlueCloth, Maruku, Kramdown and RDiscount.</td>
|
|
1476
2185
|
<td>-f (--format)</td>
|
1477
2186
|
<td>
|
1478
2187
|
<p>The format of the output file.<br />
|
1479
|
-
<strong>Default:</strong> <code>html</code><br />
|
2188
|
+
<strong>Default Value:</strong> <code>html</code><br />
|
1480
2189
|
<strong>Possible Values:</strong> <code>html, pdf</code></p>
|
1481
2190
|
</td>
|
1482
2191
|
</tr>
|
2192
|
+
|
2193
|
+
<tr>
|
2194
|
+
<td>-a (--auto)</td>
|
2195
|
+
<td>
|
2196
|
+
<p>If specified, enable <a href="#auto_regeneration">auto regeneration</a> (requires the <a href="http://rubygems.org/gems/directory_watcher">directory_watcher</a> gem to be installed).</p>
|
2197
|
+
</td>
|
2198
|
+
</tr>
|
1483
2199
|
</table>
|
1484
2200
|
</div>
|
1485
2201
|
</div>
|
1486
2202
|
<div class="section">
|
1487
|
-
|
2203
|
+
<h3 id="c_config"><code>config</code></h3>
|
1488
2204
|
<p>Gets or sets a configuration setting in the project or global configuration file (<span class="fmi">for more information on configuration files, see <a href="#cfg">Project Configuration</a></span>).</p>
|
1489
2205
|
<p><strong>Examples:</strong> <br />
|
1490
|
-
|
2206
|
+
<code>glyph config document.filename</code><br />
|
1491
2207
|
<code>glyph config -g document.author "Fabio Cevasco"</code></p>
|
1492
2208
|
|
1493
2209
|
<div class="section">
|
1494
|
-
|
1495
|
-
|
2210
|
+
<h4 id="h_58">Options</h4>
|
1496
2211
|
<table style="width:100%;">
|
1497
2212
|
<tr>
|
1498
2213
|
<th style="width:30%">Option</th>
|
@@ -1502,192 +2217,318 @@ Glyph checks for: BlueCloth, Maruku, Kramdown and RDiscount.</td>
|
|
1502
2217
|
<td>-g (--global)</td>
|
1503
2218
|
<td>
|
1504
2219
|
<p>If specified, the global configuration file is processed instead of the project file.<br />
|
1505
|
-
<strong>Default:</strong> <code>false</code></p>
|
2220
|
+
<strong>Default Value:</strong> <code>false</code></p>
|
1506
2221
|
</td>
|
1507
2222
|
</tr>
|
1508
2223
|
</table>
|
1509
2224
|
</div>
|
1510
2225
|
|
1511
2226
|
<div class="section">
|
1512
|
-
|
1513
|
-
|
2227
|
+
<h4 id="h_59">Parameters</h4>
|
1514
2228
|
<table style="width:100%;">
|
1515
2229
|
<tr>
|
1516
2230
|
<th style="width:30%">Parameter</th>
|
1517
2231
|
<th>Description</th>
|
1518
2232
|
</tr>
|
1519
2233
|
<tr>
|
1520
|
-
<td>setting</td>
|
2234
|
+
<td><em>setting</em></td>
|
1521
2235
|
<td>The name of a valid <a href="#cfg_ref">configuration setting</a>.</td>
|
1522
2236
|
</tr>
|
1523
2237
|
|
1524
2238
|
<tr>
|
1525
|
-
<td>value</td>
|
2239
|
+
<td><em>value</em></td>
|
1526
2240
|
<td>The new value of the configuration setting.</td>
|
1527
2241
|
</tr>
|
1528
2242
|
</table>
|
1529
2243
|
</div>
|
1530
2244
|
</div>
|
1531
2245
|
<div class="section">
|
1532
|
-
|
2246
|
+
<h3 id="c_help"><code>help</code></h3>
|
2247
|
+
<p>Prints information about all Glyph commands or about one specific command.</p>
|
2248
|
+
<p><strong>Examples:</strong> <br />
|
2249
|
+
<code>glyph help</code><br />
|
2250
|
+
<code>glyph help compile</code></p>
|
2251
|
+
|
2252
|
+
<div class="section">
|
2253
|
+
<h4 id="h_61">Parameters</h4>
|
2254
|
+
<table style="width:100%;">
|
2255
|
+
<tr>
|
2256
|
+
<th style="width:30%">Parameter</th>
|
2257
|
+
<th>Description</th>
|
2258
|
+
</tr>
|
2259
|
+
<tr>
|
2260
|
+
<td><em>command</em></td>
|
2261
|
+
<td>A valid Glyph command.</td>
|
2262
|
+
</tr>
|
2263
|
+
</table>
|
2264
|
+
</div>
|
2265
|
+
</div>
|
2266
|
+
<div class="section">
|
2267
|
+
<h3 id="c_init"><code>init</code></h3>
|
1533
2268
|
<p>Creates a new Glyph project in the current directory (if empty).</p>
|
1534
2269
|
<p><strong>Example:</strong> <code>glyph init</code></p>
|
1535
2270
|
</div>
|
1536
2271
|
<div class="section">
|
1537
|
-
|
2272
|
+
<h3 id="c_todo"><code>todo</code></h3>
|
1538
2273
|
<p>Prints all the todo items saved using the <a href="#m_todo">todo</a> macro.</p>
|
1539
2274
|
<p><strong>Example:</strong> <code>glyph todo</code></p>
|
1540
2275
|
</div>
|
1541
2276
|
|
1542
|
-
|
2277
|
+
</div>
|
1543
2278
|
<div class="appendix">
|
1544
|
-
|
1545
|
-
<h2 id="macro_ref">Macro Reference</h2>
|
1546
|
-
|
2279
|
+
<h2 id="macro_ref">Macro Reference</h2>
|
1547
2280
|
<div class="section">
|
1548
|
-
|
2281
|
+
<h3 id="h_65">Common Macros</h3>
|
2282
|
+
<div class="section">
|
2283
|
+
<h4 id="m_and"><code>and</code></h4>
|
2284
|
+
<p>Conditional <code>and</code> operator, to be used with the <a href="#m_condition">condition</a> macro.</p>
|
2285
|
+
<p><strong>Example:</strong> <code>?[and[true|false]|This is never displayed.]</code></p>
|
2286
|
+
</div>
|
1549
2287
|
|
1550
2288
|
<div class="section">
|
1551
|
-
|
2289
|
+
<h4 id="m_comment"><code>comment</code></h4>
|
1552
2290
|
<p>Evaluates to nothing. Used to add comments in a Glyph document that will not be displayed in output files.</p>
|
1553
2291
|
<p><strong>Aliases:</strong> <code>--</code><br />
|
1554
2292
|
<strong>Example:</strong> <code>--[This is a comment. It will not be displayed in the output]</code></p>
|
1555
2293
|
</div>
|
1556
2294
|
|
1557
2295
|
<div class="section">
|
1558
|
-
|
1559
|
-
<p>
|
1560
|
-
<p><strong>
|
2296
|
+
<h4 id="m_condition"><code>condition</code></h4>
|
2297
|
+
<p>Tests a conditional expression (first parameter), and evaluates to the second parameter if the condition is satisfied. If the second parameter is an <a href="#m_escape">escape</a> macro macro, its contents are unescaped and interpreted only if the condition is satisfied. For more information, see <a href="#cond_macros">Conditional Macros</a>.</p>
|
2298
|
+
<p><strong>Aliases:</strong> <code>?</code></p>
|
2299
|
+
<p><strong>Examples</strong></p>
|
2300
|
+
<p>See any of the following:</p>
|
2301
|
+
<ul>
|
2302
|
+
<li><a href="#m_and">and</a> macro</li>
|
2303
|
+
<li><a href="#m_or">or</a> macro</li>
|
2304
|
+
<li><a href="#m_not">not</a> macro</li>
|
2305
|
+
<li><a href="#m_match">match</a> macro</li>
|
2306
|
+
<li><a href="#m_eq">eq</a> macro</li>
|
2307
|
+
</ul>
|
1561
2308
|
</div>
|
1562
2309
|
|
1563
2310
|
<div class="section">
|
1564
|
-
|
1565
|
-
<p>Evaluates to the
|
1566
|
-
<p><strong>Aliases:</strong> <code
|
1567
|
-
<strong>Example:</strong> <code
|
2311
|
+
<h4 id="m_config"><code>config</code></h4>
|
2312
|
+
<p>Evaluates to the configuration setting referenced by its value.</p>
|
2313
|
+
<p><strong>Aliases:</strong> <code>$</code><br />
|
2314
|
+
<strong>Example:</strong> <code>$[document.author]</code></p>
|
2315
|
+
</div>
|
2316
|
+
|
2317
|
+
<div class="section">
|
2318
|
+
<h4 id="m_config_"><code>config:</code></h4>
|
2319
|
+
<p>Sets the value of a configuration setting.</p>
|
2320
|
+
<p><strong>Aliases:</strong> <code>$:</code></p>
|
2321
|
+
<p><strong>Example:</strong> <code>$:[document.draft|true]</code></p>
|
2322
|
+
</div>
|
2323
|
+
|
2324
|
+
<div class="section">
|
2325
|
+
<h4 id="m_decode"><code>decode</code></h4>
|
2326
|
+
<p>Decodes some text that was previously encoded (see <a href="#m_encode">encode</a> macro). <span class="fmi">for more information on this topic, see <a href="#encode_decode">Encoding and Decoding Glyph Code</a></span>.</p>
|
2327
|
+
<p><strong>Aliases:</strong> <code>**</code></p>
|
2328
|
+
<p><strong>Example:</strong> <code>*[=note‡‡¤91¤‡‡This will not be evaluated‡‡¤93¤‡‡=]</code></p>
|
2329
|
+
</div>
|
2330
|
+
|
2331
|
+
<div class="section">
|
2332
|
+
<h4 id="m_encode"><code>encode</code></h4>
|
2333
|
+
<p>Encodes some Glyph code to prevent its evaluation, so that it can be decoded (and interpreted) later on (see the <a href="#m_decode">decode</a> macro). <span class="fmi">for more information on this topic, see <a href="#encode_decode">Encoding and Decoding Glyph Code</a></span>.</p>
|
2334
|
+
<p><strong>Aliases:</strong> <code>*</code></p>
|
2335
|
+
<p><strong>Example:</strong> <code>*[=note[This will not be evaluated]=]</code></p>
|
2336
|
+
</div>
|
2337
|
+
|
2338
|
+
<div class="section">
|
2339
|
+
<h4 id="m_eq"><code>eq</code></h4>
|
2340
|
+
<p>Conditional equality operator, to be used with the <a href="#m_condition">condition</a> macro.</p>
|
2341
|
+
<p><strong>Example:</strong> <code>?[eq[$[document.draft]|true]|This is displayed only in draft documents.]</code></p>
|
2342
|
+
</div>
|
2343
|
+
|
2344
|
+
<div class="section">
|
2345
|
+
<h4 id="m_escape"><code>escape</code></h4>
|
2346
|
+
<p>Evaluates to its value. Commonly used with the escaping delimiters <code>[=</code> and <code>=]</code>.</p>
|
2347
|
+
<p><strong>Aliases:</strong> <code>.</code><br />
|
2348
|
+
<strong>Example:</strong> <code>.[=Macros are escaped here =>[#test].=]</code></p>
|
1568
2349
|
</div>
|
1569
2350
|
|
1570
2351
|
<div class="section">
|
1571
|
-
|
2352
|
+
<h4 id="m_include"><code>include</code></h4>
|
1572
2353
|
<p>Evaluates to the contents of a text file stored in the <code>text/</code> directory referenced by its value. If the <a href="#s_filters_by_file_extension">filters.by_file_extension</a> setting is <code>true</code>, filters the contents of the file using the <a href="#f_macros">filter macro</a> corresponding to the file extension.</p>
|
1573
2354
|
<p><strong>Aliases:</strong> <code>@</code><br />
|
1574
2355
|
<strong>Example:</strong> <code>@[introduction.textile]</code></p>
|
1575
2356
|
</div>
|
1576
2357
|
|
1577
2358
|
<div class="section">
|
1578
|
-
|
2359
|
+
<h4 id="m_match"><code>match</code></h4>
|
2360
|
+
<p>Evaluates to <code>true</code> 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 <a href="#m_condition">condition</a> macro.</p>
|
2361
|
+
<p><strong>Example:</strong> <code>?[match[Hello!|/^hell/i]|This is always displayed]</code></p>
|
2362
|
+
</div>
|
2363
|
+
|
2364
|
+
<div class="section">
|
2365
|
+
<h4 id="m_macro_"><code>macro:</code></h4>
|
2366
|
+
<p>Defines a macro.</p>
|
2367
|
+
<div class="note">
|
2368
|
+
<p><span class="note-title">Note</span>The new macro can only be used <em>after</em> its declaration.</p>
|
2369
|
+
</div>
|
2370
|
+
<p><strong>Aliases:</strong> <code>%:</code></p>
|
2371
|
+
<p><strong>Example:</strong> <code>%:[test|"<em>test: #@value</em>"]</code></p>
|
2372
|
+
</div>
|
2373
|
+
|
2374
|
+
<div class="section">
|
2375
|
+
<h4 id="m_not"><code>not</code></h4>
|
2376
|
+
<p>Conditional <code>and</code> operator, to be used with the <a href="#m_condition">condition</a> macro.</p>
|
2377
|
+
<p><strong>Example:</strong> <code>?[not[false]|This is always displayed.]</code></p>
|
2378
|
+
</div>
|
2379
|
+
|
2380
|
+
<div class="section">
|
2381
|
+
<h4 id="m_or"><code>or</code></h4>
|
2382
|
+
<p>Conditional <code>or</code> operator, to be used with the <a href="#m_condition">condition</a> macro.</p>
|
2383
|
+
<p><strong>Example:</strong> <code>?[or[true|false]|This is always displayed.]</code></p>
|
2384
|
+
</div>
|
2385
|
+
|
2386
|
+
<div class="section">
|
2387
|
+
<h4 id="m_ruby"><code>ruby</code></h4>
|
1579
2388
|
<p>Evaluates its value as Ruby code (using <code>Kernel#instance_eval</code>).</p>
|
1580
2389
|
<p><strong>Aliases:</strong> <code>%</code></p>
|
1581
2390
|
<p><strong>Examples:</strong> <br />
|
1582
|
-
|
2391
|
+
<code>%[Time.now]</code><br />
|
1583
2392
|
<code>%[Glyph::VERSION]</code></p>
|
1584
2393
|
</div>
|
1585
2394
|
|
1586
2395
|
<div class="section">
|
1587
|
-
|
1588
|
-
<p>Evaluates to the
|
1589
|
-
<p><strong>Aliases:</strong> <code
|
1590
|
-
<strong>Example:</strong> <code
|
2396
|
+
<h4 id="m_snippet"><code>snippet</code></h4>
|
2397
|
+
<p>Evaluates to the snippet referenced by its value.</p>
|
2398
|
+
<p><strong>Aliases:</strong> <code>&</code><br />
|
2399
|
+
<strong>Example:</strong> <code>&[glang]</code></p>
|
1591
2400
|
</div>
|
1592
2401
|
|
1593
2402
|
<div class="section">
|
1594
|
-
|
1595
|
-
<p>
|
1596
|
-
<
|
1597
|
-
<
|
2403
|
+
<h4 id="m_snippet_"><code>snippet:</code></h4>
|
2404
|
+
<p>Defines a snippet.</p>
|
2405
|
+
<div class="note">
|
2406
|
+
<p><span class="note-title">Note</span>The new snippet can only be used <em>after</em> its declaration.</p>
|
1598
2407
|
</div>
|
2408
|
+
<p><strong>Aliases:</strong> <code>&:</code></p>
|
2409
|
+
<p><strong>Example:</strong> <code>&:[test|This is a test]</code></p>
|
1599
2410
|
</div>
|
1600
|
-
<div class="section">
|
1601
|
-
<h3 id="f_macros">Filter Macros</h3>
|
1602
2411
|
|
1603
2412
|
<div class="section">
|
1604
|
-
|
1605
|
-
<p>
|
1606
|
-
<p>
|
1607
|
-
|
2413
|
+
<h4 id="m_todo"><code>todo</code></h4>
|
2414
|
+
<p>Saves the value as a <span class="caps">TODO</span> item, which can be printed using the <a href="#c_todo">todo</a> command or included in the document if the <a href="#s_document_draft">document.draft</a> setting is set to <code>true</code>.</p>
|
2415
|
+
<p><strong>Example:</strong> <code>todo[Remember to do this.]</code></p>
|
2416
|
+
</div>
|
1608
2417
|
</div>
|
1609
|
-
|
1610
2418
|
<div class="section">
|
1611
|
-
|
2419
|
+
<h3 id="f_macros">Filter Macros</h3>
|
2420
|
+
<div class="section">
|
2421
|
+
<h4 id="m_markdown"><code>markdown</code></h4>
|
1612
2422
|
<p>Uses a markdown converter (BlueCloth, RDiscount, Maruku or Kramdown) to transform the value into <span class="caps">HTML</span> if the <a href="#s_filters_target">filters.target</a> setting is set to <code>html</code>.</p>
|
1613
2423
|
<p>If the <a href="#s_filters_by_file_extension">filters.by_file_extension</a> setting is <code>true</code>, this macro is called automatically on <a href="#m_include">included</a> files with a <code>.markdown</code> or a <code>.md</code> extension.</p>
|
1614
2424
|
<p><strong>Example:</strong> <code>markdown[This is *emphasized* text.]</code></p>
|
1615
2425
|
</div>
|
1616
|
-
</div>
|
1617
|
-
<div class="section">
|
1618
|
-
<h3 id="h_58">Block Macros</h3>
|
1619
2426
|
|
1620
2427
|
<div class="section">
|
1621
|
-
|
1622
|
-
<p>
|
1623
|
-
<p
|
1624
|
-
<strong>Example:</strong> <code>
|
2428
|
+
<h4 id="m_textile"><code>textile</code></h4>
|
2429
|
+
<p>Uses the RedCloth gem to transform the value into <span class="caps">HTML</span> or LaTeX, depending on the value of the <a href="#s_filters_target">filters.target</a> setting.</p>
|
2430
|
+
<p>If the <a href="#s_filters_by_file_extension">filters.by_file_extension</a> setting is <code>true</code>, this macro is called automatically on <a href="#m_include">included</a> files with a <code>.textile</code> extension.</p>
|
2431
|
+
<p><strong>Example:</strong> <code>textile[This is a *strong emphasis*.]</code></p>
|
1625
2432
|
</div>
|
1626
|
-
|
2433
|
+
</div>
|
2434
|
+
<div class="section">
|
2435
|
+
<h3 id="h_87">Block Macros</h3>
|
1627
2436
|
<div class="section">
|
1628
|
-
|
1629
|
-
<p>Creates a titled box <code
|
2437
|
+
<h4 id="m_box"><code>box</code></h4>
|
2438
|
+
<p>Creates a titled box (<code><div></code> tag).</p>
|
1630
2439
|
<p><strong>Example:</strong></p>
|
1631
|
-
<div class="code"
|
2440
|
+
<div class="code">
|
2441
|
+
<pre>
|
2442
|
+
<code>
|
1632
2443
|
box[Why boxes?|
|
1633
2444
|
Boxes can be used to make a section of text stand out from the rest of the document.
|
1634
2445
|
]
|
1635
|
-
</code
|
2446
|
+
</code>
|
2447
|
+
</pre>
|
2448
|
+
</div>
|
1636
2449
|
</div>
|
1637
2450
|
|
1638
2451
|
<div class="section">
|
1639
|
-
|
1640
|
-
<p>Used to render a block of code within <code
|
2452
|
+
<h4 id="m_code"><code>code</code></h4>
|
2453
|
+
<p>Used to render a block of code within <code><pre></code> and <code><code></code> tags.</p>
|
2454
|
+
<ul>
|
2455
|
+
<li>For inline code, see the <a href="#m_codeph">codeph</a> macro.</li>
|
2456
|
+
<li>For code highlighting, see the <a href="#m_highlight">highlight</a> macro.</li>
|
2457
|
+
</ul>
|
1641
2458
|
<p><strong>Example:</strong></p>
|
1642
|
-
<div class="code"
|
2459
|
+
<div class="code">
|
2460
|
+
<pre>
|
2461
|
+
<code>
|
1643
2462
|
code[
|
1644
2463
|
def hello
|
1645
2464
|
puts "Hello World"
|
1646
2465
|
end
|
1647
2466
|
]
|
1648
|
-
</code
|
2467
|
+
</code>
|
2468
|
+
</pre>
|
1649
2469
|
</div>
|
1650
|
-
|
1651
|
-
<div class="section">
|
1652
|
-
<h4 id="m_title"><code>title</code></h4>
|
1653
|
-
<p>Renders the title of the document (based on the <a href="#s_document_title">document.title</a> setting) within a <code>h1</code> tag.</p>
|
1654
|
-
<p><strong>Example:</strong> <code>title[]</code></p>
|
1655
2470
|
</div>
|
1656
2471
|
|
1657
2472
|
<div class="section">
|
1658
|
-
|
1659
|
-
<p>
|
1660
|
-
<p><strong>
|
2473
|
+
<h4 id="m_fig"><code>fig</code></h4>
|
2474
|
+
<p>Includes an image in the document, with an optional caption.</p>
|
2475
|
+
<p><strong>Examples:</strong> <br />
|
2476
|
+
<code>fig[diagram.png]</code><br />
|
2477
|
+
<code>fig[graph.png|Monthly pageviews]</code></p>
|
1661
2478
|
</div>
|
1662
2479
|
|
1663
2480
|
<div class="section">
|
1664
|
-
|
1665
|
-
<p>
|
1666
|
-
<p><strong>Example:</strong
|
2481
|
+
<h4 id="m_highlight"><code>highlight</code></h4>
|
2482
|
+
<p>Highlights a piece of source code (second parameter) according to the specified language (first parameter). <span class="fmi">for more information on code highligting, see <a href="#source_code">Source code</a></span>.</p>
|
2483
|
+
<p><strong>Example:</strong></p>
|
2484
|
+
<div class="code">
|
2485
|
+
<pre>
|
2486
|
+
<code>
|
2487
|
+
highlight[ruby|
|
2488
|
+
def hello
|
2489
|
+
puts "Hello World"
|
2490
|
+
end
|
2491
|
+
]
|
2492
|
+
</code>
|
2493
|
+
</pre>
|
2494
|
+
</div>
|
1667
2495
|
</div>
|
1668
2496
|
|
1669
2497
|
<div class="section">
|
1670
|
-
|
2498
|
+
<h4 id="m_img"><code>img</code></h4>
|
1671
2499
|
<p>Includes an image in the document, optionally scaled according to the specified width and height. The image must be stored within the <code>images/</code> directory of the current project.</p>
|
1672
2500
|
<p><strong>Examples:</strong> <br />
|
1673
|
-
|
2501
|
+
<code>img[icon.png]</code><br />
|
1674
2502
|
<code>img[holidays/landscape.jpg|70%]</code><br />
|
1675
2503
|
<code>img[logo.svg|50%|50%]</code></p>
|
1676
2504
|
</div>
|
1677
2505
|
|
1678
2506
|
<div class="section">
|
1679
|
-
|
1680
|
-
<p>
|
1681
|
-
<p><strong>
|
1682
|
-
|
1683
|
-
|
2507
|
+
<h4 id="m_note"><code>note</code></h4>
|
2508
|
+
<p>Creates a note <code>div</code> containing the value.</p>
|
2509
|
+
<p><strong>Aliases:</strong> <code>important, caution, tip</code><br />
|
2510
|
+
<strong>Example:</strong> <code>note[This is a note.]</code></p>
|
2511
|
+
</div>
|
2512
|
+
|
2513
|
+
<div class="section">
|
2514
|
+
<h4 id="m_pubdate"><code>pubdate</code></h4>
|
2515
|
+
<p>Evaluates to a date string (in the format: <em>current-month</em> <em>current-year</em>; or <em>%B</em> <em>%Y</em>), within a <code><div></code> tag.</p>
|
2516
|
+
<p><strong>Example:</strong> <code>pubdate[]</code></p>
|
2517
|
+
</div>
|
2518
|
+
|
2519
|
+
<div class="section">
|
2520
|
+
<h4 id="m_subtitle"><code>subtitle</code></h4>
|
2521
|
+
<p>Renders the subtitle of the document (based on the <a href="#s_document_subtitle">document.subtitle</a> setting) within a <code><h2></code> tag.</p>
|
2522
|
+
<p><strong>Example:</strong> <code>subtitle[]</code></p>
|
1684
2523
|
</div>
|
1685
2524
|
|
1686
2525
|
<div class="section">
|
1687
|
-
|
2526
|
+
<h4 id="m_table"><code>table</code></h4>
|
1688
2527
|
<p>Evaluates to an <span class="caps">HTML</span> table. Used in conjunction with the <a href="#m_tr"><code>tr</code></a>, <a href="#m_td"><code>td</code></a> and <a href="#m_th"><code>th</code></a> macros.</p>
|
1689
2528
|
<p><strong>Example:</strong></p>
|
1690
|
-
<div class="code"
|
2529
|
+
<div class="code">
|
2530
|
+
<pre>
|
2531
|
+
<code>
|
1691
2532
|
table[
|
1692
2533
|
tr[
|
1693
2534
|
th[Name]
|
@@ -1702,108 +2543,878 @@ table[
|
|
1702
2543
|
td[2]
|
1703
2544
|
]
|
1704
2545
|
]
|
1705
|
-
</code
|
2546
|
+
</code>
|
2547
|
+
</pre>
|
2548
|
+
</div>
|
1706
2549
|
</div>
|
1707
2550
|
|
1708
2551
|
<div class="section">
|
1709
|
-
|
2552
|
+
<h4 id="m_td"><code>td</code></h4>
|
1710
2553
|
<p>See <a href="#m_table"><code>table</code></a>.</p>
|
1711
2554
|
</div>
|
1712
2555
|
|
1713
2556
|
<div class="section">
|
1714
|
-
|
2557
|
+
<h4 id="m_title"><code>title</code></h4>
|
2558
|
+
<p>Renders the title of the document (based on the <a href="#s_document_title">document.title</a> setting) within a <code><h1></code> tag.</p>
|
2559
|
+
<p><strong>Example:</strong> <code>title[]</code></p>
|
2560
|
+
</div>
|
2561
|
+
|
2562
|
+
<div class="section">
|
2563
|
+
<h4 id="m_th"><code>th</code></h4>
|
1715
2564
|
<p>See <a href="#m_table"><code>table</code></a>.</p>
|
1716
2565
|
</div>
|
1717
2566
|
|
1718
2567
|
<div class="section">
|
1719
|
-
|
2568
|
+
<h4 id="m_tr"><code>tr</code></h4>
|
1720
2569
|
<p>See <a href="#m_table"><code>table</code></a>.</p>
|
1721
2570
|
</div>
|
1722
2571
|
</div>
|
1723
2572
|
<div class="section">
|
1724
|
-
|
1725
|
-
|
2573
|
+
<h3 id="h_101">Inline Macros</h3>
|
1726
2574
|
<div class="section">
|
1727
|
-
|
2575
|
+
<h4 id="m_anchor"><code>anchor</code></h4>
|
1728
2576
|
<p>Creates a named anchor (or bookmark).</p>
|
1729
2577
|
<p><strong>Aliases:</strong> <code>bookmark, #</code><br />
|
1730
2578
|
<strong>Example:</strong> <code>#[test|Test Bookmark]</code></p>
|
1731
2579
|
</div>
|
1732
2580
|
|
1733
2581
|
<div class="section">
|
1734
|
-
|
1735
|
-
<p>
|
1736
|
-
<p><strong>
|
1737
|
-
<p><strong>Examples:</strong> <br />
|
1738
|
-
<code>=>[#introduction]</code><br />
|
1739
|
-
<code>=>[#troub|Troubleshooting]</code><br />
|
1740
|
-
<code>=>[http://www.h3rald.com|H3RALD.com]</code></p>
|
2582
|
+
<h4 id="m_codeph"><code>codeph</code></h4>
|
2583
|
+
<p>Wraps the value in a <code><code></code> tag.</p>
|
2584
|
+
<p><strong>Example:</strong> <code>codeph[Kernel.instance_eval]</code></p>
|
1741
2585
|
</div>
|
1742
2586
|
|
1743
2587
|
<div class="section">
|
1744
|
-
|
1745
|
-
<p>
|
1746
|
-
<p><strong>
|
2588
|
+
<h4 id="m_draftcomment"><code>draftcomment</code></h4>
|
2589
|
+
<p>If the <a href="#s_document_draft">document.draft</a> setting is set to <code>true</code>, displays a draft comment within the document.</p>
|
2590
|
+
<p><strong>Aliases:</strong> <code>dc</code></p>
|
2591
|
+
<p><strong>Example:</strong> <code>dc[This is printed only in draft documents.]</code></p>
|
1747
2592
|
</div>
|
1748
2593
|
|
1749
2594
|
<div class="section">
|
1750
|
-
|
2595
|
+
<h4 id="m_fmi"><code>fmi</code></h4>
|
1751
2596
|
<p>Creates a <em>For More Information</em> link (for an example usage, see the <a href="#m_link">link</a> macro).</p>
|
1752
2597
|
<p><strong>Example:</strong> <code>fmi[creating links|#links]</code></p>
|
1753
2598
|
</div>
|
2599
|
+
|
2600
|
+
<div class="section">
|
2601
|
+
<h4 id="m_link"><code>link</code></h4>
|
2602
|
+
<p>Creates an hyperlink (<span class="fmi">for more information on creating links, see <a href="#links">Links and Bookmarks</a></span>).</p>
|
2603
|
+
<p><strong>Aliases:</strong> <code>=></code></p>
|
2604
|
+
<p><strong>Examples:</strong> <br />
|
2605
|
+
<code>=>[#introduction]</code><br />
|
2606
|
+
<code>=>[#troub|Troubleshooting]</code><br />
|
2607
|
+
<code>=>[http://www.h3rald.com|H3RALD.com]</code></p>
|
2608
|
+
</div>
|
1754
2609
|
</div>
|
1755
2610
|
<div class="section">
|
1756
|
-
|
2611
|
+
<h3 id="h_107">Structure Macros</h3>
|
2612
|
+
<div class="section">
|
2613
|
+
<h4 id="m_body"><code>body</code></h4>
|
2614
|
+
<p>Creates a <code><body></code> tag.</p>
|
2615
|
+
</div>
|
1757
2616
|
|
1758
2617
|
<div class="section">
|
1759
|
-
|
1760
|
-
<p>Creates a <code
|
1761
|
-
<p><strong>Aliases:</strong></p>
|
2618
|
+
<h4 id="m_div"><code>div</code></h4>
|
2619
|
+
<p>Creates a <code><div></code> tag.</p>
|
2620
|
+
<p><strong>Aliases:</strong> <code>acknowledgement, addendum, afterword, appendix, bibliography, book, chapter, colophon, dedication, epilogue, foreword, glossary, imprint, index, inspiration, introduction, lof, lot, part, postscript, preface, prologue, promotion, references, section, section, volume</code></p>
|
1762
2621
|
</div>
|
1763
2622
|
|
1764
2623
|
<div class="section">
|
1765
|
-
|
1766
|
-
<p>
|
1767
|
-
<p><strong>Examples:</strong> <br />
|
1768
|
-
<code>header[Introduction]</code><br />
|
1769
|
-
<code>header[Getting Started|gs]</code></p>
|
2624
|
+
<h4 id="m_document"><code>document</code></h4>
|
2625
|
+
<p>The root macro used in every Glyph document. It creates an <code><html></code> tag.</p>
|
1770
2626
|
</div>
|
1771
2627
|
|
1772
2628
|
<div class="section">
|
1773
|
-
|
1774
|
-
<p>
|
2629
|
+
<h4 id="m_head"><code>head</code></h4>
|
2630
|
+
<p>Creates a <code><head></code> tag, pre-populated with <code>title</code> and author/copyright <code><meta></code> tags.</p>
|
1775
2631
|
</div>
|
1776
2632
|
|
1777
2633
|
<div class="section">
|
1778
|
-
|
1779
|
-
<p>Creates
|
2634
|
+
<h4 id="m_header"><code>header</code></h4>
|
2635
|
+
<p>Creates an <code>h2</code>, <code>h3</code>, <code>h4</code>, etc. header (<span class="fmi">for more information on using headers, see <a href="#sec_head">Sections and Headers</a></span>).</p>
|
2636
|
+
<p><strong>Examples:</strong> <br />
|
2637
|
+
<code>header[Introduction]</code><br />
|
2638
|
+
<code>header[Getting Started|gs]</code></p>
|
1780
2639
|
</div>
|
1781
2640
|
|
1782
2641
|
<div class="section">
|
1783
|
-
|
1784
|
-
<p>
|
2642
|
+
<h4 id="m_section"><code>section</code></h4>
|
2643
|
+
<p>See <a href="#m_div"><code>div</code></a>.</p>
|
1785
2644
|
</div>
|
1786
2645
|
|
1787
2646
|
<div class="section">
|
1788
|
-
|
1789
|
-
<p>Embeds the content of a <span class="caps">CSS</span> or Sass file within a <code
|
2647
|
+
<h4 id="m_style"><code>style</code></h4>
|
2648
|
+
<p>Embeds the content of a <span class="caps">CSS</span> or Sass file within a <code><style></code> tag (<span class="fmi">for more information on stylesheets, see <a href="#stylesheets">Adding Stylesheets</a></span>).</p>
|
1790
2649
|
<p><strong>Example:</strong> <code>style[default.css]</code></p>
|
1791
2650
|
</div>
|
1792
2651
|
|
1793
2652
|
<div class="section">
|
1794
|
-
|
2653
|
+
<h4 id="m_toc"><code>toc</code></h4>
|
1795
2654
|
<p>Generates a <em>Table of Contents</em> based on how sections and headers are nested in the current document.</p>
|
1796
2655
|
<p><strong>Example:</strong> <code>toc[]</code></p>
|
1797
2656
|
</div>
|
1798
2657
|
</div>
|
1799
2658
|
|
1800
|
-
|
2659
|
+
</div>
|
1801
2660
|
<div class="appendix">
|
2661
|
+
<h2 id="cfg_ref">Configuration Reference</h2>
|
2662
|
+
<div class="section">
|
2663
|
+
<h3 id="h_117"><code>document.*</code></h3>
|
2664
|
+
<p>The following configuration settings are related to the current Glyph document. Therefore, you should update them right after creating a project.</p>
|
2665
|
+
<table>
|
2666
|
+
<tr>
|
2667
|
+
<th>Name</th>
|
2668
|
+
<th>Description</th>
|
2669
|
+
<th>Default (<span class="caps">YAML</span>)</th>
|
2670
|
+
</tr>
|
2671
|
+
<tr>
|
2672
|
+
<td>
|
2673
|
+
<p><code>document.author</code> <a id="s_document_author"></a></p>
|
2674
|
+
</td>
|
2675
|
+
<td>
|
2676
|
+
<p>The author of the document.</p>
|
2677
|
+
</td>
|
2678
|
+
<td>
|
2679
|
+
<div class="code">
|
2680
|
+
<pre>
|
2681
|
+
<code>
|
2682
|
+
""
|
2683
|
+
</code>
|
2684
|
+
</pre>
|
2685
|
+
</div>
|
2686
|
+
</td>
|
2687
|
+
</tr>
|
2688
|
+
<tr>
|
2689
|
+
<td>
|
2690
|
+
<p><code>document.draft</code> <a id="s_document_draft"></a></p>
|
2691
|
+
</td>
|
2692
|
+
<td>
|
2693
|
+
<p>If set to <code>true</code>, the document is considered a draft, so <a href="#m_draftcomment">draft comments</a> and <a href="#m_todo">todo items</a> will be displayed.</p>
|
2694
|
+
</td>
|
2695
|
+
<td>
|
2696
|
+
<div class="code">
|
2697
|
+
<pre>
|
2698
|
+
<code>
|
2699
|
+
false
|
2700
|
+
</code>
|
2701
|
+
</pre>
|
2702
|
+
</div>
|
2703
|
+
</td>
|
2704
|
+
</tr>
|
2705
|
+
<tr>
|
2706
|
+
<td>
|
2707
|
+
<p><code>document.filename</code> <a id="s_document_filename"></a></p>
|
2708
|
+
</td>
|
2709
|
+
<td>
|
2710
|
+
<p>The name of the output file.</p>
|
2711
|
+
</td>
|
2712
|
+
<td>
|
2713
|
+
<div class="code">
|
2714
|
+
<pre>
|
2715
|
+
<code>
|
2716
|
+
""
|
2717
|
+
</code>
|
2718
|
+
</pre>
|
2719
|
+
</div>
|
2720
|
+
</td>
|
2721
|
+
</tr>
|
2722
|
+
<tr>
|
2723
|
+
<td>
|
2724
|
+
<p><code>document.output</code> <a id="s_document_output"></a></p>
|
2725
|
+
</td>
|
2726
|
+
<td>
|
2727
|
+
<p>The format of the output file. It can be set to any value stored in the <a href="#s_document_output_targets">document.output_targets</a> setting.</p>
|
2728
|
+
</td>
|
2729
|
+
<td>
|
2730
|
+
<div class="code">
|
2731
|
+
<pre>
|
2732
|
+
<code>
|
2733
|
+
html
|
2734
|
+
</code>
|
2735
|
+
</pre>
|
2736
|
+
</div>
|
2737
|
+
</td>
|
2738
|
+
</tr>
|
2739
|
+
<tr>
|
2740
|
+
<td>
|
2741
|
+
<p><code>document.output_targets</code> <a id="s_document_output_targets"></a></p>
|
2742
|
+
</td>
|
2743
|
+
<td>
|
2744
|
+
<p>An <code>Array</code> containing all the possible output formats. This setting should not be changed by the user.</p>
|
2745
|
+
</td>
|
2746
|
+
<td>
|
2747
|
+
<div class="code">
|
2748
|
+
<pre>
|
2749
|
+
<code>
|
2750
|
+
- :html
|
2751
|
+
- :pdf
|
2752
|
+
</code>
|
2753
|
+
</pre>
|
2754
|
+
</div>
|
2755
|
+
</td>
|
2756
|
+
</tr>
|
2757
|
+
<tr>
|
2758
|
+
<td>
|
2759
|
+
<p><code>document.source</code> <a id="s_document_source"></a></p>
|
2760
|
+
</td>
|
2761
|
+
<td>
|
2762
|
+
<p>The main source file to compile. It can be also be overridden by calling the <a href="#c_compile">compile</a> command with the <code>-s</code> option.</p>
|
2763
|
+
</td>
|
2764
|
+
<td>
|
2765
|
+
<div class="code">
|
2766
|
+
<pre>
|
2767
|
+
<code>
|
2768
|
+
document.glyph
|
2769
|
+
</code>
|
2770
|
+
</pre>
|
2771
|
+
</div>
|
2772
|
+
</td>
|
2773
|
+
</tr>
|
2774
|
+
<tr>
|
2775
|
+
<td>
|
2776
|
+
<p><code>document.subtitle</code> <a id="s_document_subtitle"></a></p>
|
2777
|
+
</td>
|
2778
|
+
<td>
|
2779
|
+
<p>The subtitle of the document, displayed using the <a href="#m_subtitle">subtitle</a> macro.</p>
|
2780
|
+
</td>
|
2781
|
+
<td>
|
2782
|
+
<div class="code">
|
2783
|
+
<pre>
|
2784
|
+
<code>
|
2785
|
+
""
|
2786
|
+
</code>
|
2787
|
+
</pre>
|
2788
|
+
</div>
|
2789
|
+
</td>
|
2790
|
+
</tr>
|
2791
|
+
<tr>
|
2792
|
+
<td>
|
2793
|
+
<p><code>document.title</code> <a id="s_document_title"></a></p>
|
2794
|
+
</td>
|
2795
|
+
<td>
|
2796
|
+
<p>The title of the document, displayed using the <a href="#m_title">title</a> macro.</p>
|
2797
|
+
</td>
|
2798
|
+
<td>
|
2799
|
+
<div class="code">
|
2800
|
+
<pre>
|
2801
|
+
<code>
|
2802
|
+
""
|
2803
|
+
</code>
|
2804
|
+
</pre>
|
2805
|
+
</div>
|
2806
|
+
</td>
|
2807
|
+
</tr>
|
2808
|
+
</table>
|
2809
|
+
</div>
|
2810
|
+
<div class="section">
|
2811
|
+
<h3 id="h_118"><code>filters.*</code></h3>
|
2812
|
+
<table>
|
2813
|
+
<tr>
|
2814
|
+
<th>Name</th>
|
2815
|
+
<th>Description</th>
|
2816
|
+
<th>Default (<span class="caps">YAML</span>)</th>
|
2817
|
+
</tr>
|
2818
|
+
<tr>
|
2819
|
+
<td>
|
2820
|
+
<p><code>filters.by_file_extension</code> <a id="s_filters_by_file_extension"></a></p>
|
2821
|
+
</td>
|
2822
|
+
<td>
|
2823
|
+
<p>If set to <code>true</code>, a filter macro is applied to included files, based on their extensions (<span class="fmi">for more information on including files, see <a href="#incl">Including Files and Snippets</a></span>).</p>
|
2824
|
+
</td>
|
2825
|
+
<td>
|
2826
|
+
<div class="code">
|
2827
|
+
<pre>
|
2828
|
+
<code>
|
2829
|
+
true
|
2830
|
+
</code>
|
2831
|
+
</pre>
|
2832
|
+
</div>
|
2833
|
+
</td>
|
2834
|
+
</tr>
|
2835
|
+
<tr>
|
2836
|
+
<td>
|
2837
|
+
<p><code>filters.markdown.converter</code> <a id="s_filters_markdown_converter"></a></p>
|
2838
|
+
</td>
|
2839
|
+
<td>
|
2840
|
+
<p>The name of the markdown converter to use with the <a href="#m_markdown">markdown</a> macro. It can be set to one of the following values:</p>
|
2841
|
+
<ul>
|
2842
|
+
<li>BlueCloth</li>
|
2843
|
+
<li>RDiscount</li>
|
2844
|
+
<li>Maruku</li>
|
2845
|
+
<li>Kramdown</li>
|
2846
|
+
</ul>
|
2847
|
+
<p>If not set, Glyph tests for the presence of each gem in the same order, until one is found.</p>
|
2848
|
+
</td>
|
2849
|
+
<td>
|
2850
|
+
<div class="code">
|
2851
|
+
<pre>
|
2852
|
+
<code>
|
2853
|
+
bluecloth
|
2854
|
+
</code>
|
2855
|
+
</pre>
|
2856
|
+
</div>
|
2857
|
+
</td>
|
2858
|
+
</tr>
|
2859
|
+
<tr>
|
2860
|
+
<td>
|
2861
|
+
<p><code>filters.redcloth.restrictions</code> <a id="s_filters_redcloth_restrictions"></a></p>
|
2862
|
+
</td>
|
2863
|
+
<td>
|
2864
|
+
<p>An <code>Array</code> containing restrictions applied to RedCloth, used by the <a href="#m_textile">textile</a> macro (see <a href="http://redcloth.rubyforge.org/classes/RedCloth/TextileDoc.html">RedCloth Documentation</a> for more information).</p>
|
2865
|
+
</td>
|
2866
|
+
<td>
|
2867
|
+
<div class="code">
|
2868
|
+
<pre>
|
2869
|
+
<code>
|
2870
|
+
[]
|
2871
|
+
</code>
|
2872
|
+
</pre>
|
2873
|
+
</div>
|
2874
|
+
</td>
|
2875
|
+
</tr>
|
2876
|
+
<tr>
|
2877
|
+
<td>
|
2878
|
+
<p><code>filters.target</code> <a id="s_filters_target"></a></p>
|
2879
|
+
</td>
|
2880
|
+
<td>
|
2881
|
+
<p>The output target for filters. It can be set to <code>html</code> (for RedCloth and MarkDown) or <code>latex</code> (RedCloth-only).</p>
|
2882
|
+
</td>
|
2883
|
+
<td>
|
2884
|
+
<div class="code">
|
2885
|
+
<pre>
|
2886
|
+
<code>
|
2887
|
+
html
|
2888
|
+
</code>
|
2889
|
+
</pre>
|
2890
|
+
</div>
|
2891
|
+
</td>
|
2892
|
+
</tr>
|
2893
|
+
</table>
|
2894
|
+
</div>
|
2895
|
+
<div class="section">
|
2896
|
+
<h3 id="s_highlighters"><code>highlighters.*</code></h3>
|
2897
|
+
<table>
|
2898
|
+
<tr>
|
2899
|
+
<th>Name</th>
|
2900
|
+
<th>Description</th>
|
2901
|
+
<th>Default (<span class="caps">YAML</span>)</th>
|
2902
|
+
</tr>
|
2903
|
+
<tr>
|
2904
|
+
<td>
|
2905
|
+
<p><code>highlighters.coderay.*</code> <a id="s_highlighters_coderay_*"></a></p>
|
2906
|
+
</td>
|
2907
|
+
<td>
|
2908
|
+
<p>Some <a href="http://coderay.rubychan.de/">Coderay</a>-specific <a href="http://coderay.rubychan.de/doc/classes/CodeRay/Encoders/HTML.html">options</a>.</p>
|
2909
|
+
</td>
|
2910
|
+
<td>
|
2911
|
+
<div class="code">
|
2912
|
+
<pre>
|
2913
|
+
<code>
|
2914
|
+
nil
|
2915
|
+
</code>
|
2916
|
+
</pre>
|
2917
|
+
</div>
|
2918
|
+
</td>
|
2919
|
+
</tr>
|
2920
|
+
<tr>
|
2921
|
+
<td>
|
2922
|
+
<p><code>highlighters.current</code> <a id="s_highlighters_current"></a></p>
|
2923
|
+
</td>
|
2924
|
+
<td>
|
2925
|
+
<p>The current highlighter to use. It can be set to <code>coderay</code> or <code>ultraviolet</code></p>
|
2926
|
+
</td>
|
2927
|
+
<td>
|
2928
|
+
<div class="code">
|
2929
|
+
<pre>
|
2930
|
+
<code>
|
2931
|
+
coderay
|
2932
|
+
</code>
|
2933
|
+
</pre>
|
2934
|
+
</div>
|
2935
|
+
</td>
|
2936
|
+
</tr>
|
2937
|
+
<tr>
|
2938
|
+
<td>
|
2939
|
+
<p><code>highlighters.target</code> <a id="s_highlighters_target"></a></p>
|
2940
|
+
</td>
|
2941
|
+
<td>
|
2942
|
+
<p>The target output of the <a href="#s_highlighters_current">current highlighter</a>. It can be set to anything the highlighter supports.</p>
|
2943
|
+
</td>
|
2944
|
+
<td>
|
2945
|
+
<div class="code">
|
2946
|
+
<pre>
|
2947
|
+
<code>
|
2948
|
+
html
|
2949
|
+
</code>
|
2950
|
+
</pre>
|
2951
|
+
</div>
|
2952
|
+
</td>
|
2953
|
+
</tr>
|
2954
|
+
<tr>
|
2955
|
+
<td>
|
2956
|
+
<p><code>highlighters.ultraviolet.line_numbers</code> <a id="s_highlighters_ultraviolet_line_numbers"></a></p>
|
2957
|
+
</td>
|
2958
|
+
<td>
|
2959
|
+
<p>Whether the <a href="http://ultraviolet.rubyforge.org/">Ultraviolet</a> highlighter should display line numbers or not.</p>
|
2960
|
+
</td>
|
2961
|
+
<td>
|
2962
|
+
<div class="code">
|
2963
|
+
<pre>
|
2964
|
+
<code>
|
2965
|
+
false
|
2966
|
+
</code>
|
2967
|
+
</pre>
|
2968
|
+
</div>
|
2969
|
+
</td>
|
2970
|
+
</tr>
|
2971
|
+
<tr>
|
2972
|
+
<td>
|
2973
|
+
<p><code>highlighters.ultraviolet.theme</code> <a id="s_highlighters_ultraviolet_theme"></a></p>
|
2974
|
+
</td>
|
2975
|
+
<td>
|
2976
|
+
<p>The theme used by the <a href="http://ultraviolet.rubyforge.org/">Ultraviolet</a> highlighter.</p>
|
2977
|
+
</td>
|
2978
|
+
<td>
|
2979
|
+
<div class="code">
|
2980
|
+
<pre>
|
2981
|
+
<code>
|
2982
|
+
blackboard
|
2983
|
+
</code>
|
2984
|
+
</pre>
|
2985
|
+
</div>
|
2986
|
+
</td>
|
2987
|
+
</tr>
|
2988
|
+
</table>
|
2989
|
+
</div>
|
2990
|
+
<div class="section">
|
2991
|
+
<h3 id="h_120"><code>structure.*</code></h3>
|
2992
|
+
<p>The following configuration settings are used internally by Glyph and should not be changed by the user.</p>
|
2993
|
+
<table>
|
2994
|
+
<tr>
|
2995
|
+
<th>Name</th>
|
2996
|
+
<th>Description</th>
|
2997
|
+
<th>Default (<span class="caps">YAML</span>)</th>
|
2998
|
+
</tr>
|
2999
|
+
<tr>
|
3000
|
+
<td>
|
3001
|
+
<p><code>structure.backmatter</code> <a id="s_structure_backmatter"></a></p>
|
3002
|
+
</td>
|
3003
|
+
<td>
|
3004
|
+
<p>The section types used in the document backmatter.</p>
|
3005
|
+
</td>
|
3006
|
+
<td>
|
3007
|
+
<div class="code">
|
3008
|
+
<pre>
|
3009
|
+
<code>
|
3010
|
+
- :epilogue
|
3011
|
+
- :afterword
|
3012
|
+
- :postscript
|
3013
|
+
- :appendix
|
3014
|
+
- :addendum
|
3015
|
+
- :glossary
|
3016
|
+
- :colophon
|
3017
|
+
- :bibliography
|
3018
|
+
- :promotion
|
3019
|
+
- :references
|
3020
|
+
- :index
|
3021
|
+
- :lot
|
3022
|
+
- :lof
|
3023
|
+
</code>
|
3024
|
+
</pre>
|
3025
|
+
</div>
|
3026
|
+
</td>
|
3027
|
+
</tr>
|
3028
|
+
<tr>
|
3029
|
+
<td>
|
3030
|
+
<p><code>structure.bodymatter</code> <a id="s_structure_bodymatter"></a></p>
|
3031
|
+
</td>
|
3032
|
+
<td>
|
3033
|
+
<p>The section types used in the document bodymatter.</p>
|
3034
|
+
</td>
|
3035
|
+
<td>
|
3036
|
+
<div class="code">
|
3037
|
+
<pre>
|
3038
|
+
<code>
|
3039
|
+
- :volume
|
3040
|
+
- :book
|
3041
|
+
- :part
|
3042
|
+
- :chapter
|
3043
|
+
</code>
|
3044
|
+
</pre>
|
3045
|
+
</div>
|
3046
|
+
</td>
|
3047
|
+
</tr>
|
3048
|
+
<tr>
|
3049
|
+
<td>
|
3050
|
+
<p><code>structure.frontmatter</code> <a id="s_structure_frontmatter"></a></p>
|
3051
|
+
</td>
|
3052
|
+
<td>
|
3053
|
+
<p>The section types used in the document frontmatter.</p>
|
3054
|
+
</td>
|
3055
|
+
<td>
|
3056
|
+
<div class="code">
|
3057
|
+
<pre>
|
3058
|
+
<code>
|
3059
|
+
- :preface
|
3060
|
+
- :imprint
|
3061
|
+
- :dedication
|
3062
|
+
- :inspiration
|
3063
|
+
- :foreword
|
3064
|
+
- :introduction
|
3065
|
+
- :acknowledgement
|
3066
|
+
- :prologue
|
3067
|
+
</code>
|
3068
|
+
</pre>
|
3069
|
+
</div>
|
3070
|
+
</td>
|
3071
|
+
</tr>
|
3072
|
+
<tr>
|
3073
|
+
<td>
|
3074
|
+
<p><code>structure.hidden</code> <a id="s_structure_hidden"></a></p>
|
3075
|
+
</td>
|
3076
|
+
<td>
|
3077
|
+
<p>The section types that will not be shown in the Table of Contents.</p>
|
3078
|
+
</td>
|
3079
|
+
<td>
|
3080
|
+
<div class="code">
|
3081
|
+
<pre>
|
3082
|
+
<code>
|
3083
|
+
- :imprint
|
3084
|
+
- :dedication
|
3085
|
+
- :inspiration
|
3086
|
+
- :postscript
|
3087
|
+
- :colophon
|
3088
|
+
- :promotion
|
3089
|
+
</code>
|
3090
|
+
</pre>
|
3091
|
+
</div>
|
3092
|
+
</td>
|
3093
|
+
</tr>
|
3094
|
+
<tr>
|
3095
|
+
<td>
|
3096
|
+
<p><code>structure.special</code> <a id="s_structure_special"></a></p>
|
3097
|
+
</td>
|
3098
|
+
<td>
|
3099
|
+
<p>The section types that will be considered <em>special</em> and whose children will not be included in the Table of Contents.</p>
|
3100
|
+
</td>
|
3101
|
+
<td>
|
3102
|
+
<div class="code">
|
3103
|
+
<pre>
|
3104
|
+
<code>
|
3105
|
+
- :foreword
|
3106
|
+
- :acknowledgement
|
3107
|
+
- :prologue
|
3108
|
+
- :epilogue
|
3109
|
+
- :addendum
|
3110
|
+
- :glossary
|
3111
|
+
- :bibliography
|
3112
|
+
- :references
|
3113
|
+
- :index
|
3114
|
+
- :lot
|
3115
|
+
- :lof
|
3116
|
+
</code>
|
3117
|
+
</pre>
|
3118
|
+
</div>
|
3119
|
+
</td>
|
3120
|
+
</tr>
|
3121
|
+
</table>
|
3122
|
+
</div>
|
3123
|
+
<div class="section">
|
3124
|
+
<h3 id="h_121"><code>tools.*</code></h3>
|
3125
|
+
<table>
|
3126
|
+
<tr>
|
3127
|
+
<th>Name</th>
|
3128
|
+
<th>Description</th>
|
3129
|
+
<th>Default (<span class="caps">YAML</span>)</th>
|
3130
|
+
</tr>
|
3131
|
+
<tr>
|
3132
|
+
<td>
|
3133
|
+
<p><code>tools.pdf_generator</code> <a id="s_tools_pdf_generator"></a></p>
|
3134
|
+
</td>
|
3135
|
+
<td>
|
3136
|
+
<p>The external program used to generate <span class="caps">PDF</span> files. It can only be set to <code>prince</code>.</p>
|
3137
|
+
</td>
|
3138
|
+
<td>
|
3139
|
+
<div class="code">
|
3140
|
+
<pre>
|
3141
|
+
<code>
|
3142
|
+
prince
|
3143
|
+
</code>
|
3144
|
+
</pre>
|
3145
|
+
</div>
|
3146
|
+
</td>
|
3147
|
+
</tr>
|
3148
|
+
</table>
|
3149
|
+
</div>
|
3150
|
+
|
3151
|
+
</div>
|
3152
|
+
<div class="appendix">
|
3153
|
+
<h2 id="h_122">Changelog</h2>
|
3154
|
+
|
3155
|
+
|
3156
|
+
<div class="section">
|
3157
|
+
<h3 id="h_123">v0.2.0 – May 9th 2010</h3>
|
3158
|
+
<div class="section">
|
3159
|
+
<h4 id="h_124">11 Features Implemented</h4>
|
3160
|
+
<table>
|
3161
|
+
<tr>
|
3162
|
+
<th>ID</th>
|
3163
|
+
<th>Description</th>
|
3164
|
+
</tr>
|
3165
|
+
<tr>
|
3166
|
+
<td>
|
3167
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/62">#62</a>
|
3168
|
+
|
3169
|
+
</td>
|
3170
|
+
<td>
|
3171
|
+
<p>A new <a href="#m_highlight">highlight</a> macro is available to highlight source code (CodeRay or UltraViolet requireed).</p>
|
3172
|
+
|
3173
|
+
</td>
|
3174
|
+
</tr>
|
3175
|
+
|
3176
|
+
|
3177
|
+
<tr>
|
3178
|
+
<td>
|
3179
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/76">#76</a>
|
3180
|
+
|
3181
|
+
</td>
|
3182
|
+
<td>
|
3183
|
+
<p>It is now possible to use Glyph programmatically via the new <code>Glyph#filter</code> and <code>Glyph#compile</code> methods.</p>
|
3184
|
+
|
3185
|
+
</td>
|
3186
|
+
</tr>
|
3187
|
+
|
3188
|
+
|
3189
|
+
<tr>
|
3190
|
+
<td>
|
3191
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/87">#87</a>
|
3192
|
+
|
3193
|
+
</td>
|
3194
|
+
<td>
|
3195
|
+
<p>It is now possible to define snippets inside a Glyph source file using the <a href="#m_snippet_">snippet:</a> macro.</p>
|
3196
|
+
|
3197
|
+
</td>
|
3198
|
+
</tr>
|
3199
|
+
|
3200
|
+
|
3201
|
+
<tr>
|
3202
|
+
<td>
|
3203
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/88">#88</a>
|
3204
|
+
|
3205
|
+
</td>
|
3206
|
+
<td>
|
3207
|
+
<p>It is now possible to change configuration settings inside a Glyph source file using the <a href="#m_config_">config:</a> macro (Jabbslad).</p>
|
3208
|
+
|
3209
|
+
</td>
|
3210
|
+
</tr>
|
3211
|
+
|
3212
|
+
|
3213
|
+
<tr>
|
3214
|
+
<td>
|
3215
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/89">#89</a>
|
3216
|
+
|
3217
|
+
</td>
|
3218
|
+
<td>
|
3219
|
+
<p>It is now possible to compile a single Glyph source file without creating a Glyph project.</p>
|
3220
|
+
|
3221
|
+
</td>
|
3222
|
+
</tr>
|
3223
|
+
|
3224
|
+
|
3225
|
+
<tr>
|
3226
|
+
<td>
|
3227
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/92">#92</a>
|
3228
|
+
|
3229
|
+
</td>
|
3230
|
+
<td>
|
3231
|
+
<p>6 new macros have been defined to allow conditional processing (<a href="#m_condition">condition</a> macro, <a href="#m_eq">eq</a> macro, <a href="#m_not">not</a> macro, <a href="#m_and">and</a> macro, <a href="#m_or">or</a> macro, <a href="#m_match">match</a> macro)</p>
|
3232
|
+
|
3233
|
+
</td>
|
3234
|
+
</tr>
|
3235
|
+
|
3236
|
+
|
3237
|
+
<tr>
|
3238
|
+
<td>
|
3239
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/94">#94</a>
|
3240
|
+
|
3241
|
+
</td>
|
3242
|
+
<td>
|
3243
|
+
<p>It is now possible to add <em>validators</em> to macros, for example to check the number of parameters they take.</p>
|
3244
|
+
|
3245
|
+
</td>
|
3246
|
+
</tr>
|
3247
|
+
|
3248
|
+
|
3249
|
+
<tr>
|
3250
|
+
<td>
|
3251
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/97">#97</a>
|
3252
|
+
|
3253
|
+
</td>
|
3254
|
+
<td>
|
3255
|
+
<p>The <a href="#c_compile">compile</a> command command can now take an extra <code>--auto</code> switch to trigger document auto-regeneration whenever a source file is changed (koraktor).</p>
|
3256
|
+
|
3257
|
+
</td>
|
3258
|
+
</tr>
|
3259
|
+
|
3260
|
+
|
3261
|
+
<tr>
|
3262
|
+
<td>
|
3263
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/99">#99</a>
|
3264
|
+
|
3265
|
+
</td>
|
3266
|
+
<td>
|
3267
|
+
<p>Added a <code>document.draft</code> setting. If set to <code>true</code>, comments and TODOs are rendered in output files.</p>
|
3268
|
+
|
3269
|
+
</td>
|
3270
|
+
</tr>
|
3271
|
+
|
3272
|
+
|
3273
|
+
<tr>
|
3274
|
+
<td>
|
3275
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/100">#100</a>
|
3276
|
+
|
3277
|
+
</td>
|
3278
|
+
<td>
|
3279
|
+
<p><a id="system_css"></a>Glyph <span class="caps">CSS</span> files are no longer copied to new projects, but they can be referenced as if they were (see also <a href="#css_not_copied">#93</a>).</p>
|
3280
|
+
|
3281
|
+
</td>
|
3282
|
+
</tr>
|
3283
|
+
|
3284
|
+
|
3285
|
+
<tr>
|
3286
|
+
<td>
|
3287
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/108">#108</a>
|
3288
|
+
|
3289
|
+
</td>
|
3290
|
+
<td>
|
3291
|
+
<p>It is now possible to define Glyph macros within Glyph source files using the <a href="#m_macro_">macro:</a> macro.</p>
|
3292
|
+
|
3293
|
+
</td>
|
3294
|
+
</tr>
|
3295
|
+
</table>
|
3296
|
+
|
3297
|
+
</div>
|
3298
|
+
|
3299
|
+
|
3300
|
+
<div class="section">
|
3301
|
+
<h4 id="h_125">8 Bugs Fixed</h4>
|
3302
|
+
<table>
|
3303
|
+
<tr>
|
3304
|
+
<th>ID</th>
|
3305
|
+
<th>Description</th>
|
3306
|
+
</tr>
|
3307
|
+
<tr>
|
3308
|
+
<td>
|
3309
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/86">#86</a>
|
3310
|
+
|
3311
|
+
</td>
|
3312
|
+
<td>
|
3313
|
+
<p>Warning and error messages have been updated, and it is now possible to show additional debug information. Additionally, syntax errors are now handled before the document is processed.</p>
|
3314
|
+
|
3315
|
+
</td>
|
3316
|
+
</tr>
|
3317
|
+
|
3318
|
+
|
3319
|
+
<tr>
|
3320
|
+
<td>
|
3321
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/93">#93</a>
|
3322
|
+
|
3323
|
+
</td>
|
3324
|
+
<td>
|
3325
|
+
<p><a id="css_not_copied"></a>Default css files were not copied when creating a new project. The issue has been resolved by allowing the <a href="#m_style">style</a> macro to reference Glyph’s system styles (see also <a href="#system_css">#100</a>).</p>
|
3326
|
+
|
3327
|
+
</td>
|
3328
|
+
</tr>
|
3329
|
+
|
3330
|
+
|
3331
|
+
<tr>
|
3332
|
+
<td>
|
3333
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/95">#95</a>
|
3334
|
+
|
3335
|
+
</td>
|
3336
|
+
<td>
|
3337
|
+
<p>The <a href="#c_config">config</a> command did not save data to <span class="caps">YAML</span> configuration files. This has been fixed ensuring that internal configuration overrides are not saved to the <span class="caps">YAML</span> file too.</p>
|
3338
|
+
|
3339
|
+
</td>
|
3340
|
+
</tr>
|
3341
|
+
|
3342
|
+
|
3343
|
+
<tr>
|
3344
|
+
<td>
|
3345
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/98">#98</a>
|
3346
|
+
|
3347
|
+
</td>
|
3348
|
+
<td>
|
3349
|
+
<p>Glyph is now fully compatible with Ruby 1.9.1 and JRuby 1.4.0.</p>
|
3350
|
+
|
3351
|
+
</td>
|
3352
|
+
</tr>
|
3353
|
+
|
3354
|
+
|
3355
|
+
<tr>
|
3356
|
+
<td>
|
3357
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/101">#101</a>
|
3358
|
+
|
3359
|
+
</td>
|
3360
|
+
<td>
|
3361
|
+
<p>Additional tests have been developed to improve Textile support. There should no longer be errors when using textile block elements inside Glyph macros.</p>
|
3362
|
+
|
3363
|
+
</td>
|
3364
|
+
</tr>
|
3365
|
+
|
3366
|
+
|
3367
|
+
<tr>
|
3368
|
+
<td>
|
3369
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/103">#103</a>
|
3370
|
+
|
3371
|
+
</td>
|
3372
|
+
<td>
|
3373
|
+
<p>Fixed a bug that caused test failures when deleting the test project directory.</p>
|
3374
|
+
|
3375
|
+
</td>
|
3376
|
+
</tr>
|
3377
|
+
|
3378
|
+
|
3379
|
+
<tr>
|
3380
|
+
<td>
|
3381
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/104">#104</a>
|
3382
|
+
|
3383
|
+
</td>
|
3384
|
+
<td>
|
3385
|
+
<p>Nested Glyph macros calling <code>Macro#interpret</code> no longer ignore escape delimiters.</p>
|
3386
|
+
|
3387
|
+
</td>
|
3388
|
+
</tr>
|
3389
|
+
|
3390
|
+
|
3391
|
+
<tr>
|
3392
|
+
<td>
|
3393
|
+
<a href="http://github.com/h3rald/glyph/issues/closed#issue/107">#107</a>
|
3394
|
+
|
3395
|
+
</td>
|
3396
|
+
<td>
|
3397
|
+
<p>Added the possibility to encode (using the <a href="#m_encode">encode</a> macro) and decode (using the <a href="#m_decode">decode</a> macro) macros so that they can be interpreted later.</p>
|
3398
|
+
|
3399
|
+
</td>
|
3400
|
+
</tr>
|
3401
|
+
</table>
|
3402
|
+
|
3403
|
+
</div>
|
3404
|
+
|
3405
|
+
</div>
|
3406
|
+
|
3407
|
+
|
3408
|
+
<div class="section">
|
3409
|
+
<h3 id="h_126">v0.1.0 – April 8th 2010</h3>
|
3410
|
+
Initial release.
|
3411
|
+
|
3412
|
+
</div>
|
3413
|
+
|
3414
|
+
</div>
|
3415
|
+
|
3416
|
+
</div>
|
1802
3417
|
|
1803
|
-
|
1804
|
-
|
1805
|
-
</div>
|
3418
|
+
</body>
|
1806
3419
|
|
1807
|
-
</div>
|
1808
|
-
</body>
|
1809
3420
|
</html>
|