glyph 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/.gitignore +7 -0
  2. data/AUTHORS.textile +8 -7
  3. data/CHANGELOG.textile +89 -8
  4. data/LICENSE.textile +1 -2
  5. data/README.textile +89 -61
  6. data/Rakefile +12 -10
  7. data/VERSION +1 -1
  8. data/benchmark.rb +1 -1
  9. data/book/config.yml +18 -4
  10. data/book/document.glyph +269 -45
  11. data/book/images/glyph/commands_tasks.png +0 -0
  12. data/book/images/{document_generation.png → glyph/document_generation.png} +0 -0
  13. data/book/images/glyph/glyph.eps +123 -0
  14. data/book/images/glyph/glyph.png +0 -0
  15. data/book/images/glyph/glyph.svg +29 -0
  16. data/book/lib/commands/commands.rb +11 -0
  17. data/book/lib/layouts/bookindex.glyph +127 -0
  18. data/book/lib/layouts/bookpage.glyph +129 -0
  19. data/book/lib/layouts/project.glyph +26 -0
  20. data/book/lib/macros/reference.rb +27 -7
  21. data/book/lib/tasks/tasks.rake +52 -0
  22. data/book/snippets.yml +1 -1
  23. data/book/text/{acknowledgement.glyph → acknowledgements.glyph} +4 -2
  24. data/book/text/changelog.glyph +29 -3
  25. data/book/text/compiling/compiling.glyph +44 -20
  26. data/book/text/compiling/lite_mode.glyph +0 -4
  27. data/book/text/compiling/programmatic_usage.glyph +1 -5
  28. data/book/text/config/document.glyph +35 -0
  29. data/book/text/config/filters.glyph +28 -0
  30. data/book/text/config/options.glyph +25 -0
  31. data/book/text/config/output.glyph +83 -0
  32. data/book/text/extending/bookmarks_headers.glyph +0 -5
  33. data/book/text/extending/command.glyph +56 -0
  34. data/book/text/extending/commands_tasks.glyph +39 -0
  35. data/book/text/extending/further_reading.glyph +0 -3
  36. data/book/text/extending/internals.glyph +3 -5
  37. data/book/text/extending/interpreting.glyph +0 -4
  38. data/book/text/extending/layouts.glyph +68 -0
  39. data/book/text/extending/macro_def.glyph +0 -5
  40. data/book/text/extending/output_format.glyph +78 -0
  41. data/book/text/extending/params_attrs.glyph +0 -3
  42. data/book/text/extending/placeholders.glyph +0 -4
  43. data/book/text/extending/task.glyph +46 -0
  44. data/book/text/extending/validators.glyph +5 -6
  45. data/book/text/getting_started/configuration.glyph +1 -5
  46. data/book/text/getting_started/create_project.glyph +1 -5
  47. data/book/text/getting_started/structure.glyph +0 -4
  48. data/book/text/introduction.glyph +100 -75
  49. data/book/text/license.glyph +1 -2
  50. data/book/text/macros/macros_block.glyph +8 -4
  51. data/book/text/macros/macros_core.glyph +0 -3
  52. data/book/text/macros/macros_filters.glyph +2 -7
  53. data/book/text/macros/macros_inline.glyph +0 -4
  54. data/book/text/macros/macros_structure.glyph +0 -4
  55. data/book/text/ref_commands.glyph +29 -7
  56. data/book/text/stats/bookmarks.glyph +49 -0
  57. data/book/text/stats/links.glyph +90 -0
  58. data/book/text/stats/macros.glyph +73 -0
  59. data/book/text/stats/snippets.glyph +50 -0
  60. data/book/text/stats/stats.glyph +79 -0
  61. data/book/text/text_editing/attribute_intro.glyph +22 -0
  62. data/book/text/text_editing/code.glyph +0 -5
  63. data/book/text/text_editing/conditionals.glyph +0 -4
  64. data/book/text/text_editing/esc_quot.glyph +64 -0
  65. data/book/text/text_editing/evaluation.glyph +0 -3
  66. data/book/text/text_editing/glyph_files.glyph +0 -3
  67. data/book/text/text_editing/images.glyph +0 -5
  68. data/book/text/text_editing/inclusions.glyph +0 -4
  69. data/book/text/text_editing/links.glyph +2 -7
  70. data/book/text/text_editing/macro_intro.glyph +1 -98
  71. data/book/text/text_editing/raw_html.glyph +0 -87
  72. data/book/text/text_editing/section_aliases.glyph +28 -0
  73. data/book/text/text_editing/sections.glyph +1 -32
  74. data/book/text/text_editing/stylesheets.glyph +3 -5
  75. data/book/text/text_editing/topics.glyph +33 -0
  76. data/book/text/text_editing/xml_fallback.glyph +73 -0
  77. data/book/text/troubleshooting/errors_command.glyph +0 -3
  78. data/book/text/troubleshooting/errors_generic.glyph +21 -6
  79. data/book/text/troubleshooting/errors_macro.glyph +11 -8
  80. data/book/text/troubleshooting/errors_parser.glyph +0 -3
  81. data/config.yml +60 -25
  82. data/glyph.gemspec +90 -36
  83. data/layouts/web/index.glyph +16 -0
  84. data/layouts/web/topic.glyph +15 -0
  85. data/layouts/web5/index.glyph +16 -0
  86. data/layouts/web5/topic.glyph +17 -0
  87. data/lib/glyph.rb +36 -49
  88. data/lib/glyph/analyzer.rb +253 -0
  89. data/lib/glyph/bookmark.rb +92 -0
  90. data/lib/glyph/commands.rb +9 -221
  91. data/lib/glyph/commands/add.rb +8 -0
  92. data/lib/glyph/commands/compile.rb +93 -0
  93. data/lib/glyph/commands/config.rb +38 -0
  94. data/lib/glyph/commands/init.rb +6 -0
  95. data/lib/glyph/commands/outline.rb +45 -0
  96. data/lib/glyph/commands/stats.rb +48 -0
  97. data/lib/glyph/commands/todo.rb +29 -0
  98. data/lib/glyph/config.rb +2 -0
  99. data/lib/glyph/document.rb +61 -30
  100. data/lib/glyph/interpreter.rb +2 -2
  101. data/lib/glyph/macro.rb +14 -5
  102. data/lib/glyph/macro_helpers.rb +280 -0
  103. data/lib/glyph/macro_validators.rb +37 -2
  104. data/lib/glyph/reporter.rb +182 -0
  105. data/lib/glyph/syntax_node.rb +37 -10
  106. data/lib/glyph/system_extensions.rb +8 -45
  107. data/lib/glyph/utils.rb +148 -0
  108. data/macros/core.rb +10 -15
  109. data/macros/filters.rb +4 -5
  110. data/macros/html/block.rb +46 -30
  111. data/macros/html/inline.rb +9 -35
  112. data/macros/html/structure.rb +59 -72
  113. data/macros/html5/block.rb +69 -0
  114. data/macros/html5/inline.rb +24 -0
  115. data/macros/html5/structure.rb +139 -0
  116. data/macros/xml.rb +1 -1
  117. data/spec/files/custom_command.rb +6 -0
  118. data/spec/files/custom_tasks.rake +6 -0
  119. data/spec/files/document_for_stats.glyph +12 -0
  120. data/spec/files/references.glyph +4 -0
  121. data/spec/files/web1.glyph +11 -0
  122. data/spec/files/web2.glyph +10 -0
  123. data/spec/files/web_doc.glyph +23 -0
  124. data/spec/lib/analyzer_spec.rb +137 -0
  125. data/spec/lib/bookmark_spec.rb +64 -0
  126. data/spec/lib/commands_spec.rb +30 -5
  127. data/spec/lib/document_spec.rb +49 -9
  128. data/spec/lib/glyph_spec.rb +21 -1
  129. data/spec/lib/macro_spec.rb +6 -6
  130. data/spec/lib/macro_validators_spec.rb +24 -0
  131. data/spec/lib/reporter_spec.rb +132 -0
  132. data/spec/macros/core_spec.rb +2 -3
  133. data/spec/macros/filters_spec.rb +2 -2
  134. data/spec/macros/html5_spec.rb +101 -0
  135. data/spec/macros/macros_spec.rb +16 -6
  136. data/spec/macros/web5_spec.rb +32 -0
  137. data/spec/macros/web_spec.rb +59 -0
  138. data/spec/macros/xml_spec.rb +1 -1
  139. data/spec/spec_helper.rb +24 -4
  140. data/spec/tasks/generate_spec.rb +54 -0
  141. data/spec/tasks/load_spec.rb +29 -3
  142. data/spec/tasks/project_spec.rb +21 -3
  143. data/styles/default.css +40 -4
  144. data/styles/pagination.css +59 -41
  145. data/tasks/generate.rake +110 -31
  146. data/tasks/load.rake +39 -7
  147. data/tasks/project.rake +9 -7
  148. metadata +115 -34
  149. data/book/images/glyph.png +0 -0
  150. data/book/images/glyph.svg +0 -351
  151. data/book/output/html/glyph.html +0 -4482
  152. data/book/output/html/images/document_generation.png +0 -0
  153. data/book/output/html/images/glyph.png +0 -0
  154. data/book/output/html/images/glyph.svg +0 -351
  155. data/book/output/pdf/glyph.pdf +4 -10254
  156. data/book/script/authors +0 -1
  157. data/book/script/changelog +0 -1
  158. data/book/script/license +0 -1
  159. data/book/script/readme +0 -1
  160. data/book/text/ref_config.glyph +0 -100
  161. data/book/text/ref_macros.glyph +0 -6
  162. data/book/text/troubleshooting/errors_intro.glyph +0 -3
