glyph 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. data/Rakefile +19 -40
  2. data/benchmark.rb +1 -2
  3. data/book/config.yml +8 -8
  4. data/book/document.glyph +18 -19
  5. data/book/images/glyph/commands_tasks.png +0 -0
  6. data/book/lib/layouts/bookindex.glyph +113 -111
  7. data/book/lib/layouts/bookpage.glyph +112 -108
  8. data/book/lib/macros/reference.rb +2 -2
  9. data/book/lib/tasks/tasks.rake +1 -1
  10. data/book/text/acknowledgements.glyph +1 -0
  11. data/book/text/changelog.glyph +140 -112
  12. data/book/text/compiling/compiling.glyph +36 -24
  13. data/book/text/compiling/lite_mode.glyph +11 -11
  14. data/book/text/compiling/programmatic_usage.glyph +57 -57
  15. data/book/text/config/document.glyph +7 -1
  16. data/book/text/config/options.glyph +5 -3
  17. data/book/text/config/output.glyph +41 -8
  18. data/book/text/extending/bookmarks_headers.glyph +13 -11
  19. data/book/text/extending/command.glyph +1 -1
  20. data/book/text/extending/commands_tasks.glyph +2 -2
  21. data/book/text/extending/internals.glyph +29 -29
  22. data/book/text/extending/interpreting.glyph +48 -9
  23. data/book/text/extending/macro_def.glyph +80 -32
  24. data/book/text/extending/output_format.glyph +2 -2
  25. data/book/text/extending/placeholders.glyph +27 -15
  26. data/book/text/extending/validators.glyph +1 -1
  27. data/book/text/getting_started/configuration.glyph +1 -1
  28. data/book/text/getting_started/create_project.glyph +4 -5
  29. data/book/text/getting_started/structure.glyph +2 -2
  30. data/book/text/macros/macros_core.glyph +341 -199
  31. data/book/text/macros/macros_filters.glyph +1 -1
  32. data/book/text/macros/macros_inline.glyph +3 -3
  33. data/book/text/macros/macros_structure.glyph +1 -1
  34. data/book/text/ref_commands.glyph +98 -93
  35. data/book/text/snippets.glyph +18 -0
  36. data/book/text/stats/bookmarks.glyph +16 -16
  37. data/book/text/stats/links.glyph +23 -23
  38. data/book/text/stats/macros.glyph +14 -14
  39. data/book/text/stats/snippets.glyph +26 -26
  40. data/book/text/stats/stats.glyph +14 -15
  41. data/book/text/text_editing/attribute_intro.glyph +8 -8
  42. data/book/text/text_editing/code.glyph +16 -16
  43. data/book/text/text_editing/conditionals.glyph +12 -13
  44. data/book/text/text_editing/esc_quot.glyph +3 -3
  45. data/book/text/text_editing/evaluation.glyph +57 -3
  46. data/book/text/text_editing/inclusions.glyph +34 -25
  47. data/book/text/text_editing/macro_composition.glyph +28 -0
  48. data/book/text/text_editing/macro_intro.glyph +4 -4
  49. data/book/text/text_editing/section_aliases.glyph +23 -23
  50. data/book/text/text_editing/sections.glyph +22 -22
  51. data/book/text/text_editing/stylesheets.glyph +33 -33
  52. data/book/text/text_editing/topics.glyph +6 -6
  53. data/book/text/text_editing/xml_fallback.glyph +1 -1
  54. data/book/text/troubleshooting/errors_command.glyph +4 -4
  55. data/book/text/troubleshooting/errors_generic.glyph +16 -10
  56. data/book/text/troubleshooting/errors_macro.glyph +18 -21
  57. data/book/text/troubleshooting/errors_parser.glyph +7 -7
  58. data/config.yml +51 -29
  59. data/document.glyph +18 -18
  60. data/glyph.gemspec +39 -287
  61. data/layouts/web5/topic.glyph +1 -1
  62. data/lib/glyph.rb +42 -10
  63. data/lib/glyph/analyzer.rb +5 -2
  64. data/lib/glyph/bookmark.rb +3 -1
  65. data/lib/glyph/commands.rb +11 -9
  66. data/lib/glyph/commands/add.rb +3 -1
  67. data/lib/glyph/commands/compile.rb +10 -7
  68. data/lib/glyph/commands/config.rb +7 -5
  69. data/lib/glyph/commands/init.rb +2 -0
  70. data/lib/glyph/commands/outline.rb +2 -0
  71. data/lib/glyph/commands/stats.rb +3 -0
  72. data/lib/glyph/commands/todo.rb +2 -0
  73. data/lib/glyph/config.rb +2 -0
  74. data/lib/glyph/document.rb +34 -9
  75. data/lib/glyph/interpreter.rb +2 -0
  76. data/lib/glyph/macro.rb +97 -25
  77. data/lib/glyph/macro_validators.rb +9 -6
  78. data/lib/glyph/node.rb +3 -1
  79. data/lib/glyph/parser.rb +68 -33
  80. data/lib/glyph/reporter.rb +3 -1
  81. data/lib/glyph/syntax_node.rb +23 -28
  82. data/lib/glyph/system_extensions.rb +21 -0
  83. data/lib/glyph/utils.rb +24 -4
  84. data/macros/block.rb +111 -0
  85. data/macros/core.rb +163 -33
  86. data/macros/filters.rb +3 -2
  87. data/macros/inline.rb +97 -0
  88. data/macros/reps/html.rb +180 -0
  89. data/macros/reps/html5.rb +100 -0
  90. data/macros/reps/web.rb +4 -0
  91. data/macros/reps/web5.rb +4 -0
  92. data/macros/structure.rb +229 -0
  93. data/macros/xml.rb +29 -24
  94. data/spec/config.yml +7 -0
  95. data/spec/files/article.glyph +2 -2
  96. data/spec/files/web_doc.glyph +9 -5
  97. data/spec/lib/commands_spec.rb +13 -9
  98. data/spec/lib/config_spec.rb +2 -2
  99. data/spec/lib/document_spec.rb +10 -0
  100. data/spec/lib/glyph_spec.rb +30 -8
  101. data/spec/lib/macro_spec.rb +39 -4
  102. data/spec/lib/macro_validators_spec.rb +3 -4
  103. data/spec/lib/parser_spec.rb +7 -0
  104. data/spec/lib/reporter_spec.rb +1 -0
  105. data/spec/lib/syntax_node_spec.rb +40 -6
  106. data/spec/macros/core_spec.rb +154 -21
  107. data/spec/macros/filters_spec.rb +1 -1
  108. data/spec/macros/html5_spec.rb +4 -5
  109. data/spec/macros/macros_spec.rb +6 -7
  110. data/spec/macros/web5_spec.rb +3 -3
  111. data/spec/macros/web_spec.rb +10 -7
  112. data/spec/macros/xml_spec.rb +11 -2
  113. data/spec/spec_helper.rb +11 -5
  114. data/spec/tasks/generate_spec.rb +40 -5
  115. data/spec/tasks/load_spec.rb +1 -13
  116. data/styles/coderay.css +147 -38
  117. data/styles/default.css +19 -22
  118. data/styles/pagination.css +30 -30
  119. data/tasks/generate.rake +54 -18
  120. data/tasks/load.rake +9 -24
  121. data/tasks/project.rake +0 -2
  122. metadata +208 -207
  123. data/.gitignore +0 -7
  124. data/VERSION +0 -1
  125. data/book/snippets.yml +0 -18
  126. data/lib/glyph/macro_helpers.rb +0 -282
  127. data/macros/html/block.rb +0 -124
  128. data/macros/html/inline.rb +0 -42
  129. data/macros/html/structure.rb +0 -191
  130. data/macros/html5/block.rb +0 -69
  131. data/macros/html5/inline.rb +0 -24
  132. data/macros/html5/structure.rb +0 -140
