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
@@ -0,0 +1,64 @@
1
+ section[
2
+ @title[Defining Macros]
3
+ @id[macro_def]
4
+ txt[
5
+ 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.
6
+
7
+ box[Alternative Ways to Define Macros|
8
+ You can also define macros:
9
+ * inside your document, using the %>[macro:].
10
+ * Using the %>[include] specifying the path to an @.rb@ file containing macro definitions stored in the @lib/@ directory (useful especially when =>[#lite_mode|compiling single Glyph files]).
11
+ ]
12
+
13
+ This is the source code of a fairly simple macro used to format a note:
14
+ ]
15
+ highlight[=ruby|
16
+ macro :note do
17
+ %{<div class="#{@name}"><span class="note-title">#{@name.to_s.capitalize}</span>
18
+ #{@value}
19
+
20
+ </div>}
21
+ end
22
+ =]
23
+ txt[
24
+ 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.
25
+
26
+ The body of the macro is evaluated in the context of the class[Glyph::Macro] class, therefore its instance variables (like code[@name] or code[@value]) can be used directly.
27
+
28
+ box[Why using code[@name] instead of just "note"?|
29
+ For the @note@ macro, it absolutely makes no difference. However, by using code[@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.
30
+ ]
31
+
32
+ The following table lists all the instance variables that can be used inside macros:
33
+ ]
34
+ table[
35
+ tr[
36
+ th[Variable]
37
+ th[Description]
38
+ ]
39
+ tr[
40
+ td[code[@node]]
41
+ td[
42
+ txt[
43
+ A class[Glyph::MacroNode] containing information about the macro. Useful for accessing parent and child macros, and the current class[Glyph::Document]. Normally, instances of the code[MacroNode] class contain the following keys:
44
+ * @:name@, the name of the macro.
45
+ * @:source@, a @String@ identifying the source of the macro (a file, a snippet, etc.)
46
+ * @:value@, the value of the macro (populated after the document has been parsed and analyzed).
47
+ * @:escape@, whether the macro is a =>[#esc_quot|quoting macro] or not.
48
+ * @:document@, the instance of code[Document] the macro is contained in (populated after the document has been parsed and analyzed).
49
+
50
+ Note that the first two keys can also be accessed via instance variables.
51
+ ]
52
+ ]
53
+ ]
54
+ tr[
55
+ td[code[@name]]
56
+ td[The name of the macro.]
57
+ ]
58
+ tr[
59
+ td[code[@source]]
60
+ td[A code[String] identifying the source of the macro (a file, a snippet, etc.).]
61
+ ]
62
+ ]
63
+ ]
64
+
@@ -0,0 +1,70 @@
1
+ section[
2
+ @title[Parameters and Attributes]
3
+ txt[
4
+ Perhaps the most common things to do in a macro definition is accessing parameters and attributes. When doing so, it is important to consider whether we want to retrieve the _raw value_ of and attribute or parameter or its _expanded value_. The difference between the two will become clearer in the following sections and also in the =>[#interpreting] section.
5
+ ]
6
+ section[
7
+ @title[Accessing Expanded Values]
8
+ @id[expanded_values]
9
+ txt[
10
+ Normally, you just want to get the value of an attribute or parameter and use it in the macro. This means, in other words, its _expanded_ value, i.e. the value resulting from the expansion of the macros (if any) within the attribute or parameter.
11
+ ]
12
+ txt[
13
+ To access expanded values, use the following methods:
14
+ * @parameter@ (or @param@): Returns the expanded value of the parameter specified by number. Other parameters are not expanded.
15
+ * @value@: Returns the expanded value of the first parameter (i.e. like @parameter(0)@).
16
+ * @attribute@ (or @attr@): Returns the expanded value of the attribute specified by name. Other attributes are not expanded.
17
+ * @parameters@ (or @params@): Returns an array of expanded parameters.
18
+ * @attributes@ (or @attrs@): Returns a hash of expanded attributes.
19
+
20
+ ]
21
+
22
+ ]
23
+ section[
24
+ @title[Accessing Raw Values]
25
+ p[While accessing expanded values is simple and immediate, in some cases it may not produce the desired results. Consider the following macro definition:]
26
+ highlight[=ruby|
27
+ macro :nest_section do
28
+ interpret %{section[
29
+ @title[A]
30
+ section[
31
+ @title[B]
32
+ #{value}
33
+ ]
34
+ ]}
35
+ end
36
+ =]
37
+ p[And suppose to use it as follows:]
38
+ highlight[=ruby|
39
+ nest_section[
40
+ section[
41
+ @title[Inner Section]
42
+ ...
43
+ ]
44
+ ]
45
+ =]
46
+ p[It produces the following HTML code:]
47
+ highlight[=html|
48
+ <div class="section">
49
+ <h2 id="h_2">A</h2>
50
+ <div class="section">
51
+ <h3 id="h_3">B</h3>
52
+ <div class="section">
53
+ <h2 id="h_1">Inner Section</h2>
54
+ ...
55
+ </div>
56
+ </div>
57
+ </div>
58
+ =]
59
+ p[Everything is fine em[except] for the header level: the heading "Inner Section" is of level 2, but it should be level 4!]
60
+ p[This happens because the inner section is evaluated em[before] the code[nest_section] macro: after all, we ask for it ourselves when we call the code[value] method inside the macro definition. When the value is expanded, there are no outer sections em[yet].]
61
+ p[To avoid this unwanted behavior, we can use the code[raw_value] method instead, that returns the first parameter converted back to a Glyph code string.]
62
+ tip[To be on the safe side, always use code[raw_*] methods when interpreting.]
63
+ txt[
64
+ To access raw values, use the following methods:
65
+ * @raw_parameter@ (or @raw_param@): Returns the raw parameter value of the parameter specified by number.
66
+ * @raw_value@: Returns the first raw parameter value (i.e. like @raw_parameter(0)@).
67
+ * @raw_attribute@ (or @raw_attr@): Returns the attribute value of the attribute specified by name.
68
+ ]
69
+ ]
70
+ ]
@@ -0,0 +1,34 @@
1
+ section[
2
+ @title[Using Placeholders]
3
+ txt[
4
+ 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.
5
+
6
+ Here's the source code of the %>[link]:
7
+ ]
8
+ highlight[=ruby|
9
+ macro :link do
10
+ href, title = @params
11
+ if href.match /^#/ then
12
+ anc = href.gsub(/^#/, '').to_sym
13
+ bmk = bookmark? anc
14
+ if bmk then
15
+ title \|\|= bmk[:title]
16
+ else
17
+ plac = placeholder do \|document\|
18
+ macro_error "Bookmark '#{anc}' does not exist" unless document.bookmarks[anc]
19
+ document.bookmarks[anc][:title]
20
+ end
21
+ title \|\|= plac
22
+ end
23
+ end
24
+ title \|\|= href
25
+ %{<a href="#{href}">#{title}</a>}
26
+ end
27
+ =]
28
+ txt[
29
+ 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.
30
+
31
+ Within the @placeholder@ block, the @document@ parameter is, by all means, the fully analyzed document.
32
+ ]
33
+ ]
34
+
@@ -0,0 +1,16 @@
1
+ section[
2
+ @title[Using Validators]
3
+ p[If you need to make sure that a macro is used properly, consider using =>[&[yardoc]/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.]
4
+ p[If you want to create your own validators, you can call the generic code[validate] method which takes the message to display in case of error, a Hash of options and a block containing the validation to perform.]
5
+ box[Validating macro placement|
6
+ txt[
7
+ 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.
8
+
9
+ Suppose, for example, that the %>[box] is only allowed within a @section@ macro. This means that, for example:
10
+ * the macro cannot be used within @chapter@ or @appendix@ macros.
11
+ * the macro cannot be used in snippets
12
+
13
+ Even if you consider all the possibilities within the scope of the default macros provided with Glyph, this would also make the @box@ macro unusable within custom macros.
14
+ ]
15
+ ]
16
+ ]
@@ -0,0 +1,49 @@
1
+ section[
2
+ @title[Project Configuration]
3
+ @id[cfg]
4
+
5
+ textile[
6
+ Glyph stores configuration settings in the following YAML files:
7
+ # Your _Project Configuration_ is stored in the @config.yml@ file, included in each Glyph Project.
8
+ # Your _Global Configuration_ is stored in a @.glyphrc@ file in your code[$HOME] (or ==\.code[%HOMEPATH%]== on Windows) directory (not created by default).
9
+ # The _System Configuration_ is stored in the source directory of Glyph itself.
10
+
11
+ When compiling, Glyph loads all these configuration files and merges them according to the following rules:
12
+ * A setting configured in the _Project Configuration_ overrides the same setting in both Global and System configuration.
13
+ * A setting configured in the _Global Configuration_ overrides the same setting in the _System Configuration_.
14
+
15
+ 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.
16
+
17
+ Instead of editing your configuration settings directly, you can use the #>[config], as follows:
18
+
19
+ @glyph config@ _setting_ _\[value\]_
20
+
21
+ If no _value_ is specified, glyph 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.
22
+
23
+ To change the value of a configuration setting, specify a value right after the setting, like this:
24
+
25
+ @glyph config document.author "John Smith"@
26
+
27
+ tip[It is also possible to change configuration settings inside your document, using the %>[config:].]
28
+
29
+ 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:
30
+
31
+ @glyph config -g document.author "John Smith"@
32
+
33
+ box[Regarding configuration values and data types...|
34
+ Glyph attempts to "guess" the data type of a configuration value by evaluation (@Kernel#instance_eval@) if the value:
35
+ * is wrapped in quotes (@"@ or @'@) &rarr; @String@
36
+ * starts with a colon (@:@) &rarr; @Symbol@
37
+ * is wrapped in square brackets (@\[@ and @\]@) &rarr; @Array@
38
+ * is wrapped in curly brackets (@{@ and @}@) &rarr; @Hash@
39
+ * is _true_ or _false_ &rarr; @Boolean@
40
+ * is _nil_ &rarr; @NilClass@
41
+
42
+ Note that this guessing is far from being foolproof: If you type something like _{:test, 2}_, for example, you'll get an error.
43
+ ]
44
+
45
+ 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).
46
+
47
+ For a complete reference, see =>[#cfg_ref]. For everyday use, you may just want to change the settings defined in the =>[#cfg_document] namespace.
48
+ ] --[End textile]
49
+ ]
@@ -0,0 +1,41 @@
1
+ section[
2
+ @title[Creating your first Glyph Project]
3
+
4
+ textile[
5
+ 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:
6
+
7
+ @mkdir@ _==test_document==_
8
+
9
+ @cd@ _==test_document==_
10
+
11
+ @glyph init@
12
+
13
+ That's it. You just created a new Glyph project in the @test_document@ directory.
14
+
15
+ box[Glyph's dependencies|
16
+ Glyph requires the following gems:
17
+ * extlib
18
+ * gli
19
+ * rake
20
+
21
+ Additionally, some Glyph macros may require additional gems, such as:
22
+ * RedCloth (\.%>[textile])
23
+ * BlueCloth _or_ RDiscount _or_ Maruku _or_ Kramdown (\.%>[markdown])
24
+ * Haml (if you want to load .sass files with the %>[style])
25
+ * CodeRay _or_ UltraViolet (\.%>[highlight])
26
+ * directory_watcher (to use auto-regeneration with the #>[compile])
27
+ ]
28
+
29
+ Every Glyph project is comprised of the following directories:
30
+ * @images/@ -- used to store the image files used in your document.
31
+ * @lib/@ -- used to store your custom Glyph macros and Rake tasks.
32
+ * @output/@ -- used to store your generated output files.
33
+ * @styles/@ -- used to store your stylesheets.
34
+ * @text/@ -- used to store your source text files.
35
+
36
+ Additionally, the following files are also created at top level:
37
+ * @config.yml@ -- containing your =>[#cfg|Project Configuration].
38
+ * @document.glyph@ -- containing the =>[#struct|structure] of your document.
39
+ * @snippets.yml@ -- containing your text =>[#incl|snippets].
40
+ ]
41
+ ]
@@ -0,0 +1,55 @@
1
+ section[
2
+ @title[Document Structure]
3
+ @id[struct]
4
+
5
+ p[Every Glyph project contains a code[document.glyph] file that is typically used to define the document structure. The default code[document.glyph] generated automatically when creating a new project is the following:]
6
+
7
+ highlight[=html|
8
+ book[
9
+ @frontmatter[
10
+ toc[]
11
+ preface[
12
+ @title[Preface]
13
+ todo[Write the preface]
14
+ include[preface]
15
+ ]
16
+ ]
17
+ @bodymatter[
18
+ chapter[
19
+ @title[Chapter 1]
20
+ todo[Write chapter 1]
21
+ include[chapter_1]
22
+ ]
23
+ chapter[
24
+ @title[Chapter 2]
25
+ todo[Write chapter 2]
26
+ include[chapter_2]
27
+ ]
28
+ ]
29
+ @backmatter[
30
+ appendix[
31
+ @title[Appendix A]
32
+ todo[Write appendix A]
33
+ include[appendix_a]
34
+ ]
35
+ ]
36
+ ]
37
+ =]
38
+
39
+ textile[
40
+ Even without knowing anything about &[glang], you can easily figure out that this file defines a document with a Table of Contents, a Preface some Chapters and an Appendix.
41
+
42
+ As you can see, Glyph wraps portions of text within square brackets preceded by an identifier. These identifiers are used for em[\.=>[#macro_intro|macros]] and em[\.=>[#attribute_intro|attributes]]. The only syntactic difference between macros and attributes is that attributes are preceded by a code[@].
43
+
44
+ For now, think about a macro as something that performs a certain action and -- generally -- produces some text output or manipulation of the text inside it. In this way, it becomes easy to understand that the @chapter@ macro creates a chapter and the %>[include] includes an external file, for example.
45
+ Attributes "belong" to the macro they're in, so in this case the %>[book] has the following attributes:
46
+ * code[@frontmatter]
47
+ * code[@bodymatter]
48
+ * code[@backmatter]
49
+
50
+ More specifically, in this @document.glyph@ file:
51
+ * The %>[book] wraps every other macro and is used to create the document header and default title page.
52
+ * Then, the code[@frontmatter], code[@bodymatter], and code[@backmatter] attributes are used to 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.
53
+ * @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 through code[@title] attributes.
54
+ ]
55
+ ]
@@ -1,13 +1,12 @@
1
- --[
2
1
  &:[prince|=>[http://www.princexml.com/|Prince]]
2
+ Glyph is a _Rapid Document Authoring Framework_.
3
3
 
4
- ]Glyph is a _Rapid Document Authoring Framework_.
4
+ With Glyph, you can manage your documents tidily in _projects_ and generate deliverables in different formats such as HTML or PDF (through &[prince]).
5
5
 
6
- Think of it like a sort of =>[http://www.rubyonrails.org|Ruby on Rails] but for creating text documents instead of web sites. With Glyph, you can manage your documents tidily in _projects_ that can be used to generate deliverables in different formats such as HTML or PDF (through &[prince]).
6
+ section[
7
+ @title[Main Features]
7
8
 
8
- section[header[Main Features]
9
-
10
- Glyph uses a simple macro system to perform a wide variety of advanced tasks:
9
+ Glyph comes with its very own macro system to perform a wide variety of advanced tasks:
11
10
  * Generate block-level HTML tags not commonly managed by lightweight markups, like @head@, @body@, @div@ and @table@.
12
11
  * Create and validate internal and external links.
13
12
  * Include and validate images and figures.
@@ -20,20 +19,23 @@ Glyph uses a simple macro system to perform a wide variety of advanced tasks:
20
19
  * Define macros, snippets and configuration settings directly within your document.
21
20
  * Highlight source code.
22
21
  * Call macros from other macros (including snippets), avoiding mutual calls.
23
- * Include text files in other text files.
22
+ * Include text files within other text files.
24
23
  * Include the value of any configuration setting (like author, title) in the document.
25
- * Filter input explicitly or implicitly, based on file extensions when including files.
24
+ * Filter input explicitly or implicitly (based on file extensions).
26
25
  * Manage draft comments and todo items.
26
+ * Provide a simple, less-verbose syntax to write XML code.
27
27
 
28
28
  ]
29
29
 
30
- section[header[Installation]
30
+ section[
31
+ @title[Installation]
31
32
 
32
33
  @gem install glyph@ -- simple, as always.
33
34
 
34
35
  ]
35
36
 
36
- section[header[Essential Glyph commands]
37
+ section[
38
+ @title[Essential Glyph commands]
37
39
 
38
40
  Glyph is 100% command line. Its interface resambles =>[http://git-scm.com/|Git's] for its simplicity and power (thanks to the =>[http://github.com/davetron5000/gli|gli] gem). Here are some example commands:
39
41
 
@@ -43,21 +45,33 @@ Glyph is 100% command line. Its interface resambles =>[http://git-scm.com/|Git's
43
45
  * @glyph compile --auto@ -- to keep recompiling the current document every time a file is changed.
44
46
  * @glyph compile -f pdf@ -- to compile the current document into HTML and then transform it into PDF using &[prince].
45
47
  * @glyph compile readme.glyph@ -- to compile a _readme.glyph_ located in the current directory into a single HTML file.
48
+ * @glyph outline -l 2@ -- Display the document outline, up to second-level headers.
46
49
 
47
50
  ]
48
51
 
49
- section[header[Glyph macros in a nutshell|macros_nutshell]
52
+ section[
53
+ @title[Glyph macros in a nutshell]
54
+ @id[macros_nutshell]
50
55
 
51
56
  Format your documents using Textile or Markdown, and use Glyph Macros to do everything else:
52
57
 
53
58
  **Glyph Source:**
54
59
 
55
- code[=
56
- section[header[Something about Glyph]
57
- You can use Glyph macros in conjunction
58
- with _Textile_ or _Markdown_ to
60
+ codeblock[=
61
+ section[
62
+ @title[Something about Glyph]
63
+ txt[
64
+ You can use Glyph macros in conjunction
65
+ with _Textile_ or _Markdown_ to
59
66
  produce HTML files effortlessly.
60
- section[header[What about PDFs?\|pdf]
67
+ ]
68
+ p[
69
+ Alternatively, you can just use em[Glyph itself]
70
+ to generate HTML tags.
71
+ ]
72
+ section[
73
+ @title[What about PDFs?]
74
+ @id[pdf]
61
75
  Once you have a single, well-formatted HTML
62
76
  file, converting it to PDF is
63
77
  extremely easy with a 3rd-party
@@ -68,24 +82,33 @@ renderer like =>[http://www.princexml.com\|Prince].
68
82
 
69
83
  **HTML Output:**
70
84
 
71
- code[=
85
+ codeblock[=
72
86
  <div class="section">
73
87
  <h2 id="h_10">Something about Glyph</h2>
74
- <p>You can use Glyph macros in conjunction with
75
- <em>Textile</em> or <em>Markdown</em> to
76
- produce HTML files effortlessly.</p>
88
+ <p>
89
+ You can use Glyph macros in conjunction with
90
+ <em>Textile</em> or <em>Markdown</em> to
91
+ produce HTML files effortlessly.
92
+ </p>
77
93
  <div class="section">
78
94
  <h3 id="pdf">What about PDFs?</h3>
79
- <p>Once you have a single, well-formatted HTML
80
- file, converting it to PDF is
81
- extremely easy with a 3rd-party renderer
82
- like <a href="http://www.princexml.com">Prince</a>.</p>
95
+ <p>
96
+ Once you have a single, well-formatted HTML
97
+ file, converting it to PDF is
98
+ extremely easy with a 3rd-party renderer
99
+ like <a href="http://www.princexml.com">Prince</a>.
100
+ </p>
101
+ <p>
102
+ Alternatively, you can just use <em>Glyph itself</em>
103
+ to generate HTML tags.
104
+ </p>
83
105
  </div>
84
106
  </div>
85
107
  =]
86
108
  ]
87
109
 
88
- section[header[Resources]
110
+ section[
111
+ @title[Resources]
89
112
 
90
113
  * Home Page: =>[http://www.h3rald.com/glyph/]
91
114
  * Repository: =>[http://www.github.com/h3rald/glyph/]
@@ -93,6 +116,6 @@ section[header[Resources]
93
116
  * Development Wiki =>[http://wiki.github.com/h3rald/glyph]
94
117
  * RubyGem Download =>[http://www.rubygems.org/gems/glyph]
95
118
  * Book (PDF): =>[http://github.com/h3rald/glyph/raw/\.%[Glyph::VERSION.strip]/book/output/pdf/glyph.pdf]
96
- * Reference Documentation: =>[http://yardoc.org/docs/glyph/]
119
+ * Reference Documentation: =>[http://yardoc.org/docs/h3rald-glyph/]
97
120
  * User Group: =>[http://groups.google.com/group/glyph-framework]
98
121
  ]