data/book/snippets.yml CHANGED
@@ -5,7 +5,7 @@
5
5
  :gcode: "The following Glyph code:"
6
6
  :htmlcode: "Is translated into the following HTML code:"
7
7
  :markups: Textile or Markdown
8
- :filter_by_ext: "the $>[filters.by_file_extension] is @true@"
8
+ :filter_by_ext: "the $>[options.filters_by_file_extension] is @true@"
9
9
  :called_on_files: "If &[filter_by_ext], this macro is called automatically on =>[#m_include|included] files"
10
10
  :only_after_declaration: "can only be used _after_ its declaration"
11
11
  :coderay: "=>[http://coderay.rubychan.de/|Coderay]"
@@ -1,8 +1,10 @@
1
+ txt[
1
2
  Glyph was designed and developed by =>[http://www.h3rald.com|Fabio Cevasco] (h3rald).
2
3
 
3
4
  Special thanks to the following individuals who contributed to Glyph by reporting and fixing issues and/or proposing and implementing new features:
4
5
  * =>[http://www.jabbslad.com|Jamie Atkinson] (Jabbslad)
5
6
  * =>[http://koraktor.github.com|Sebastian Staudt] (koraktor)
6
-
7
-
7
+ * =>[http://balcone.eveel.ru|Dmitry A. Ustalov] (eveel)
8
+ * =>[http://www.stuartellis.eu|Stuart Ellis] (stuartellis)
9
+ ]
8
10
 
@@ -1,7 +1,7 @@
1
1
  %[=
2
2
  macro :features do
3
3
  verb = (@name == :features) ? "Implemented" : "Fixed"
4
- total = @node.children[0].children.length
4
+ total = @node.child_macros.length
5
5
  interpret %{
6
6
  section[
7
7
  @title[#{total} #{@name.to_s.capitalize} #{verb}]
@@ -30,11 +30,37 @@ rw:[issue|
30
30
  td[txt[{{1}}]]
31
31
  ]
32
32
  ]
33
- ?[%[lite?]|
33
+ ?[eq[%[ARGV\[0\]]|generate]|
34
34
  %:[%>|"#{value} macro"]
35
35
  %:[#>|"#{value} command"]
36
36
  %:[$>|"#{value} setting"]
37
37
  ]
38
+ release[0.4.0|September 3th 2010|
39
+ features[
40
+ issue[40|A new #>[stats] can be used to display statistics about project files, snippets, macros, bookmarks and links.]
41
+ issue[73|It is now possible to validate online HTTP links.]
42
+ issue[112|It is now possible to use _wkhtmltopdf_ instead of Prince to generate PDF files from HTML files.]
43
+ issue[114|It is now possible to generate documents comprised of multiple files (topics).]
44
+ issue[115|It is now possible to define layouts (used when generating multi-file outputs) using Glyph macros.]
45
+ issue[120|It is now possible to compile your project to a single HTML5 file (@html5@ output) or multiple files (@web5@ output)]
46
+ issue[135|Stylesheets can now be linked and imported as well as embedded.]
47
+ issue[138|@web@ and @web5@ output formats inherit @html@ macros.]
48
+ issue[142|A new %>[navigation] can be used in @web@ and @web5@ outputs to navigate through topics.]
49
+ issue[143|A topic-based TOC is generated when compiling to @web@ or @web5@]
50
+ issue[144|Two new validators are now available to check whether a macro has (or doesn't have) a certain ancestor: @within@ and @not_within@.]
51
+ issue[147|The default stylesheets provided by Glyph are now compatible with HTML5 outputs (html5 and web5).]
52
+ issue[148|It is now possible to create custom tasks and commands to extend Glyph functionality.]
53
+ ]
54
+ bugs[
55
+ issue[133|Added HTML charset to Glyph documents (utf-8).]
56
+ issue[136|Moved utility functions to separate @Glyph::Utils@ module.]
57
+ issue[139|Heavily restructured Glyph configuration.]
58
+ issue[140|Added @Glyph::Macro::Helpers@ module to avoid code duplication in macros for different output formats.]
59
+ issue[141|Prevented non-rb files to be loaded as macros.]
60
+ issue[145|Dotfiles are now ignored by #>[init].]
61
+ issue[167|Fixed PDF book download links.]
62
+ ]
63
+ ]
38
64
  release[0.3.0|June 13th 2010|
39
65
  features[
40
66
  issue[39|A new #>[outline] is available to display the document outline.]
@@ -47,7 +73,7 @@ release[0.3.0|June 13th 2010|
47
73
  issue[124|Implemented new %>[article] and %>[book].]
48
74
  issue[126|A new %>[rewrite:] has been implemented to create simple macros using just Glyph code.]
49
75
  issue[127|A new %>[alias] has been implemented to create macro aliases.]
50
- issue[128|A blacklist for XML tags has been exposed via the $>[language.options.xml_blacklist].]
76
+ issue[128|A blacklist for XML tags has been exposed via the @language.options.xml_blacklist@ setting.]
51
77
  issue[129|The %>[include] can now be used in lite mode, it can evaluate ruby files and requires relative paths.]
52
78
  issue[130|A new "safe mode" has been implemented to explicitly forbid certain potentially unsafe macros.]
53
79
  ]
@@ -1,23 +1,47 @@
1
+ txt[
2
+ By default, a Glyph project can be "compiled" into an HTML document. Additionally, Glyph can also be used to produce documents in the following formats:
3
+ * HTML5
4
+ * PDF (generated from HTML using a third-party generator like &[prince] or &[wkhtml])
5
+ * Web (i.e. multiple HTML files)
6
+ * Web5 (i.e. multiple HTML5 files)
7
+ ]
1
8
  section[
2
- @title[Compiling a project]
3
- @id[compile]
4
- p[By default, a Glyph project can be "compiled" into an HTML document. Additionally, Glyph can also be used to produce PDF documents through &[prince], and in future releases more output targets will be supported.]
5
- section[
6
- @title[HTML output]
7
- p[To compile a Glyph project to an HTML document, use the #>[compile] within your Glyph project folder. Glyph parses the code[document.glyph] file (and all included files and snippets); if no errors are found, Glyph creates an HTML document in the code[/output/html] folder.]
8
- p[The name of the HTML file can be set in the configuration (\.$>[document.filename]).]
9
- ]
10
- section[
11
- @title[PDF Output]
12
- p[To generate a PDF document, you must specify code[pdf] as format, like this:]
13
- p[code[= glyph compile -f pdf =]]
14
- p[The command above will attempt to compile the project into an HTML document and then call Prince to generate a PDF document from it. In order for this to work, you must download and install &[prince]. It's not open source, but the free version is fully functional, and it just adds a small logo on the first page.]
15
- note[Glyph v\.%[Glyph::VERSION] has been successfully tested with Prince v7.0, and the PDF version of this very book was generated with it.]
16
- ]
17
- section[
18
- @title[Auto Regeneration]
19
- @id[auto_regeneration]
20
- txt[You can also call the #>[compile] with a @--auto@ switch. If you do so, your project will be recompiled automatically every time any source file is changed.]
21
- note[Auto regeneration requires the =>[http://rubygems.org/gems/directory_watcher|directory_watcher] gem to be installed.]
9
+ @title[HTML/HTML5 output]
10
+ p[To compile a Glyph project to an HTML document, use the #>[compile] within your Glyph project folder. Glyph parses the code[document.glyph] file (and all included files and snippets); if no errors are found, Glyph creates an HTML document in the code[/output/html] folder.]
11
+ p[The name of the HTML file can be set in the configuration (\.$>[document.filename]).]
12
+ p[To create an HTML5 file instead, you must specify it explicitly like this:]
13
+ p[code[= glyph compile -f html5 =]]
14
+ ]
15
+ section[
16
+ @title[PDF Output]
17
+ p[To generate a PDF document, you must specify code[pdf] as format, like this:]
18
+ p[code[= glyph compile -f pdf =]]
19
+ p[The command above will attempt to compile the project into an HTML document and then call a third-party PDF generator to convert it into a PDF file.]
20
+ txt[
21
+ Currently, Glyph supports:
22
+ * &[prince] (version 7.0 or higher) -- a commercial generator that can be used freely for personal use. Prince produces high-quality PDF files and implement most of the new features introduced in CSS3, used heavily in Glyph's =>[#default_stylesheets|code[pagination.css]] default stylesheet.
23
+ * &[wkhtml] (version 1.0 beta4 or higher) -- an open source generator that uses the WebKit rendering engine to transform HTML files into PDF. Although not as advanced as Prince, it produces very satisfactory results.
24
+
25
+ By default, Glyph attempts to use wkhtmltopdf. To change this, set the $>[output_pdf_generator] to code[prince].
22
26
  ]
27
+ note[Glyph expects PDF generators to be installed on the local machine and callable via command line using the code[wkhtmltopdf] or the code[prince] commands. Just install them as you would with any other program, depending on your operating system (yes, they both offer Windows installers).]
28
+ tip[Glyph's default CSS file use the free em[Gentium] font for all text. You can download it from =>[http://www.sil.org/~gaultney/gentium/|here].]
29
+ ]
30
+ section[
31
+ @title[Web/Web5 Output]
32
+ @id[web_output]
33
+ txt[
34
+ To generate a Web or Web5 output, specify @web@ or @web5@ as format. These two output formats behave different way from the others, and require that your project uses =>[#topics|topics] and =>[#layouts|layouts].
35
+
36
+ Basically, here's what happens when you compile your project in web or web5 format:
37
+ # The document code is parsed as normal
38
+ # Separate topic files are generated according to the code[@src] attributes of your sections
39
+ # The code[document.glyph] (or whatever file you're using as document source) is _not_ rendered. Instead, an @index.html@ file will be created in the output folder based on the contents of your =>[#index_layout|index layout].
40
+ ]
41
+ ]
42
+ section[
43
+ @title[Auto Regeneration]
44
+ @id[auto_regeneration]
45
+ txt[You can also call the #>[compile] with a @--auto@ switch. If you do so, your project will be recompiled automatically every time any source file is changed.]
46
+ note[Auto regeneration requires the =>[http://rubygems.org/gems/directory_watcher|directory_watcher] gem to be installed.]
23
47
  ]
@@ -1,6 +1,3 @@
1
- section[
2
- @title[Compiling single Glyph files]
3
- @id[lite_mode]
4
1
  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.]
5
2
  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 #>[compile], like this:]
6
3
  p[code[glyph compile source.glyph destination.htm]]
@@ -20,4 +17,3 @@ This sort of "lite" mode comes with a few minor limitations:
20
17
  * The files included through the %>[include] &[referenced_with_path].
21
18
  ]
22
19
  ]
23
- ]
@@ -1,5 +1,3 @@
1
- section[
2
- @title[Using Glyph programmatically]
3
1
  txt[
4
2
  Besides using Glyph from the command line, you can also use it straight from your code. Glyph's public =>[http://yardoc.org/docs/glyph/Glyph|API] is simple and can be used to:
5
3
  * Retrieve and update configuration settings (using @Glyph\[\]@ and @Glyph\[\]=@)
@@ -11,8 +9,7 @@ That's pretty much it. Of course, both the @filter@ and @compile@ method cause G
11
9
  tip[
12
10
  txt[
13
11
  For an example on how to use Glyph programmatically (specifically in conjunction with the =>[http://nanoc.stoneship.org/|nanoc] static site generator), see =>[http://github.com/h3rald/h3rald|h3rald.com source code], in particular:
14
- * =>[http://github.com/h3rald/h3rald/blob/master/lib/glyph-data.rb|lib/glyph-data.rb] -- updating configuration settings.
15
- * =>[http://github.com/h3rald/h3rald/blob/master/lib/glyph-filter.rb|lib/glyph-data.rb] -- using the @Glyph#filter@ method.
12
+ * =>[http://github.com/h3rald/h3rald/blob/master/lib/glyph_filter.rb|lib/glyph_filter.rb] -- using the @Glyph#filter@ method.
16
13
  * =>[http://github.com/h3rald/h3rald/blob/master/Rules|Rules] -- using the @Glyph#compile@ method to generate PDF files.
17
14
  ]
18
15
  ]
@@ -74,4 +71,3 @@ If enabled, the following macros cannot be used and will return an error:
74
71
  ]
75
72
  ]
76
73
  ]
77
- ]
@@ -0,0 +1,35 @@
1
+ The following configuration settings are related to the current Glyph document. Therefore, you should update them right after creating a project.
2
+
3
+ config_table[
4
+ ref_config[document.author|
5
+ The author of the document.
6
+ ]
7
+ ref_config[document.draft|
8
+ If set to @true@, the document is considered a draft, so =>[#m_draftcomment|draft comments] and =>[#m_todo|todo items] will be displayed.
9
+ ]
10
+ ref_config[document.filename|
11
+ The name of the output file.
12
+ ]
13
+ ref_config[document.output|
14
+ The format of the output file. It can be set to:
15
+ %[=Glyph['output'].keys.reject{\|v\| v == :h3rald }.map{\|v\| "* @#{v}@"}.sort.join("\n")=]
16
+ ]
17
+ ref_config[document.revision|
18
+ The document's revision.
19
+ ]
20
+ ref_config[document.source|
21
+ The main source file to compile. It can be also be overridden by calling the #>[compile] with the @-s@ option.
22
+ ]
23
+ ref_config[document.styles|
24
+ How to process stylesheets. It can be set to one of the following values:
25
+ * @embed@ -- Embed stylesheets within the document.
26
+ * @link@ -- Link stylesheets.
27
+ * @import@ -- Import stylesheets using the code[@import] CSS directive.
28
+ ]
29
+ ref_config[document.subtitle|
30
+ The subtitle of the document, displayed using the %>[subtitle].
31
+ ]
32
+ ref_config[document.title|
33
+ The title of the document, displayed using the %>[title].
34
+ ]
35
+ ]
@@ -0,0 +1,28 @@
1
+ These settings are used to configure some special options related to output filters and highlighters.
2
+
3
+ config_table[
4
+ ref_config[filters.coderay.*|
5
+ Some &[coderay]-specific =>[http://coderay.rubychan.de/doc/classes/CodeRay/Encoders/HTML.html|options].
6
+ ]
7
+ ref_config[filters.highlighter|
8
+ The current highlighter to use. It can be set to @coderay@ or @ultraviolet@
9
+ ]
10
+ ref_config[filters.markdown.converter|
11
+ The name of the markdown converter to use with the %>[markdown]. It can be set to one of the following values:
12
+ * BlueCloth
13
+ * RDiscount
14
+ * Maruku
15
+ * Kramdown
16
+
17
+ If not set, Glyph tests for the presence of each gem in the same order, until one is found.
18
+ ]
19
+ ref_config[filters.redcloth.restrictions|
20
+ An @Array@ containing restrictions applied to RedCloth, used by the %>[textile] (see =>[http://redcloth.rubyforge.org/classes/RedCloth/TextileDoc.html|RedCloth Documentation] for more information).
21
+ ]
22
+ ref_config[filters.ultraviolet.line_numbers|
23
+ Whether the &[uv] highlighter should display line numbers or not.
24
+ ]
25
+ ref_config[filters.ultraviolet.theme|
26
+ The theme used by the &[uv] highlighter.
27
+ ]
28
+ ]
@@ -0,0 +1,25 @@
1
+ The following configuration settings are used to enable or disable specific Glyph functionalities and behaviors.
2
+
3
+ config_table[
4
+ ref_config[options.filters_by_file_extension|
5
+ If set to @true@, a filter macro is applied to included files, based on their extensions (\.fmi[including files|#incl]).
6
+ ]
7
+ ref_config[options.macro_set|
8
+ Determines which macro set will be loaded. It can be set to:
9
+ * glyph -- Loads core, filter, xml macros plus all macros necessary for the $>[document.output].
10
+ * xml -- Loads core and xml macros.
11
+ * core -- Loads core macros only.
12
+ ]
13
+ ref_config[options.safe_mode|
14
+ Enables Safe Mode (\.fmi[Glyph modes|#modes]).
15
+ ]
16
+ ref_config[options.url_validation|
17
+ If set to _true_, every external link will be validated (see =>[#links]).
18
+ ]
19
+ ref_config[options.xml_blacklist|
20
+ The XML tags listed here cannot be generated using Glyph code.
21
+ ]
22
+ ref_config[options.xml_fallback|
23
+ If set to true, any unknown macro name will considered an XML element (see =>[#other_elements]).
24
+ ]
25
+ ]
@@ -0,0 +1,83 @@
1
+ &:[o_multifile|
2
+ If set to _true_, the document will be rendered in multiple files, according to the specified =>[#topics|topics].
3
+ ]
4
+ &:[o_extension|
5
+ The extension to use for the output file(s).
6
+ ]
7
+ &:[o_filter_target|
8
+ The output target for filters. It can be set to @html@ (for RedCloth and MarkDown) or @latex@ (RedCloth-only).
9
+ ]
10
+ &:[o_macro_dirs|
11
+ The directories from which macros will be loaded (both in Glyph's home and the current project directory).
12
+ ]
13
+ &:[o_layout_dirs|
14
+ The directories from which layout macros will be loaded (both in Glyph's home and the current project directory).
15
+ ]
16
+ &:[o_layouts.topic|
17
+ The name of the layout to use to render topic files.
18
+ ]
19
+ &:[o_layouts.index|
20
+ The name of the layout to use to render the document index file.
21
+ ]
22
+ &:[o_base|
23
+ The directory to use as root for all link paths.
24
+ ]
25
+ These settings are used to configure output-specific options.
26
+
27
+
28
+ section[
29
+ @title[output.pdf.*]
30
+ config_table[
31
+ out_cfg[pdf.extension]
32
+ out_cfg[pdf.filter_target]
33
+ ref_config[output.pdf.generator|
34
+ The external program used to generate PDF files. It can be set to @prince@ or @wkhtmltopdf@.
35
+ ]
36
+ out_cfg[pdf.macro_dirs]
37
+ out_cfg[pdf.multifile]
38
+ ]
39
+ ]
40
+ section[
41
+ @title[output.html.*]
42
+ config_table[
43
+ out_cfg[html.extension]
44
+ out_cfg[html.filter_target]
45
+ out_cfg[html.macro_dirs]
46
+ out_cfg[html.multifile]
47
+ ]
48
+ ]
49
+ section[
50
+ @title[output.html5.*]
51
+ config_table[
52
+ out_cfg[html5.extension]
53
+ out_cfg[html5.filter_target]
54
+ out_cfg[html5.macro_dirs]
55
+ out_cfg[html5.multifile]
56
+ ]
57
+ ]
58
+ section[
59
+ @title[output.web.*]
60
+ config_table[
61
+ out_cfg[web.base]
62
+ out_cfg[web.extension]
63
+ out_cfg[web.filter_target]
64
+ out_cfg[web.layout_dirs]
65
+ out_cfg[web.layouts.index]
66
+ out_cfg[web.layouts.topic]
67
+ out_cfg[web.macro_dirs]
68
+ out_cfg[web.multifile]
69
+ ]
70
+ ]
71
+ section[
72
+ @title[output.web5.*]
73
+ config_table[
74
+ out_cfg[web5.base]
75
+ out_cfg[web5.extension]
76
+ out_cfg[web5.filter_target]
77
+ out_cfg[web5.layout_dirs]
78
+ out_cfg[web5.layouts.index]
79
+ out_cfg[web5.layouts.topic]
80
+ out_cfg[web5.macro_dirs]
81
+ out_cfg[web5.multifile]
82
+ ]
83
+ ]
@@ -1,5 +1,3 @@
1
- section[
2
- @title[Bookmarks and Headers]
3
1
  txt[
4
2
  The =>[&[yardoc]/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]:
5
3
  ]
@@ -16,6 +14,3 @@ end
16
14
  txt[
17
15
  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.
18
16
  ]
19
- ]
20
-
21
-
@@ -0,0 +1,56 @@
1
+ txt[
2
+ Glyph relies on =>[http://davetron5000.github.com/gli/|GLI] for defining commands. This useful library provides a high-level framework for creating command-line interface similar to =>[http://git-scm.com/|Git], its DSL takes care of pretty much everything, from managing command line arguments and options to providing an interactive help system.
3
+ ]
4
+ section[
5
+ @title[Creating a 'glyph generate' command]
6
+ txt[
7
+ Consider the custom task defined in =>[#custom_generate_task]. Creating a custom command to call it is fairly straightforward.
8
+
9
+ First of all, create a @lib/commands@ folder in your project directory. Then, create a @.rb@ file within it, e.g. @commands.rake@.
10
+
11
+ Finally, here's the source of the command:
12
+ ]
13
+ highlight[=ruby|
14
+ GLI.desc 'Generates a specific file required for Glyph releases'
15
+ arg_name "file_name"
16
+ command :generate do \|c\|
17
+ c.action do \|global_options,options,args\|
18
+ if args.blank? then
19
+ raise RuntimeError, "You must specify a file to generate"
20
+ else
21
+ Glyph.run 'custom:generate', args[0]
22
+ end
23
+ end
24
+ end
25
+ =]
26
+ txt[
27
+ That's it. If you try to run @glyph help@ within your project directory, notice that there's a new entry for the generate command:
28
+ ]
29
+ highlight[html|
30
+ $ glyph help
31
+ =====================================
32
+ Glyph v\.%[Glyph::VERSION]
33
+ =====================================
34
+ usage: glyph command \[options\]
35
+
36
+ Options:
37
+ -d, --debug - Enable debugging
38
+
39
+ Commands:
40
+ add - Add a new text file to the project
41
+ compile - Compile the project
42
+ config - Get/set configuration settings
43
+ generate - Generates a specific file required for Glyph releases
44
+ help - Shows list of commands or help for one command
45
+ init - Create a new Glyph project
46
+ outline - Display the document outline
47
+ stats - Display statistics
48
+ todo - Display all project TODO items
49
+ ]
50
+ p[You can now run the Glyph command as expected:]
51
+ highlight[=html|
52
+ $ glyph -d generate changelog
53
+ -- Generating CHANGELOG...
54
+ -- Done.
55
+ =]
56
+ ]
@@ -0,0 +1,39 @@
1
+ txt[
2
+ In most cases, you can extend Glyph just by creating your own =>[#macro_def|custom macros]. In some cases though, you may want to further customize Glyph to fit the needs of your project, in terms of creating =>[#custom_command|custom commands] and =>[#custom_task|custom tasks].
3
+
4
+ Glyph's modular architecture (and the Ruby language itself) lets you to add _arbitrary_ functionality to its core, simply by creating a few Ruby files and putting them in the right places.
5
+ ]
6
+ section[
7
+ @title[How Commands and Tasks work]
8
+ @id[cmd_tasks_arch]
9
+ txt[
10
+ Before creating custom Glyph commands and tasks, you should have a basic understanding on how they work, and which commands -- or better, which tasks -- are already available.
11
+
12
+ The following diagram outlines the relationships between commands and tasks:
13
+ ]
14
+ figure[glyph/commands_tasks.png|Glyph default commands and tasks]
15
+ txt[
16
+ As you can see:
17
+ * All commands call at at least one task.
18
+ * There are several task inter-dependencies spanning across three main Rake namespaces:
19
+ ** @project:@ -- used for tasks affecting only the physical structure of the Glyph project.
20
+ ** @load:@ -- used to load all kinds of files.
21
+ ** @generate:@ -- used to generate files or copy files from source to output directories
22
+ ]
23
+ box[Example|
24
+ txt[
25
+ Suppose you want to generate a PDF file by issuing the @glyph compile -f pdf@ command. Under the hood, Glyph calls the following tasks:
26
+ # @load:config@ -- Load the configuration files
27
+ # @load:tasks@ -- Load custom tasks (if any)
28
+ # @load:commands@ -- Load custom commands (if any)
29
+ # @load:snippets@ -- Load snippets from the @snippet.yml@ file
30
+ # @load:macros@ -- Load macros
31
+ # @load:all@ -- Dummy task used to call the previous ones
32
+ # @generate:document@ -- Parse, analyze and finalize the Glyph document
33
+ # @generate:images@ -- Copy images to the output directory (if any)
34
+ # @generate:styles@ -- Copy stylesheets to the output directory (if necessary)
35
+ # @generate:html@ -- Generate a standalone HTML file
36
+ # @generate:pdf@ -- Generate a PDF file from a standalone HTML file
37
+ ]
38
+ ]
39
+ ]