glyph 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/AUTHORS.textile +1 -1
  2. data/CHANGELOG.textile +119 -222
  3. data/LICENSE.textile +1 -1
  4. data/README.textile +42 -23
  5. data/Rakefile +1 -3
  6. data/VERSION +1 -1
  7. data/benchmark.rb +72 -0
  8. data/book/config.yml +4 -4
  9. data/book/document.glyph +90 -57
  10. data/book/images/document_generation.png +0 -0
  11. data/book/lib/macros/reference.rb +75 -22
  12. data/book/output/html/glyph.html +3183 -2121
  13. data/book/output/html/images/document_generation.png +0 -0
  14. data/book/output/pdf/glyph.pdf +7370 -4913
  15. data/book/resources/document_generation.txt +34 -0
  16. data/book/snippets.yml +6 -0
  17. data/book/text/changelog.glyph +45 -34
  18. data/book/text/compiling/compiling.glyph +23 -0
  19. data/book/text/compiling/lite_mode.glyph +23 -0
  20. data/book/text/compiling/programmatic_usage.glyph +77 -0
  21. data/book/text/extending/bookmarks_headers.glyph +21 -0
  22. data/book/text/extending/further_reading.glyph +13 -0
  23. data/book/text/extending/internals.glyph +79 -0
  24. data/book/text/extending/interpreting.glyph +51 -0
  25. data/book/text/extending/macro_def.glyph +64 -0
  26. data/book/text/extending/params_attrs.glyph +70 -0
  27. data/book/text/extending/placeholders.glyph +34 -0
  28. data/book/text/extending/validators.glyph +16 -0
  29. data/book/text/getting_started/configuration.glyph +49 -0
  30. data/book/text/getting_started/create_project.glyph +41 -0
  31. data/book/text/getting_started/structure.glyph +55 -0
  32. data/book/text/introduction.glyph +49 -26
  33. data/book/text/license.glyph +1 -1
  34. data/book/text/macros/macros_block.glyph +99 -0
  35. data/book/text/macros/macros_core.glyph +208 -0
  36. data/book/text/macros/macros_filters.glyph +40 -0
  37. data/book/text/macros/macros_inline.glyph +50 -0
  38. data/book/text/macros/macros_structure.glyph +100 -0
  39. data/book/text/ref_commands.glyph +94 -73
  40. data/book/text/ref_config.glyph +34 -42
  41. data/book/text/ref_macros.glyph +1 -373
  42. data/book/text/text_editing/code.glyph +51 -0
  43. data/book/text/text_editing/conditionals.glyph +49 -0
  44. data/book/text/text_editing/evaluation.glyph +13 -0
  45. data/book/text/text_editing/glyph_files.glyph +7 -0
  46. data/book/text/text_editing/images.glyph +29 -0
  47. data/book/text/text_editing/inclusions.glyph +44 -0
  48. data/book/text/text_editing/links.glyph +53 -0
  49. data/book/text/text_editing/macro_intro.glyph +111 -0
  50. data/book/text/text_editing/raw_html.glyph +112 -0
  51. data/book/text/text_editing/sections.glyph +63 -0
  52. data/book/text/text_editing/stylesheets.glyph +36 -0
  53. data/book/text/troubleshooting/errors_command.glyph +39 -0
  54. data/book/text/troubleshooting/errors_generic.glyph +29 -0
  55. data/book/text/troubleshooting/errors_intro.glyph +3 -0
  56. data/book/text/troubleshooting/errors_macro.glyph +98 -0
  57. data/book/text/troubleshooting/errors_parser.glyph +29 -0
  58. data/config.yml +77 -58
  59. data/document.glyph +25 -25
  60. data/glyph.gemspec +57 -22
  61. data/lib/glyph.rb +54 -13
  62. data/lib/glyph/commands.rb +84 -17
  63. data/lib/glyph/config.rb +3 -3
  64. data/lib/glyph/document.rb +14 -8
  65. data/lib/glyph/interpreter.rb +18 -58
  66. data/lib/glyph/macro.rb +160 -55
  67. data/lib/glyph/macro_validators.rb +104 -12
  68. data/lib/glyph/node.rb +24 -0
  69. data/lib/glyph/parser.rb +278 -0
  70. data/lib/glyph/syntax_node.rb +225 -0
  71. data/macros/core.rb +212 -0
  72. data/macros/filters.rb +66 -15
  73. data/macros/html/block.rb +43 -105
  74. data/macros/html/inline.rb +11 -12
  75. data/macros/html/structure.rb +123 -58
  76. data/macros/xml.rb +33 -0
  77. data/spec/files/container.textile +2 -2
  78. data/spec/files/document.glyph +2 -2
  79. data/spec/files/document_with_toc.glyph +3 -3
  80. data/spec/files/included.textile +1 -1
  81. data/spec/files/ligature.jpg +0 -0
  82. data/spec/files/markdown.markdown +2 -1
  83. data/spec/lib/commands_spec.rb +46 -3
  84. data/spec/lib/document_spec.rb +4 -4
  85. data/spec/lib/glyph_spec.rb +17 -46
  86. data/spec/lib/interpreter_spec.rb +6 -25
  87. data/spec/lib/macro_spec.rb +141 -43
  88. data/spec/lib/macro_validators_spec.rb +27 -5
  89. data/spec/lib/node_spec.rb +26 -1
  90. data/spec/lib/parser_spec.rb +246 -0
  91. data/spec/lib/syntax_node_spec.rb +111 -0
  92. data/spec/macros/core_spec.rb +195 -0
  93. data/spec/macros/filters_spec.rb +38 -4
  94. data/spec/macros/macros_spec.rb +20 -176
  95. data/spec/macros/textile_spec.rb +13 -71
  96. data/spec/macros/xml_spec.rb +77 -0
  97. data/spec/spec_helper.rb +50 -10
  98. data/spec/tasks/load_spec.rb +13 -2
  99. data/styles/default.css +18 -6
  100. data/styles/pagination.css +1 -19
  101. data/tasks/generate.rake +2 -2
  102. data/tasks/load.rake +27 -17
  103. data/tasks/project.rake +1 -1
  104. metadata +75 -62
  105. data/book/script/compile.rb +0 -8
  106. data/book/script/prof +0 -1
  107. data/book/script/prof_results.htm +0 -21079
  108. data/book/text/authoring.glyph +0 -548
  109. data/book/text/extending.glyph +0 -224
  110. data/book/text/getting_started.glyph +0 -158
  111. data/book/text/troubleshooting.glyph +0 -179
  112. data/lib/glyph/glyph_language.rb +0 -538
  113. data/lib/glyph/glyph_language.treetop +0 -27
  114. data/macros/common.rb +0 -160