@@ -123,7 +123,7 @@ macro :ref_macro do
123
123
  m_aliases = "aliases[#{raw_attr(:aliases)}]" if raw_attr(:aliases)
124
124
  m_remarks = %{section[
125
125
  @title[Remarks]
126
- @notoc[:true]
126
+ @notoc[true]
127
127
  txt[
128
128
  #{raw_attr(:remarks)}
129
129
  ]
@@ -187,7 +187,7 @@ macro :class do
187
187
  else
188
188
  path = value
189
189
  end
190
- interpret %{=>[&[yardoc]/#{path}|code[#{value}]]}
190
+ interpret %{=>[&[rubydoc]/#{path}|code[#{value}]]}
191
191
  end
192
192
 
193
193
 
@@ -41,7 +41,7 @@ namespace :generate do
41
41
  (dir/'glyph/book/images/glyph/glyph.eps').unlink
42
42
  (dir/'glyph/book/images/glyph/glyph.svg').unlink
43
43
  # Create project page
44
- project = Glyph.filter %{layout:project[
44
+ project = Glyph.filter %{layout/project[
45
45
  @contents[#{file_load(Glyph::PROJECT/'text/introduction.glyph')}]
46
46
  ]}
47
47
  file_write dir/"glyph.textile", project
@@ -7,5 +7,6 @@ Special thanks to the following individuals who contributed to Glyph by reportin
7
7
  * =>[http://balcone.eveel.ru|Dmitry A. Ustalov] (eveel)
8
8
  * =>[http://www.stuartellis.eu|Stuart Ellis] (stuartellis)
9
9
  * Eric Givens (darthzippy)
10
+ * =>[http://www.taylored-software.com/|Tammy Cravit] (tammycravit)
10
11
  ]
11
12
 
@@ -1,134 +1,162 @@
1
1
  %[=
2
2
  macro :features do
3
- verb = (@name == :features) ? "Implemented" : "Fixed"
4
- total = @node.child_macros.length
5
- name = @name.to_s.capitalize
6
- name.chop! if total == 1
7
- interpret %{
8
- section[
9
- @title[#{total} #{name} #{verb}]
10
- table[
11
- tr[
12
- th[ID]
13
- th[Description]
14
- ]
15
- #{@node.value}
16
- ]
17
- ]
18
- }
3
+ verb = (@name == :features) ? "Implemented" : "Fixed"
4
+ total = @node.child_macros.length
5
+ name = @name.to_s.capitalize
6
+ name.chop! if total == 1
7
+ interpret %{
8
+ section[
9
+ @title[#{total} #{name} #{verb}]
10
+ table[
11
+ tr[
12
+ th[ID]
13
+ th[Description]
14
+ ]
15
+ #{@node.value}
16
+ ]
17
+ ]
18
+ }
19
19
  end
20
20
 
21
21
  macro_alias :bugs => :features
22
22
  =]
23
- rw:[release|
24
- section[
25
- @title[v{{0}} – {{1}}]
26
- {{2}}
27
- ]
23
+ def:[release|
24
+ section[
25
+ @title[v{{0}} – {{1}}]
26
+ {{2}}
27
+
28
+ p/em[→ View closed issues on =>[https://github.com/h3rald/glyph/issues?direction=asc&labels={{0}}&sort=created&state=closed|GitHub].]
29
+ ]
28
30
  ]
29
- rw:[issue|
30
- tr[
31
- td[\.=>[http://github.com/h3rald/glyph/issues/closed#issue/{{0}}|#{{0}}]]
32
- td[txt[{{1}}]]
33
- ]
31
+ def:[issue|
32
+ tr[
33
+ td[\/=>[https://github.com/h3rald/glyph/issues/{{0}}|#{{0}}]]
34
+ td[txt[{{1}}]]
35
+ ]
34
36
  ]
35
37
  ?[eq[%[ARGV\[0\]]|generate]|
36
- %:[%>|"#{value} macro"]
37
- %:[#>|"#{value} command"]
38
- %:[$>|"#{value} setting"]
38
+ %:[%>|"#{value} macro"]
39
+ %:[#>|"#{value} command"]
40
+ %:[$>|"#{value} setting"]
41
+ ]
42
+ release[0.5.0|August 28th 2011|
43
+ features[
44
+ issue[152|It is now possible to generate a PDF document through HTML5, not only HTML, by setting the @output.pdf.through@ setting to @html5@.]
45
+ issue[165|The %>[fragment] and the %>[embed] can be used to delimit and embed text fragments, in a way much similar to snippets.]
46
+ issue[177|Introduced the concept of "macro representations", to make macro code output-independent.]
47
+ issue[179|Macro can be composed with other macros via backslashes, provided that containers only take exactly one parameter. The new %>[xml] dispatcher must be used composed with other macros to create raw XML tags, prepending = to macro names no longer works.]
48
+ issue[180|Glyph can now generate ebooks in MOBI and EPUB format – with Calibre's help.]
49
+ issue[181|By using the new %>[let] macro, it is possible to define lexically scoped "variables" via the %>[attribute:], and retrieve them within the scope of the let macro using the %>[attribute].]
50
+ issue[182|A %>[while] can be used to execute glyph code multiple times.]
51
+ issue[183|The %>[s] dispatcher can be used to call almost any instance method of the Ruby String class. The @match@ macro cannot be used anymore; use @s/match@ instead.]
52
+ issue[184|The old @rewrite:@ macro has been renamed to @define:@. The new %>[define:] fully supports recursion.]
53
+ issue[189|The %>[add], the %>[subtract] and the %>[multiply] macro can be used to perform operations on integers.]
54
+ issue[190|The lt, gt, lte, gte macros can be used to compare integer values.]
55
+ issue[194|The %>[load] macro can be used to embed the contents of a file without performing any evaluation.]
56
+ issue[195|@\\/@ must not be used as invisible space separator, instead of @\\.@.]
57
+ issue[197|Snippets are no longer managed via a separate snippet.yml file and _must_ be defined within Glyph source files, using the %>[snippet:].]
58
+ issue[200|Typing @glyph -v@ now prints the current version of Glyph on the screen.]
59
+ issue[201|Glyph no longer depends on Jeweler to create and manage its gem.]
60
+ ]
61
+ bugs[
62
+ issue[151|Fixed a bug related to Jeweler's gemspec validation. And for all it matters, Jeweler is no longer a development dependency for Glyph.]
63
+ issue[166|Temporary output files are now placed in a temporary folder.]
64
+ issue[196|Glyph now handles non-ASCII characters properly with Ruby 1.9 as well.]
65
+ issue[199|Fixed a bug that caused incorrect TOC nesting when using the @src@ attribute of the %>[section].]
66
+ ]
39
67
  ]
40
68
  release[0.4.2|October 22th 2010|
41
- features[
42
- issue[172|A new %>[output?] macro can be used to test whether Glyph is compiling to a particular output format.]
43
- issue[175|The conditional macro now support a third parameter (else branch).]
44
- issue[176|A bunch of new aliases and shortcuts are available for the section macro.]
45
- ]
46
- bugs[
47
- issue[178|No error is raised anymore if less than the required parameters/attributes are supplied to a rewritten macro.]
48
- ]
69
+ features[
70
+ issue[172|A new %>[output?] can be used to test whether Glyph is compiling to a particular output format.]
71
+ issue[175|The conditional macro now support a third parameter (else branch).]
72
+ issue[176|A bunch of new aliases and shortcuts are available for the section macro.]
73
+ ]
74
+ bugs[
75
+ issue[178|No error is raised anymore if less than the required parameters/attributes are supplied to a rewritten macro.]
76
+ ]
49
77
  ]
50
78
  release[0.4.1|September 23th 2010|
51
- bugs[
52
- issue[169|*.scss files are now supported by the %>[style].]
53
- issue[170|Improved default CodeRay stylesheet.]
54
- issue[171|SCSS now used internally by Glyph to generate default CSS files.]
55
- issue[173|Consecutive escape sequences are now interpreted correctly in topics.]
56
- issue[174|Fixed error causing broken images in web5/html5 output.]
57
- ]
79
+ bugs[
80
+ issue[169|*.scss files are now supported by the %>[style].]
81
+ issue[170|Improved default CodeRay stylesheet.]
82
+ issue[171|SCSS now used internally by Glyph to generate default CSS files.]
83
+ issue[173|Consecutive escape sequences are now interpreted correctly in topics.]
84
+ issue[174|Fixed error causing broken images in web5/html5 output.]
85
+ ]
58
86
  ]
59
87
  release[0.4.0|September 3th 2010|
60
- features[
61
- issue[40|A new #>[stats] can be used to display statistics about project files, snippets, macros, bookmarks and links.]
62
- issue[73|It is now possible to validate online HTTP links.]
63
- issue[112|It is now possible to use _wkhtmltopdf_ instead of Prince to generate PDF files from HTML files.]
64
- issue[114|It is now possible to generate documents comprised of multiple files (topics).]
65
- issue[115|It is now possible to define layouts (used when generating multi-file outputs) using Glyph macros.]
66
- issue[120|It is now possible to compile your project to a single HTML5 file (@html5@ output) or multiple files (@web5@ output)]
67
- issue[135|Stylesheets can now be linked and imported as well as embedded.]
68
- issue[138|@web@ and @web5@ output formats inherit @html@ macros.]
69
- issue[142|A new %>[navigation] can be used in @web@ and @web5@ outputs to navigate through topics.]
70
- issue[143|A topic-based TOC is generated when compiling to @web@ or @web5@]
71
- 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@.]
72
- issue[147|The default stylesheets provided by Glyph are now compatible with HTML5 outputs (html5 and web5).]
73
- issue[148|It is now possible to create custom tasks and commands to extend Glyph functionality.]
74
- ]
75
- bugs[
76
- issue[133|Added HTML charset to Glyph documents (utf-8).]
77
- issue[136|Moved utility functions to separate @Glyph::Utils@ module.]
78
- issue[139|Heavily restructured Glyph configuration.]
79
- issue[140|Added @Glyph::Macro::Helpers@ module to avoid code duplication in macros for different output formats.]
80
- issue[141|Prevented non-rb files to be loaded as macros.]
81
- issue[145|Dotfiles are now ignored by #>[init].]
82
- issue[167|Fixed PDF book download links.]
83
- ]
88
+ features[
89
+ issue[40|A new #>[stats] can be used to display statistics about project files, snippets, macros, bookmarks and links.]
90
+ issue[73|It is now possible to validate online HTTP links.]
91
+ issue[112|It is now possible to use _wkhtmltopdf_ instead of Prince to generate PDF files from HTML files.]
92
+ issue[114|It is now possible to generate documents comprised of multiple files (topics).]
93
+ issue[115|It is now possible to define layouts (used when generating multi-file outputs) using Glyph macros.]
94
+ issue[120|It is now possible to compile your project to a single HTML5 file (@html5@ output) or multiple files (@web5@ output)]
95
+ issue[135|Stylesheets can now be linked and imported as well as embedded.]
96
+ issue[138|@web@ and @web5@ output formats inherit @html@ macros.]
97
+ issue[142|A new %>[navigation] can be used in @web@ and @web5@ outputs to navigate through topics.]
98
+ issue[143|A topic-based TOC is generated when compiling to @web@ or @web5@]
99
+ 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@.]
100
+ issue[147|The default stylesheets provided by Glyph are now compatible with HTML5 outputs (html5 and web5).]
101
+ issue[148|It is now possible to create custom tasks and commands to extend Glyph functionality.]
102
+ ]
103
+ bugs[
104
+ issue[133|Added HTML charset to Glyph documents (utf-8).]
105
+ issue[136|Moved utility functions to separate @Glyph::Utils@ module.]
106
+ issue[139|Heavily restructured Glyph configuration.]
107
+ issue[140|Added @Glyph::Macro::Helpers@ module to avoid code duplication in macros for different output formats.]
108
+ issue[141|Prevented non-rb files to be loaded as macros.]
109
+ issue[145|Dotfiles are now ignored by #>[init].]
110
+ issue[167|Fixed PDF book download links.]
111
+ ]
84
112
  ]
85
113
  release[0.3.0|June 13th 2010|
86
- features[
87
- issue[39|A new #>[outline] is available to display the document outline.]
88
- issue[110|It is now possible to use Glyph language to produce arbitrary XML code.]
89
- issue[111|System settings are now stored within a @system.*@ namespace and cannot be changed via the %>[config:] or the #>[config].]
90
- issue[116|It is now possible to use named attributes within Glyph macros.]
91
- issue[119|#[new_parser]A new parser was implemented from scratch to improve performance. Treetop gem no longer required.]
92
- issue[121|Some macros have been removed in favor of XML fallback, others have been updated.]
93
- issue[123|The SyntaxNode class has been specialized to differentiate between macros, attributes, parameters, text and escapes.]
94
- issue[124|Implemented new %>[article] and %>[book].]
95
- issue[126|A new %>[rewrite:] has been implemented to create simple macros using just Glyph code.]
96
- issue[127|A new %>[alias] has been implemented to create macro aliases.]
97
- issue[128|A blacklist for XML tags has been exposed via the @language.options.xml_blacklist@ setting.]
98
- issue[129|The %>[include] can now be used in lite mode, it can evaluate ruby files and requires relative paths.]
99
- issue[130|A new "safe mode" has been implemented to explicitly forbid certain potentially unsafe macros.]
100
- ]
101
- bugs[
102
- issue[109|Performance has been dramatically improved by implementing a parser from scratch (see =>[#new_parser|#119])]
103
- issue[122|Macro encoding/decoding no longer necessary due to the new parser (see =>[#new_parser|#119])]
104
- issue[125|Warning messages have been streamlined.]
105
- ]
114
+ features[
115
+ issue[39|A new #>[outline] is available to display the document outline.]
116
+ issue[110|It is now possible to use Glyph language to produce arbitrary XML code.]
117
+ issue[111|System settings are now stored within a @system.*@ namespace and cannot be changed via the %>[config:] or the #>[config].]
118
+ issue[116|It is now possible to use named attributes within Glyph macros.]
119
+ issue[119|#[new_parser]A new parser was implemented from scratch to improve performance. Treetop gem no longer required.]
120
+ issue[121|Some macros have been removed in favor of XML fallback, others have been updated.]
121
+ issue[123|The SyntaxNode class has been specialized to differentiate between macros, attributes, parameters, text and escapes.]
122
+ issue[124|Implemented new %>[article] and %>[book].]
123
+ issue[126|A new @rewrite@ macro has been implemented to create simple macros using just Glyph code.]
124
+ issue[127|A new %>[alias] has been implemented to create macro aliases.]
125
+ issue[128|A blacklist for XML tags has been exposed via the @language.options.xml_blacklist@ setting.]
126
+ issue[129|The %>[include] can now be used in lite mode, it can evaluate ruby files and requires relative paths.]
127
+ issue[130|A new "safe mode" has been implemented to explicitly forbid certain potentially unsafe macros.]
128
+ ]
129
+ bugs[
130
+ issue[109|Performance has been dramatically improved by implementing a parser from scratch (see =>[#new_parser|#119])]
131
+ issue[122|Macro encoding/decoding no longer necessary due to the new parser (see =>[#new_parser|#119])]
132
+ issue[125|Warning messages have been streamlined.]
133
+ ]
106
134
  ]
107
135
  release[0.2.0|May 9th 2010|
108
- features[
109
- issue[62|A new %>[highlight] is available to highlight source code (CodeRay or UltraViolet required).]
110
- issue[76|It is now possible to use Glyph programmatically via the new @Glyph#filter@ and @Glyph#compile@ methods.]
111
- issue[87|It is now possible to define snippets inside a Glyph source file using the %>[snippet:].]
112
- issue[88|It is now possible to change configuration settings inside a Glyph source file using the %>[config:] (Jabbslad).]
113
- issue[89|It is now possible to compile a single Glyph source file without creating a Glyph project.]
114
- issue[92|6 new macros have been defined to allow conditional processing (\.%>[condition], %>[eq], %>[not], %>[and], %>[or], %>[match])]
115
- issue[94|It is now possible to add _validators_ to macros, for example to check the number of parameters they take.]
116
- issue[97|The #>[compile] command can now take an extra @--auto@ switch to trigger document auto-regeneration whenever a source file is changed (koraktor).]
117
- issue[99|Added a @document.draft@ setting. If set to @true@, comments and TODOs are rendered in output files.]
118
- issue[100|#[system_css]Glyph CSS files are no longer copied to new projects, but they can be referenced as if they were (see also =>[#css_not_copied|#93]).]
119
- issue[108|It is now possible to define Glyph macros within Glyph source files using the %>[macro:].]
120
- ]
121
- bugs[
122
- issue[86|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.]
123
- issue[93|#[css_not_copied]Default css files were not copied when creating a new project. The issue has been resolved by allowing the %>[style] to reference Glyph's system styles (see also =>[#system_css|#100]).]
124
- issue[95|The #>[config] did not save data to YAML configuration files. This has been fixed ensuring that internal configuration overrides are not saved to the YAML file too.]
125
- issue[98|Glyph is now fully compatible with Ruby 1.9.1 and JRuby 1.4.0.]
126
- issue[101|Additional tests have been developed to improve Textile support. There should no longer be errors when using textile block elements inside Glyph macros.]
127
- issue[103|Fixed a bug that caused test failures when deleting the test project directory.]
128
- issue[104|Nested Glyph macros calling @Macro#interpret@ no longer ignore escape delimiters.]
129
- issue[107|Added the possibility to encode (using the @encode@ macro) and decode (using the @decode@ macro) macros so that they can be interpreted later.]
130
- ]
136
+ features[
137
+ issue[62|A new %>[highlight] is available to highlight source code (CodeRay or UltraViolet required).]
138
+ issue[76|It is now possible to use Glyph programmatically via the new @Glyph#filter@ and @Glyph#compile@ methods.]
139
+ issue[87|It is now possible to define snippets inside a Glyph source file using the %>[snippet:].]
140
+ issue[88|It is now possible to change configuration settings inside a Glyph source file using the %>[config:] (Jabbslad).]
141
+ issue[89|It is now possible to compile a single Glyph source file without creating a Glyph project.]
142
+ issue[92|6 new macros have been defined to allow conditional processing (\/%>[condition], %>[eq], %>[not], %>[and], %>[or], %>[match])]
143
+ issue[94|It is now possible to add _validators_ to macros, for example to check the number of parameters they take.]
144
+ issue[97|The #>[compile] command can now take an extra @--auto@ switch to trigger document auto-regeneration whenever a source file is changed (koraktor).]
145
+ issue[99|Added a @document.draft@ setting. If set to @true@, comments and TODOs are rendered in output files.]
146
+ issue[100|#[system_css]Glyph CSS files are no longer copied to new projects, but they can be referenced as if they were (see also =>[#css_not_copied|#93]).]
147
+ issue[108|It is now possible to define Glyph macros within Glyph source files using the %>[macro:].]
148
+ ]
149
+ bugs[
150
+ issue[86|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.]
151
+ issue[93|#[css_not_copied]Default css files were not copied when creating a new project. The issue has been resolved by allowing the %>[style] to reference Glyph's system styles (see also =>[#system_css|#100]).]
152
+ issue[95|The #>[config] did not save data to YAML configuration files. This has been fixed ensuring that internal configuration overrides are not saved to the YAML file too.]
153
+ issue[98|Glyph is now fully compatible with Ruby 1.9.1 and JRuby 1.4.0.]
154
+ issue[101|Additional tests have been developed to improve Textile support. There should no longer be errors when using textile block elements inside Glyph macros.]
155
+ issue[103|Fixed a bug that caused test failures when deleting the test project directory.]
156
+ issue[104|Nested Glyph macros calling @Macro#interpret@ no longer ignore escape delimiters.]
157
+ issue[107|Added the possibility to encode (using the @encode@ macro) and decode (using the @decode@ macro) macros so that they can be interpreted later.]
158
+ ]
131
159
  ]
132
160
  release[0.1.0|April 8th 2010|
133
- Initial release.
161
+ Initial release.
134
162
  ]
@@ -6,42 +6,54 @@ By default, a Glyph project can be "compiled" into an HTML document. Additionall
6
6
  * Web5 (i.e. multiple HTML5 files)
7
7
  ]
8
8
  section[
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 =]]
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
14
  ]
15
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[
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
21
  Currently, Glyph supports:
22
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
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
24
 
25
- By default, Glyph attempts to use wkhtmltopdf. To change this, set the $>[output_pdf_generator] to code[prince].
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].]
25
+ By default, Glyph attempts to use wkhtmltopdf. To change this, set the $>[output_pdf_generator] to code[prince].
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
29
  ]
30
+
31
+ section[
32
+ @title[EPUB/MOBI output]
33
+ p[To generate .epub or .mobi e-books, you must specify code[epub] or code[mobi] as format, like this:]
34
+ p[code[= glyph compile -f mobi =]]
35
+ p[code[= glyph compile -f epub =]]
36
+ p[This option requires that you have &[calibre] and its command-line tools installed. Glyph assumes the ebook-convert command is installed in /usr/bin. If this is not so, you can set the code[options.ebook.converter] option to the path to the ebook-convert command.]
37
+ p[If you have cover art for your e-book, put it in the code[images] folder, and specify the name of the file in the code[document.cover] configuration option.]
38
+ p[You can also specify the output profile used by the code[ebook-convert] command by setting the code[output.epub.profile] and code[output.mobi.profile] options. If these are not specified, the conversion will use the code[kindle] output profile for mobi files, and the code[nook] output profile for epub files. See the documentation for Calibre for a list of available output profiles.]
39
+ tip[Giving the command code[= glyph compile -f ebooks =] will generate both mobi and epub files.]
40
+ ]
41
+
30
42
  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].
43
+ @title[Web/Web5 Output]
44
+ @id[web_output]
45
+ txt[
46
+ 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
47
 
36
48
  Basically, here's what happens when you compile your project in web or web5 format:
37
49
  # The document code is parsed as normal
38
50
  # 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
- ]
51
+ # 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].
52
+ ]
41
53
  ]
42
54
  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.]
55
+ @title[Auto Regeneration]
56
+ @id[auto_regeneration]
57
+ 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.]
58
+ note[Auto regeneration requires the =>[http://rubygems.org/gems/directory_watcher|directory_watcher] gem to be installed.]
47
59
  ]
@@ -1,12 +1,12 @@
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.]
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:]
3
- p[code[glyph compile source.glyph destination.htm]]
4
- p[This command will process a file called code[source.glyph] and produce an HTML file called code[destination.htm].]
5
- section[
6
- @title[Limitations]
7
- @id[lite_limitations]
8
- &:[only_defined_through|can only be defined inside the source file, using the]
9
- txt[
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.]
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:]
3
+ p[code[glyph compile source.glyph destination.htm]]
4
+ p[This command will process a file called code[source.glyph] and produce an HTML file called code[destination.htm].]
5
+ section[
6
+ @title[Limitations]
7
+ @id[lite_limitations]
8
+ &:[only_defined_through|can only be defined inside the source file, using the]
9
+ txt[
10
10
  &:[referenced_with_path|must be referenced with their absolute path, or a path relative to the current directory]
11
11
  This sort of "lite" mode comes with a few minor limitations:
12
12
  * Snippets &[only_defined_through] %>[snippet:].
@@ -15,5 +15,5 @@ This sort of "lite" mode comes with a few minor limitations:
15
15
  * Images &[referenced_with_path], and will not be copied anywhere when the output file is generated.
16
16
  * Stylesheets &[referenced_with_path], or the name of an existing Glyph =>[#default_stylesheets|system stylesheet].
17
17
  * The files included through the %>[include] &[referenced_with_path].
18
- ]
19
- ]
18
+ ]
19
+ ]
@@ -1,73 +1,73 @@
1
- txt[
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:
1
+ txt[
2
+ Besides using Glyph from the command line, you can also use it straight from your code. Glyph's public =>[&[rubydoc]|API] is simple and can be used to:
3
3
  * Retrieve and update configuration settings (using @Glyph\[\]@ and @Glyph\[\]=@)
4
4
  * Filter text to HTML (using @Glyph#filter@)
5
5
  * Compile Glyph source files into HTML or PDF files (using @Glyph#compile@)
6
6
 
7
7
  That's pretty much it. Of course, both the @filter@ and @compile@ method cause Glyph to run in =>[#lite_mode|_lite_ mode], so the same =>[#lite_limitations|limitations] apply.
8
- ]
9
- tip[
10
- txt[
8
+ ]
9
+ tip[
10
+ txt[
11
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:
12
12
  * =>[http://github.com/h3rald/h3rald/blob/master/lib/glyph_filter.rb|lib/glyph_filter.rb] -- using the @Glyph#filter@ method.
13
13
  * =>[http://github.com/h3rald/h3rald/blob/master/lib/glyph_context.rb|lib/glyph_context.rb] -- using the @Glyph#compile@ method to generate PDF files.
14
- ]
15
- ]
16
- section[
17
- @title[Modes]
18
- @id[modes]
19
- p[It is possible to specify some flags (or "modes") to make Glyph behave slightly different than normal, as shown in the following table (by default, none of these is used).]
20
- table[
21
- tr[
22
- th[Name]
23
- th[Writer Method]
24
- th[Reader Method]
25
- th[Description]
26
- ]
27
- tr[
28
- td[Test Mode]
29
- td[code[Glyph.test_mode=]]
30
- td[code[Glyph.test?]]
31
- td[Used internally by the code[rake spec] task to run Glyph's specs.]
32
- ]
33
- tr[
34
- td[Library Mode]
35
- td[code[Glyph.library_mode=]]
36
- td[code[Glyph.library?]]
37
- td[If enabled, the #>[compile] command will raise exceptions instead of printing errors on the screen. Enabled by the code[Glyph.compile] command.]
38
- ]
39
- tr[
40
- td[Debug Mode]
41
- td[code[Glyph.debug_mode=]]
42
- td[code[Glyph.debug?]]
43
- td[If enabled, additional diagnostic information (such as backtraces or macro values) will be displayed. Enabled by specifying the =>[#debug_switch|debug switch] when running a Glyph command.]
44
- ]
45
- tr[
46
- td[Lite Mode]
47
- td[code[Glyph.lite_mode=]]
48
- td[code[Glyph.lite?]]
49
- td[
50
- txt[
14
+ ]
15
+ ]
16
+ section[
17
+ @title[Modes]
18
+ @id[modes]
19
+ p[It is possible to specify some flags (or "modes") to make Glyph behave slightly different than normal, as shown in the following table (by default, none of these is used).]
20
+ table[
21
+ tr[
22
+ th[Name]
23
+ th[Writer Method]
24
+ th[Reader Method]
25
+ th[Description]
26
+ ]
27
+ tr[
28
+ td[Test Mode]
29
+ td[code[Glyph.test_mode=]]
30
+ td[code[Glyph.test?]]
31
+ td[Used internally by the code[rake spec] task to run Glyph's specs.]
32
+ ]
33
+ tr[
34
+ td[Library Mode]
35
+ td[code[Glyph.library_mode=]]
36
+ td[code[Glyph.library?]]
37
+ td[If enabled, the #>[compile] command will raise exceptions instead of printing errors on the screen. Enabled by the code[Glyph.compile] command.]
38
+ ]
39
+ tr[
40
+ td[Debug Mode]
41
+ td[code[Glyph.debug_mode=]]
42
+ td[code[Glyph.debug?]]
43
+ td[If enabled, additional diagnostic information (such as backtraces or macro values) will be displayed. Enabled by specifying the =>[#debug_switch|debug switch] when running a Glyph command.]
44
+ ]
45
+ tr[
46
+ td[Lite Mode]
47
+ td[code[Glyph.lite_mode=]]
48
+ td[code[Glyph.lite?]]
49
+ td[
50
+ txt[
51
51
  Used to compile =>[#lite_mode|single files]. Enabled by:
52
52
  * The @Glyph.compile@ and @Glyph.filter@ methods.
53
53
  * The #>[compile], if at least one parameter is supplied.
54
- ]
55
- ]
56
- ]
57
- tr[
58
- td[Safe Mode]
59
- td[code[Glyph.safe_mode=]]
60
- td[code[Glyph.safe?]]
61
- td[
62
- txt[
54
+ ]
55
+ ]
56
+ ]
57
+ tr[
58
+ td[Safe Mode]
59
+ td[code[Glyph.safe_mode=]]
60
+ td[code[Glyph.safe?]]
61
+ td[
62
+ txt[
63
63
  If enabled, the following macros cannot be used and will return an error:
64
64
  * %>[ruby]
65
65
  * %>[macro:]
66
66
  * %>[include]
67
- * %>[rewrite:]
67
+ * %>[define:]
68
68
  * %>[config:]
69
- ]
70
- ]
71
- ]
72
- ]
73
- ]
69
+ ]
70
+ ]
71
+ ]
72
+ ]
73
+ ]