@@ -1,224 +0,0 @@
1
- Glyph was created wih extensibility in mind. You can freely extend &[glang] by creating or overriding macros, to do whatever you like. Macro definitions are written in pure Ruby code and placed in @.rb@ files within the @lib/macros/@ folder of your project.
2
-
3
- tip[Alternatively, you can also define macros right in your document, using the %>[macro:].]
4
-
5
- section[header[Anatomy of a Macro]
6
-
7
- This is the source code of a fairly simple macro used to format a note :
8
-
9
- <notextile>
10
- highlight[=ruby|
11
- macro :note do
12
- %{<div class="#{@name}"><span class="note-title">#{@name.to_s.capitalize}</span>
13
- #{@value}
14
-
15
- </div>}
16
- end=]
17
- </notextile>
18
-
19
- The @macro@ method takes a single @Symbol@ or @String@ parameter, corresponding to the name of the macro. In this case, the entire block (or _body_ of the macro) is a @String@ corresponding to what we want the macro to evaluate to: a @<div>@ tag containing a note.
20
-
21
- The body of the macro is evaluated in the context of the =>[http://yardoc.org/docs/glyph/Glyph/Macro|@Glyph::Macro@] class, therefore its instance variables (like codeph[@name] or codeph[@value]) can be used directly.
22
-
23
- box[Why using codeph[@name] instead of just "note"?|
24
- For the @note@ macro, it absolutely makes no difference. However, by using codeph[@name] it is possible to re-use the same code for the @tip@, @important@ and @caution@ macros as well, which are in fact only aliases of the @note@ macro:
25
-
26
- @macro_alias :important => :note@
27
- @macro_alias :tip => :note@
28
- @macro_alias :caution => :note@
29
- ] --[End box]
30
-
31
- The following table lists all the instance variables that can be used inside macros:
32
-
33
- table[
34
- tr[
35
- th[Variable]
36
- th[Description]
37
- ]
38
- tr[
39
- td[codeph[@node]]
40
- td[A =>[http://yardoc.org/docs/glyph/Node|@Node@] containing information about the macro, within the document syntax tree. Useful for accessing parent and child macros, and the current =>[http://yardoc.org/docs/glyph/Glyph/Document|@Document@]. Normally, macro nodes contain the following keys:
41
- * @:name@, the name of the macro.
42
- * @:value@, the value (i.e. the contents, within the delimiters) of the macro
43
- * @:source@, a @String@ identifying the source of the macro (a file, a snippet, etc.)
44
- * @:document@, the parsed document tree.
45
-
46
- Note that the first three keys can also be accessed via instance variables.]
47
- ]
48
- tr[
49
- td[codeph[@name]]
50
- td[The name of the macro]
51
- ]
52
- tr[
53
- td[codeph[@value]]
54
- td[The full contents (including parameters and nested macros) inside the macro delimiters.]
55
- ]
56
- tr[
57
- td[codeph[@source]]
58
- td[A @String@ identifying the source of the macro (a file, a snippet, etc.) ]
59
- ]
60
- tr[
61
- td[codeph[@params]]
62
- td[The parameters passed to the macro. In other words, the value of the macro split by pipes (@\|@).]
63
- ]
64
- ] --[End Table]
65
-
66
- ]
67
-
68
- section[header[Bookmarks and Headers]
69
-
70
- The =>[http://yardoc.org/docs/glyph/Glyph/Macro|@Glyph::Macro@] class also includes a few methods to check and store bookmarks and headers. Consider for example the following source code for the %>[anchor]:
71
-
72
- <notextile>
73
- highlight[=ruby|
74
- macro :anchor do
75
- ident, title = @params
76
- macro_error "Bookmark '#{ident}' already exists" if bookmark? ident
77
- bookmark :id => ident, :title => title
78
- %{<a id="#{ident}">#{title}</a>}
79
- end
80
- =]
81
- </notextile>
82
-
83
- The @bookmark?@ method can be used to check the existance of a particular ID within the whole document, while the @bookmark@ method is used to store bookmark IDs and titles. In a similar way, you can use @header?@ and @header@ methods to check the existance of headers within the documents or store new ones.
84
-
85
- ]
86
-
87
- section[header[Using Placeholders]
88
-
89
- 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 _after_ the link.
90
-
91
- Here's the source code of the %>[link]:
92
-
93
- <notextile>
94
- highlight[=ruby|
95
- macro :link do
96
- href, title = @params
97
- if href.match /^#/ then
98
- anc = href.gsub(/^#/, '').to_sym
99
- bmk = bookmark? anc
100
- if bmk then
101
- title \|\|= bmk[:title]
102
- else
103
- plac = placeholder do \|document\|
104
- macro_error "Bookmark '#{anc}' does not exist" unless document.bookmarks[anc]
105
- document.bookmarks[anc][:title]
106
- end
107
- title \|\|= plac
108
- end
109
- end
110
- title \|\|= href
111
- %{<a href="#{href}">#{title}</a>}
112
- end
113
- =]
114
- </notextile>
115
-
116
- 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 @placeholder@ 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.
117
-
118
- Within the @placeholder@ block, the @document@ parameter is, by all means, the fully analyzed document.
119
- ]
120
-
121
- section[header[Using Validators]
122
- If you need to make sure that a macro is used properly, consider using =>[http://yardoc.org/docs/glyph/Glyph/Macro/Validators|validators]. 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.
123
-
124
- If you want to create your own validators, you can call the generic @validate@ method which takes the message to display in case of error, a Hash of options and a block containing the validation to perform.
125
-
126
- box[Validating macro placement|
127
- 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.
128
-
129
- Suppose, for example, that the %>[header] is only allowed within a @section@ macro. This means that, for example:
130
- * the macro cannot be used within @chapter@ or @appendix@ macros.
131
- * the macro cannot be used in snippets
132
-
133
- Even if you consider all the possibilities within the scope of the default macros provided with Glyph, this would also make the @header@ macro unusable within custom macros.
134
- ]
135
-
136
- ]
137
-
138
- section[header[Interpreting Glyph Code]
139
-
140
- What if you need to evaluate some Glyph code _within_ 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 @interpret@ method, as follows:
141
-
142
- <notextile>
143
- highlight[=ruby|
144
- macro :fmi do
145
- topic, href = @params
146
- link = placeholder do \|document\|
147
- interpret "link[#{href}]"
148
- end
149
- %{<span class="fmi">for more information on #{topic}, see #{link}</span>}
150
- end
151
- =]
152
- </notextile>
153
-
154
- When the @interpret@ method is called, the following happens:
155
- # A new Glyph document is created from the @String@ passed to the method.
156
- # 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.
157
- # 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 _the main document_ is finalized.
158
-
159
- section[header[Encoding and Decoding Glyph Code|encode_decode]
160
- When you use the @interpret@ method, keep in mind that the code is interpreted _before_ the macro execution ends. This may not always be what you want: if you're nesting macros interpreting @section@ and @header@ macros,for example, your Table of Contents may get messed up, with child sections showing up before their parents.
161
-
162
- To avoid this, you can use the @encode@ and @decode@ methods, as shown in the macros defined for Glyph's =>[http://github.com/h3rald/glyph/blob/master/book/text/changelog.glyph|Changelog]:
163
-
164
- <notextile>
165
- highlight[=ruby|
166
- macro :issue do
167
- exact_parameters 2
168
- ident, desc = @params
169
- encode %{
170
- tr[
171
- td[\=>[http://github.com/h3rald/glyph/issues/closed#issue/#{ident}\|##{ident}]]
172
- td[textile[#{desc}]]
173
- ]
174
- }
175
- end
176
-
177
- macro :features do
178
- verb = (@name == :features) ? "Implemented" : "Fixed"
179
- total = @node.children.length
180
- encode %{
181
- section[header[#{total} #{@name.to_s.capitalize} #{verb}]
182
- table[
183
- tr[
184
- th[ID]
185
- th[Description]
186
- ]
187
- #@value
188
- ]
189
- ]
190
- }
191
- end
192
-
193
- macro :release do
194
- exact_parameters 3
195
- number, date, contents = @params
196
- interpret %{
197
- section[header[v#{number} &ndash; #{date}]
198
- #{decode contents}
199
- ]
200
- }
201
- end
202
- =]
203
- </notextile>
204
-
205
- In this case, @issue@ macros are nested within a @features@ macro, which in turn is nested within a @release@ 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 @release@ macro's job to do so. Instead, the @features@ and @issue@ macros just encode text which will then be decoded by the @release@ macro, before being interpreted.
206
-
207
- When you _encode_ a macro, its delimiters (@\[@, @\]@, and @\|@) will be escaped (into ‡\.‡¤\.91\.¤‡\.‡, ‡\.‡¤\.93\.¤‡\.‡, and ‡\.‡¤\.124\.¤‡\.‡ respectively), and when you _decode_ it, they will be unescaped. In a nutshell, you may want to use the encode/decode mechanism when:
208
- * When you're nesting macros interpreting Glyph code, without side effects.
209
- * When all you want is to copy some Glyph code from child macros into their parents.
210
-
211
- note[These methods are also wrapped in the %>[encode] and in the %>[decode].]
212
- ]
213
- ]
214
-
215
- section[header[Further Reading]
216
-
217
- For more examples on how to create more complex macros, have a look at the =>[http://github.com/h3rald/glyph/tree/master/macros/|source code] of the existing ones.
218
-
219
- To gain a deeper understanding on how macros are executed, have a look at the following Glyph classes:
220
- * =>[http://yardoc.org/docs/glyph/Glyph/Macro|@Glyph::Macro@]
221
- * =>[http://yardoc.org/docs/glyph/Glyph/Interpreter|@Glyph::Interpreter@]
222
- * =>[http://yardoc.org/docs/glyph/Glyph/Document|@Glyph::Document@]
223
- * =>[http://yardoc.org/docs/glyph/Glyph/Node|@Node@]
224
- ]
@@ -1,158 +0,0 @@
1
- section[header[Creating your first Glyph Project]
2
-
3
- To install Glyph, simply run @gem install glyph@, like with any other Ruby gem. Then, create a new directory and initialize a new Glyph project, like so:
4
-
5
- @mkdir@ _==test_document==_
6
-
7
- @cd@ _==test_document==_
8
-
9
- @glyph init@
10
-
11
- That's it. You just created a new Glyph project in the @test_document@ directory.
12
-
13
- box[Glyph's dependencies|
14
- Glyph requires the following gems:
15
- * extlib
16
- * gli
17
- * treetop
18
- * rake
19
-
20
- Additionally, some Glyph macros may require additional gems, such as:
21
- * RedCloth (\.%>[textile])
22
- * BlueCloth _or_ RDiscount _or_ Maruku _or_ Kramdown (\.%>[markdown])
23
- * Haml (if you want to load .sass files with the %>[style])
24
- ]
25
-
26
- Every Glyph project is comprised of the following directories:
27
- * @images/@ -- used to store the image files used in your document.
28
- * @lib/@ -- used to store your custom Glyph macros and Rake tasks.
29
- * @output/@ -- used to store your generated output files.
30
- * @styles/@ -- used to store your stylesheets.
31
- * @text/*@ -- used to store your source text files.
32
-
33
- Additionally, the following files are also created at top level:
34
- * @config.yml@ -- containing your =>[#cfg|Project Configuration].
35
- * @document.glyph@ -- containing your =>[#struct|Document Structure]
36
- * @snippets.yml@ -- containing your text =>[#incl|snippets].
37
-
38
- ]
39
-
40
- section[header[Document Structure|struct]
41
-
42
- Every Glyph project contains a @document.glyph@ file that is typically used to define the document structure. The default @document.glyph@ generated automatically when creating a new project is the following:
43
-
44
- <notextile>
45
- code[=
46
- document[
47
- head[style[default.css]]
48
- body[
49
- titlepage[
50
- title[]
51
- author[]
52
- pubdate[]
53
- ]
54
- frontmatter[
55
- toc[]
56
- preface[header[Preface]
57
- @[preface.textile]
58
- ]
59
- ]
60
- bodymatter[
61
- chapter[header[Chapter #1]
62
- @[chapter_1.textile]
63
- ]
64
- chapter[header[Chapter #2]
65
- @[chapter_2.textile]
66
- ]
67
- ]
68
- backmatter[
69
- appendix[header[Appendix A]
70
- @[appendix_a.textile]
71
- ]
72
- ]
73
- ]
74
- ]=]
75
- </notextile>
76
-
77
-
78
- Even without knowing anything about &[glang], you can easily figure out that this file defines a document with a Table of Contents, a Preface and some Chapters. @frontmatter\[\]@, @preface\[\]@, @chapter\[\]@, etc. are all Glyph _macros_ used to define -- in this case -- some structural elements. In practice, this means that if you plan to generate an HTML document, they'll be converted into @<div>@ tags.
79
-
80
- Be aware that other macros, on the other hand, are used to do something completely different, e.g.:
81
- * @toc\[\]@ generates the document's Table of Contents
82
- * codeph[=@\[\]=] or its alias @include\[\]@ is used to copy the contents of another file stored anywhere in the @text/@ directory.
83
-
84
- Let's now analyze this @document.glyph@ more in detail.
85
- * The @document\[\]@ macro wraps every other macro. This is necessary to create the initial @<html>@ tag.
86
- * Similarly, @head\[\]@ and @body\[\]@ are used to generate the respective HTML tags. Actually, @head\[\]@ already sets some metadata for you, by default (author and copyright).
87
- * Within @head\[\]@, the @style\[\]@ macro is used to load the @default.css@ stylesheet, which is one of the =>[#default_styles|default Glyph styleseets].
88
- * Immediately after the @body\[\]@ macro, the @titlepage\[\]@ macro is used to define (guess...) the first page of your document. @title\[\]@, @author\[\]@ and @pubdate\[\]@ insert the title of the document, its author and the publication date (retrieved from the project's =>[#cfg|configuration settings]).
89
- * Then, the @frontmatter\[\]@, @bodymatter\[\]@ and @backmatter\[\]@ macros are used to further divide the portions of your document according to the rules of =>[http://en.wikipedia.org/wiki/Book_design|book design]. They are not mandatory, but they can be used, for example, to number your appendixes with letters instead of numbers and similar.
90
- * @preface\[\]@, @chapter\[\]@, @appendix\[\]@ are just a way to wrap content in @<div>@ tags, from an HTML 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 @header\[\]@ macro.
91
-
92
- ]
93
-
94
- section[header[Project Configuration|cfg]
95
-
96
- Glyph stores configuration settings in the following YAML files:
97
- # Your _Project Configuration_ is stored in the @config.yml@ file, included in each Glyph Project.
98
- # Your _Global Configuration_ is stored in a @.glyphrc@ file in your $HOME (or ==%HOMEPATH%== on Windows) directory (not created by default).
99
- # The _System Configuration_ is stored in the source directory of Glyph itself.
100
-
101
- When compiling, Glyph loads all these configuration files and merges them according to the following rules:
102
- * A setting configured in the _Project Configuration_ overrides the same setting in both Global and System configuration.
103
- * A setting configured in the _Global Configuration_ overrides the same setting in the _System Configuration_
104
-
105
- Typically, you should use the _Project Configuration_ for all project-specific settings and the _Global Configuration_ for settings affecting all your projects (for example, you may want to set the $>[document.author] in the Global Configuration instead of setting it in the Project Configuration of all your Glyph projects). The _System Configuration_ is best left untouched.
106
-
107
- Instead of editing your configuration settings directly, you can use the #>[config], as follows:
108
-
109
- @glyph config@ _setting_ _\[value\]_
110
-
111
- If no _value_ is specified, glyph just prints the value of the configuration setting, so typing @glyph config document.author@ 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.
112
-
113
- To change the value of a configuration setting, specify a value right after the setting, like this:
114
-
115
- @glyph config document.author "John Smith"@
116
-
117
- tip[It is also possible to change configuration settings inside your document, using the %>[config:].]
118
-
119
- In this way, the document author will be set to _John Smith_ for the current project. To save this setting globally, add a @-g@ option, like this:
120
-
121
- @glyph config -g document.author "John Smith"@
122
-
123
- box[Regarding configuration values and data types...|
124
- Glyph attempts to "guess" the data type of a configuration values by evaluation (@Kernel#instance_eval@) if the value:
125
- * is wrapped in quotes (@"@ or @'@) &rarr; @String@
126
- * starts with a colon (@:@) &rarr; @Symbol@
127
- * is wrapped in square brackets (@\[@ and @\]@) &rarr; @Array@
128
- * is wrapped in curly brackets (@{@ and @}@) &rarr; @Hash@
129
- * is _true_ or _false_ &rarr; @Boolean@
130
- * is _nil_ &rarr; @NilClass@
131
-
132
- Note that this guessing is far from being foolproof: If you type something like _{:test, 2}_, for example, you'll get an error.
133
- ]
134
-
135
- 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).
136
-
137
- For a complete reference, see =>[#cfg_ref]. Normally, you may just want to change the following ones:
138
-
139
- table[
140
- tr[
141
- th[Setting]
142
- th[Description]
143
- ]
144
- tr[
145
- th[@document.author@]
146
- td[The author of the document]
147
- ]
148
- tr[
149
- th[@document.title@]
150
- td[The title of the document]
151
- ]
152
- tr[
153
- th[@document.filename@]
154
- td[The document file name]
155
- ]
156
- ]
157
-
158
- ]
@@ -1,179 +0,0 @@
1
- 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 =>[#extending|extended] Glyph by creating your own macros or you're embedding Ruby code using the %>[ruby] macro.
2
-
3
- tip[As a general rule, more diagnostic information is provided if Glyph is run in =>[#debug_switch|debug mode].]
4
-
5
- section[header[Generic Errors]
6
-
7
- error_table[
8
- ref_error[Incorrect macro syntax|
9
- 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.
10
- ]
11
- ref_error[Invalid alias: macro '_macro-name_' already exists|
12
- The alias name supplied to the @macro_alias@ method has already been used for another macro or alias.
13
- ]
14
- ref_error[Undefined macro '_macro-name_'|
15
- The document contains a macro that does not exist, i.e. it is not a standard or used-defined =>[#macro_ref|Glyph macro or alias].
16
- ]
17
- ref_error[An error occurred when generating _file-name_.pdf|
18
- Returned if Prince could not generate the PDF file or if Prince is not installed. Normally, Prince provides additional details on the specific error(s).
19
- ]
20
- ref_error[Glyph cannot generate PDF. Please specify a valid tools.pdf_generator setting|
21
- Returned if the $>[tools.pdf_generator] has not be set to a valid PDF renderer. Currently, the only supported value for this setting is @prince@.
22
- ]
23
- ref_error[The current directory is not a valid Glyph project|
24
- Returned if a glyph command was executed outside a valid glyph project directory.
25
- ]
26
- ref_error[Invalid snippet file|
27
- The @snippet.yml@ file contains invalid data. Most likely, it does not evaluate to a Ruby @Hash@.
28
- ]
29
- ref_error[Directory '_directory-name_' is not empty|
30
- Returned when executing the #>[init] in a directory that is not empty.
31
- ]
32
- ref_error[File '_file-name_' already exists|
33
- Returned if the name of an existing file was specified as a parameter for the #>[add].
34
- ]
35
- ]
36
- ] --[End Generic Errors]
37
-
38
-
39
-
40
- section[header[Command Errors]
41
-
42
- error_table[
43
-
44
- ref_error[Source file '_source-file_' does not exist|
45
- Returned if Glyph is running in =>[#lite_mode|lite mode] and the specified source file was not found.
46
- ]
47
-
48
- ref_error[Source and destination file are the same|
49
- Returned if Glyph is running in =>[#lite_mode|lite mode] and you specified the same source and destination files.
50
- ]
51
-
52
- ref_error[DirectoryWatcher is not available. Install it with: gem install directory_watcher|
53
- Returned if =>[#auto_regeneration|auto regeneration] is enabled but the @directory_watcher@ gem in not installed.
54
- ]
55
-
56
- ref_error[Document cannot be finalized due to previous errors|
57
- Returned if one or more errors occurred in the document prevented finalization.
58
- ]
59
-
60
- ref_error[Please specify a file name|
61
- No file name was specified for the #>[add].
62
- ]
63
-
64
- ref_error[Output target not specified|
65
- Returned if no target was specified for the #>[compile] _and_ if the $>[document.output] is not set.
66
- ]
67
-
68
- ref_error[Unknown output target '_target-name_'|
69
- An unsupported output target was specified for the #>[compile]. Only the following output targets are supported:
70
- - @html@
71
- - @pdf@
72
- ]
73
-
74
- ref_error[Too few/too many arguments|
75
- Returned if the #>[config] was used with no arguments or more than two arguments respectively.
76
- ]
77
-
78
- ref_error[Unknown setting '_setting-name_'|
79
- The name of an unknown setting was specified for the #>[config].
80
- ]
81
- ]
82
- ] --[End Command Errors]
83
-
84
-
85
-
86
- section[header[Macro Errors]
87
-
88
- The following errors are displayed in the form:
89
-
90
- _message_
91
- -> source: _macro-source_
92
- -> path: _macro-path_
93
- -> value: _macro-value_
94
-
95
- Where:
96
- * _message_ is the error message.
97
- * _macro-source_ is the file or snippet where the error occurred.
98
- * _macro-path_ is the full path to the macro that returned the error, within the document syntax tree, e.g. @document/body/bodymatter/chapter/section/header/&@ if the error occurrent in a snippet within the header of a section in the @bodymatter@ part of the document.
99
- * _macro-value_ is the value of the macro (shown only if Glyph is running in =>[#debug_switch|debug mode]).
100
-
101
- error_table[
102
-
103
- ref_error[Macro '_name_' takes up to _x_ parameter(s) (_y_ given)|
104
- Returned if the macro was called with extra parameters.
105
- ]
106
-
107
- ref_error[Macro '_name_' takes at least _x_ parameter(s) (_y_ given)|
108
- Returned if the macro was called with fewer parameters than expected.
109
- ]
110
-
111
- ref_error[Macro '_name_' takes exactly _x_ parameter(s) (_y_ given)|
112
- Returned if the macro was called with a different number of parameters than.
113
- ]
114
-
115
- ref_error[Macro not available when compiling a single file.|
116
- Returned by the %>[include] if used in =>[#lite_mode|lite mode].
117
- ]
118
-
119
- ref_error[Filter macro '_extension_' not available|
120
- Returned by a filter macro if $>[filters.by_file_extension] is set to @true@, but the extension was not recognized.
121
- ]
122
-
123
- ref_error[Invalid regular expression: _regexp_|
124
- Returned by the %>[match] macro if an invalid regular expression was supplied.
125
- ]
126
-
127
- ref_error[Macro '_name_' takes no parameters (_x_ given)|
128
- Returned if the macro was called with parameters but none are requested.
129
- ]
130
-
131
- ref_error[No highlighter installed. Please run: gem install coderay|
132
- Returned by the %>[highlight] macro if no highlighters are installed.
133
- ]
134
-
135
- ref_error[CodeRay highlighter not installed. Please run: gem install coderay|
136
- Returned by the %>[highlight] macro if $>[highlighters.current] is set to @coderay@ but &[coderay] is not installed.
137
- ]
138
-
139
- ref_error[UltraViolet highlighter not installed. Please run: gem install ultraviolet|
140
- Returned by the %>[highlight] macro if $>[highlighters.current] is set to @ultraviolet@ but &[uv] is not installed.
141
- ]
142
-
143
- ref_error[Mutual inclusion|
144
- 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.
145
- ]
146
- ref_error[Snippet '_snippet-id_' does not exist|
147
- Returned by the %>[snippet] if an invalid snippet was supplied.
148
- ]
149
- ref_error[File '_file-name_' not found|
150
- Returned by the %>[include] if an invalid file was supplied.
151
- ]
152
- ref_error[Filter macro '_macro-name_' not found|
153
- Returned by the %>[include] macro if the $>[filters.by_file_extension] is set to @true@ but the file extension of the included file is not recognized as a filter macro.
154
- ]
155
- ref_error[RedCloth gem not installed. Please run: gem insall RedCloth|
156
- Returned by the %>[textile] if the RedCloth gem is not installed.
157
- ]
158
- ref_error[No MarkDown converter installed. Please run: gem insall bluecloth|
159
- Returned by the %>[markdown] if no valid Markdown converter gem is installed.
160
-
161
- Glyph checks for: BlueCloth, Maruku, Kramdown and RDiscount.
162
- ]
163
- ref_error[Image/Figure not found|
164
- Retured by the %>[img] or the %>[fig] respectively, if the specified image file could not be found within the @images/@ folder.
165
- ]
166
- ref_error[Bookmark '_bookmark-name_' already exists|
167
- Returned by the %>[anchor] or by the %>[header] if the anchor ID supplied as parameter has already been used in the document.
168
- ]
169
- ref_error[Bookmark '_bookmark-name_' already exists|
170
- Returned by the %>[link] if the anchor ID supplied as parameter has not been used in the document.
171
- ]
172
- ref_error[Stylesheet '_file-name_' not found|
173
- Returned by the %>[style] if the @.css@ or @.sass@ file supplied as parameter was not found in the @styles/@ directory.
174
- ]
175
- ref_error[Haml is not installed. Please run: gem install haml|
176
- Returned by the %>[style] if a @.sass@ file was passed as parameter but the Haml gem is not installed.
177
- ]
178
- ]
179
- ] --[End Macro Errors]