webgen 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/COPYING +4 -0
  2. data/ChangeLog +1037 -0
  3. data/Rakefile +5 -6
  4. data/THANKS +1 -0
  5. data/VERSION +1 -1
  6. data/bin/webgen +1 -1
  7. data/data/webgen/passive_sources/images/generated_by_webgen.png +0 -0
  8. data/data/webgen/passive_sources/images/webgen_logo.png +0 -0
  9. data/data/webgen/passive_sources/stylesheets/coderay-default.css +129 -0
  10. data/data/webgen/passive_sources/templates/atom_feed.template +38 -0
  11. data/data/webgen/passive_sources/templates/rss_feed.template +28 -0
  12. data/data/webgen/passive_sources/templates/sitemap.template +21 -0
  13. data/data/webgen/resources.yaml +2 -1
  14. data/data/webgen/website_skeleton/Rakefile +5 -1
  15. data/doc/contentprocessor/builder.page +2 -2
  16. data/doc/contentprocessor/erb.page +5 -2
  17. data/doc/contentprocessor/erubis.page +2 -2
  18. data/doc/contentprocessor/head.page +21 -0
  19. data/doc/contentprocessor/tidy.page +14 -0
  20. data/doc/extensions.page +1 -1
  21. data/doc/faq.page +2 -2
  22. data/doc/manual.page +108 -43
  23. data/doc/reference_configuration.page +83 -5
  24. data/doc/reference_metainfo.page +24 -4
  25. data/doc/reference_website_styles.page +2 -2
  26. data/doc/sourcehandler/feed.page +11 -13
  27. data/doc/sourcehandler/metainfo.page +10 -3
  28. data/doc/sourcehandler/page.page +4 -4
  29. data/doc/sourcehandler/sitemap.page +8 -7
  30. data/doc/tag/coderay.page +6 -2
  31. data/doc/tag/includefile.page +1 -1
  32. data/doc/tag/menu.page +3 -0
  33. data/lib/webgen/cli/apply_command.rb +1 -1
  34. data/lib/webgen/cli/utils.rb +2 -2
  35. data/lib/webgen/common.rb +0 -9
  36. data/lib/webgen/contentprocessor.rb +18 -3
  37. data/lib/webgen/contentprocessor/blocks.rb +67 -36
  38. data/lib/webgen/contentprocessor/builder.rb +5 -2
  39. data/lib/webgen/contentprocessor/erb.rb +4 -2
  40. data/lib/webgen/contentprocessor/erubis.rb +5 -2
  41. data/lib/webgen/contentprocessor/haml.rb +6 -2
  42. data/lib/webgen/contentprocessor/head.rb +64 -0
  43. data/lib/webgen/contentprocessor/maruku.rb +3 -1
  44. data/lib/webgen/contentprocessor/rdiscount.rb +2 -0
  45. data/lib/webgen/contentprocessor/rdoc.rb +2 -0
  46. data/lib/webgen/contentprocessor/redcloth.rb +2 -0
  47. data/lib/webgen/contentprocessor/sass.rb +5 -3
  48. data/lib/webgen/contentprocessor/tags.rb +40 -24
  49. data/lib/webgen/contentprocessor/tidy.rb +38 -0
  50. data/lib/webgen/context.rb +13 -4
  51. data/lib/webgen/context/render.rb +32 -0
  52. data/lib/webgen/context/tags.rb +20 -0
  53. data/lib/webgen/default_config.rb +15 -4
  54. data/lib/webgen/deprecated.rb +38 -4
  55. data/lib/webgen/error.rb +135 -0
  56. data/lib/webgen/node.rb +48 -40
  57. data/lib/webgen/output.rb +5 -3
  58. data/lib/webgen/output/filesystem.rb +4 -4
  59. data/lib/webgen/page.rb +4 -4
  60. data/lib/webgen/path.rb +161 -58
  61. data/lib/webgen/source.rb +9 -6
  62. data/lib/webgen/source/filesystem.rb +1 -1
  63. data/lib/webgen/source/stacked.rb +13 -5
  64. data/lib/webgen/source/tararchive.rb +6 -2
  65. data/lib/webgen/sourcehandler.rb +100 -54
  66. data/lib/webgen/sourcehandler/base.rb +58 -24
  67. data/lib/webgen/sourcehandler/copy.rb +6 -5
  68. data/lib/webgen/sourcehandler/directory.rb +3 -9
  69. data/lib/webgen/sourcehandler/feed.rb +25 -50
  70. data/lib/webgen/sourcehandler/fragment.rb +10 -8
  71. data/lib/webgen/sourcehandler/memory.rb +9 -10
  72. data/lib/webgen/sourcehandler/metainfo.rb +9 -9
  73. data/lib/webgen/sourcehandler/page.rb +6 -5
  74. data/lib/webgen/sourcehandler/sitemap.rb +22 -22
  75. data/lib/webgen/sourcehandler/template.rb +6 -6
  76. data/lib/webgen/sourcehandler/virtual.rb +19 -17
  77. data/lib/webgen/tag/base.rb +27 -27
  78. data/lib/webgen/tag/breadcrumbtrail.rb +3 -3
  79. data/lib/webgen/tag/coderay.rb +19 -8
  80. data/lib/webgen/tag/executecommand.rb +4 -3
  81. data/lib/webgen/tag/langbar.rb +2 -2
  82. data/lib/webgen/tag/link.rb +8 -7
  83. data/lib/webgen/tag/menu.rb +2 -2
  84. data/lib/webgen/tag/metainfo.rb +1 -1
  85. data/lib/webgen/tag/relocatable.rb +17 -21
  86. data/lib/webgen/tag/tikz.rb +7 -10
  87. data/lib/webgen/tree.rb +7 -7
  88. data/lib/webgen/version.rb +1 -1
  89. data/lib/webgen/website.rb +32 -2
  90. data/misc/default.css +8 -2
  91. data/misc/default.template +2 -2
  92. data/misc/logo.svg +313 -0
  93. data/misc/style.page +1 -1
  94. data/test/helper.rb +18 -2
  95. data/test/test_cli.rb +104 -0
  96. data/test/test_common_sitemap.rb +1 -1
  97. data/test/test_contentprocessor.rb +8 -2
  98. data/test/test_contentprocessor_blocks.rb +17 -8
  99. data/test/test_contentprocessor_builder.rb +13 -2
  100. data/test/test_contentprocessor_erb.rb +9 -3
  101. data/test/test_contentprocessor_erubis.rb +9 -3
  102. data/test/test_contentprocessor_fragments.rb +12 -11
  103. data/test/test_contentprocessor_haml.rb +11 -2
  104. data/test/test_contentprocessor_head.rb +44 -0
  105. data/test/test_contentprocessor_maruku.rb +5 -1
  106. data/test/test_contentprocessor_rdiscount.rb +4 -0
  107. data/test/test_contentprocessor_rdoc.rb +4 -0
  108. data/test/test_contentprocessor_redcloth.rb +5 -1
  109. data/test/test_contentprocessor_sass.rb +8 -2
  110. data/test/test_contentprocessor_tags.rb +22 -7
  111. data/test/test_contentprocessor_tidy.rb +34 -0
  112. data/test/test_context.rb +39 -0
  113. data/test/test_error.rb +85 -0
  114. data/test/test_node.rb +57 -21
  115. data/test/test_page.rb +23 -5
  116. data/test/test_path.rb +120 -64
  117. data/test/test_source_filesystem.rb +1 -1
  118. data/test/test_source_stacked.rb +19 -6
  119. data/test/test_sourcehandler_base.rb +63 -50
  120. data/test/test_sourcehandler_copy.rb +6 -6
  121. data/test/test_sourcehandler_directory.rb +8 -12
  122. data/test/test_sourcehandler_feed.rb +15 -7
  123. data/test/test_sourcehandler_fragment.rb +6 -5
  124. data/test/test_sourcehandler_main.rb +39 -0
  125. data/test/test_sourcehandler_memory.rb +4 -4
  126. data/test/test_sourcehandler_metainfo.rb +20 -11
  127. data/test/test_sourcehandler_page.rb +10 -10
  128. data/test/test_sourcehandler_sitemap.rb +24 -5
  129. data/test/test_sourcehandler_template.rb +18 -15
  130. data/test/test_sourcehandler_virtual.rb +9 -5
  131. data/test/test_tag_base.rb +6 -29
  132. data/test/test_tag_coderay.rb +16 -3
  133. data/test/test_tag_executecommand.rb +2 -2
  134. data/test/test_tag_link.rb +5 -4
  135. data/test/test_tag_menu.rb +15 -15
  136. data/test/test_tag_metainfo.rb +1 -0
  137. data/test/test_tag_relocatable.rb +3 -2
  138. data/test/test_tag_tikz.rb +5 -5
  139. data/test/test_tree.rb +8 -8
  140. data/test/test_website.rb +15 -0
  141. metadata +21 -14
  142. data/test/test_common.rb +0 -18
@@ -163,12 +163,33 @@ configuration options) and/or how to use it in a webgen tag (for tag configurati
163
163
 
164
164
  * Example for setting the option in the configuration file:
165
165
 
166
- sources: [[/, Webgen::Source::FileSystem, src], [/, Webgen::Source::FileSystem, /mnt/pictures, **/*.jpg]
166
+ sources: [[/, Webgen::Source::FileSystem, src], [/, Webgen::Source::FileSystem, /mnt/pictures, **/*.jpg]]
167
167
 
168
168
  Also have a look at the [file system source documentation]({relocatable:
169
169
  source/filesystem.html}) for more examples!
170
170
 
171
171
 
172
+ * ### passive\_sources
173
+
174
+ Specifies one or more sources which are not actively used during the node creation time, ie. no
175
+ nodes are created from these sources by default. Instead, they lie dormant until later and are
176
+ only used if resolving a path fails. Then it is checked if a passive source for the requested
177
+ path exists and if so, a node is created from it. If a node created from a passive source is not
178
+ used anymore, it is automatically deleted.
179
+
180
+ * Syntax: `[[MOUNT POINT, NAME, ARG1, ARG2, ...], ...]` where `MOUNT POINT` is the path under
181
+ which the source should be mounted, `NAME` is the name of the source class (for example,
182
+ `Webgen::Source::FileSystem`) and `ARG1`, `ARG2` and so on are the parameters for the source
183
+ class. The supported parameters can be found in the documentation for each source class.
184
+
185
+ <%= show_default['passive_sources'] %>
186
+
187
+ * Example for setting the option in the configuration file:
188
+
189
+ passive_sources:
190
+ [[/, Webgen::Source::Resource, webgen-passive-sources], [/, Webgen::Source::FileSystem, /mnt/pictures, **/*.jpg]]
191
+
192
+
172
193
  * ### output
173
194
 
174
195
  Specifies the output class that should be used for writing out the generated paths.
@@ -184,6 +205,20 @@ configuration options) and/or how to use it in a webgen tag (for tag configurati
184
205
  output: [Webgen::Output::FileSystem, custom_out]
185
206
 
186
207
 
208
+ * ### output.do\_deletion
209
+
210
+ Specifies whether the output class should delete generated paths once the source paths are not
211
+ available anymore.
212
+
213
+ * Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
214
+
215
+ <%= show_default['output.do_deletion'] %>
216
+
217
+ * Example for setting the option in the configuration file:
218
+
219
+ output.do_deletion: true
220
+
221
+
187
222
  * ### sourcehandler.patterns
188
223
 
189
224
  Specifies the path patterns that are used by the individual source handlers. This configuration
@@ -295,7 +330,7 @@ configuration options) and/or how to use it in a webgen tag (for tag configurati
295
330
 
296
331
  default_meta_info:
297
332
  :all:
298
- output_path_style: [:parent, :cnbase, :lang, :ext]
333
+ output_path_style: [:parent, :basename, :lang, :ext]
299
334
  Webgen::SourceHandler::Page:
300
335
  in_menu: true
301
336
 
@@ -319,12 +354,14 @@ configuration options) and/or how to use it in a webgen tag (for tag configurati
319
354
  * ### contentprocessor.map
320
355
 
321
356
  This configuration option maps short names for content processor to their class names. The short
322
- names are used, for example, in the procesing pipeline of a content block of a file in Webgen
357
+ names are used, for example, in the processing pipeline of a content block of a file in Webgen
323
358
  Page Format. This configuration option is normally only used by extensions to register the short
324
359
  name of a content processor!
325
360
 
326
- * Syntax: `\{SHORT: NAME, ...}` where `SHORT` is the short name of the content processor class
327
- `NAME`.
361
+ * Syntax: `\{SHORT: NAME, SHORT: [NAME, TYPE], ...}` where `SHORT` is the short name of the
362
+ content processor class `NAME`. The second form allows one to additionally specify the type
363
+ `TYPE` of the content processor which has to be `:binary` or `:text`. If the first form is
364
+ used, then the type defaults to `:text`.
328
365
 
329
366
  <%= show_default['contentprocessor.map'] %>
330
367
 
@@ -332,6 +369,7 @@ configuration options) and/or how to use it in a webgen tag (for tag configurati
332
369
 
333
370
  config = Webgen::WebsiteAccess.website.config
334
371
  config['contentprocessor.map']['newcp'] = 'Extension::MyNewContentProcessor'
372
+ config['contentprocessor.map']['newcp'] = ['Extension::MyNewContentProcessor', :binary]
335
373
 
336
374
 
337
375
  * ### contentprocessor.erubis.use\_pi
@@ -407,6 +445,20 @@ configuration options) and/or how to use it in a webgen tag (for tag configurati
407
445
  config['contentprocessor.tags.map']['highlight'] = 'Extension::MyHighlightingTag'
408
446
 
409
447
 
448
+ * ### contentprocessor.tidy.options
449
+
450
+ This configuration option can be used to set the command line options for the `tidy` program
451
+ which is used by the [content processor `tidy`]({relocatable: contentprocessor/tidy.html}).
452
+
453
+ * Syntax: `STRING` where `STRING` is the string holding the command line options.
454
+
455
+ <%= show_default['contentprocessor.tidy.options'] %>
456
+
457
+ * Example for setting the option in the configuration file:
458
+
459
+ contentprocessor.tidy.options: "-utf8"
460
+
461
+
410
462
  ## Tag Specific Options
411
463
 
412
464
  These options are not normally set in the configuration file but given directly as options to the
@@ -614,6 +666,32 @@ shows how to set the option in the configuration file.
614
666
  tabulator == 4 spaces: \{coderay:: {lang: ruby, tab_width: 4}}puts 5 + 5{coderay}
615
667
 
616
668
 
669
+ * ### tag.coderay.css
670
+
671
+ Specifies how the highlighted code should be styled.
672
+
673
+ If set to `style`, the CSS style attributes are set directly on the various HTML elements.
674
+
675
+ If set to `class`, only classes are set on the HTML elements and a default external stylesheet
676
+ is used - the [content processor head]({relocatable: contentprocessor/head.html}) is needed for
677
+ this to work.
678
+
679
+ If set to `other`, only classes are set like with the `class` value but no default external
680
+ stylesheet is used. You have to provide the styles yourself.
681
+
682
+ * Syntax: `STYLE` where `STYLE` is either `style`, `css` or `other`.
683
+
684
+ <%= show_default['tag.coderay.css'] %>
685
+
686
+ * Example for setting the option in the configuration file:
687
+
688
+ tag.coderay.css: style
689
+
690
+ Example for setting the option directly in a tag:
691
+
692
+ with external stylesheet: \{coderay:: {lang: ruby, css: class}}puts 5 + 5{coderay}
693
+
694
+
617
695
  * ### tag.date.format
618
696
 
619
697
  Specifies the format that should be used for formatting the current date. The format string
@@ -8,7 +8,7 @@ extension, be it a source handler, a tag or any other extension. Each meta infor
8
8
  follows the same pattern:
9
9
 
10
10
  * First the type of the value and an example value are listed.
11
- * Then the paths for which this item is valid are listed.
11
+ * Then the paths for which this item is useful are listed.
12
12
  * And at last follows a detailed description.
13
13
 
14
14
 
@@ -110,7 +110,7 @@ information for nodes created by them.
110
110
 
111
111
  {:miref}
112
112
  * String: `de`
113
- * Page files
113
+ * Any
114
114
 
115
115
  Sets the language for the path. Has to be a valid ISO-639-1/2 character code for the language. This
116
116
  meta information needs to be set before a node gets created.
@@ -124,6 +124,16 @@ meta information needs to be set before a node gets created.
124
124
  Specifies additional attribute-value pairs (in form of a Hash) that should be added to a link to the
125
125
  path.
126
126
 
127
+ ### meta
128
+
129
+ {:miref}
130
+ * Hash: `\{author: Thomas Leitner, generator: My program}`
131
+ * Page files
132
+
133
+ Specifies names and values for `<meta>` HTML tags. These key-value pairs are then properly escaped
134
+ and inserted into the output file by [`ContentProcessor::Head`]({relocatable:
135
+ contentprocessor/head.html}).
136
+
127
137
  ### modified\_at
128
138
 
129
139
  {:miref}
@@ -160,11 +170,11 @@ Controls whether the index path should appear in a breadcrumb trail despite the
160
170
  ### output\_path\_style
161
171
 
162
172
  {:miref}
163
- * Array: `[:parent, :cnbase, [., :lang], .html]`
173
+ * Array: `[:parent, :basename, [., :lang], .html]`
164
174
  * Any
165
175
 
166
176
  Sets a custom output path style for the specified path. The basename is substituted for the value
167
- `:cnbase` and the language for the value `:lang`. Strings are used verbatim. If `:lang` is specified
177
+ `:basename` and the language for the value `:lang`. Strings are used verbatim. If `:lang` is specified
168
178
  in a sub-array, the whole sub-array is omitted, if the configuration option
169
179
  `sourcehandler.default_lang_in_output_path` is false. For more and detailed information, have look
170
180
  at the [output path creation section]({relocatable: manual.html#source-output}) of the manual!
@@ -220,3 +230,13 @@ Sets the template for the page/template file overriding the default value. If se
220
230
  * Any
221
231
 
222
232
  Sets the title for the path.
233
+
234
+ ### used\_nodes
235
+
236
+ {:miref}
237
+ * Array: `[*.en.html, test.de.html]`
238
+ * Any
239
+
240
+ The value of this meta information needs to be an array of alcn patterns. All nodes that match at
241
+ least one of the patterns are considered to be dependencies of the node. Therefore if any of these
242
+ nodes change, the node will be regenerated, too.
@@ -17,10 +17,10 @@ browser:
17
17
 
18
18
  <%
19
19
  context.content_node.tree.node_access[:alcn].select do |name, node|
20
- node.is_directory? && node.parent == context.content_node.tree[File.join(context.content_node.parent.absolute_lcn, '/website_styles')]
20
+ node.is_directory? && node.parent == context.content_node.tree[File.join(context.content_node.parent.alcn, '/website_styles/')]
21
21
  end.sort.each do |name, node|
22
22
  %>
23
- <h2 id="<%= node.cn %>"><%= node.cn %></h2>
23
+ <h2 id="<%= node.cn.chomp('/') %>"><%= node.cn %></h2>
24
24
  <div class="website-styles">
25
25
  <%= context.dest_node.link_to(node, :link_text => "Full window version") %>
26
26
  <object type="text/html" data="<%= context.dest_node.route_to(node) %>">Nothing</object>
@@ -7,12 +7,6 @@ This source handler automatically generates an atom or RSS feed for a set of fil
7
7
  [Webgen Page Format]({relocatable: ../webgen_page_format.html}) (the format which is also used for
8
8
  page files).
9
9
 
10
- > This extension is only available if you have installed the [feedtools][1] library. The preferred
11
- > way to do this is via Rubygems:
12
- >
13
- > gem install feedtools
14
- {.warning}
15
-
16
10
  The following meta information keys are supported:
17
11
 
18
12
  * `entries` (MANDATORY)
@@ -31,11 +25,13 @@ The following meta information keys are supported:
31
25
 
32
26
  * `atom` (OPTIONAL)
33
27
 
34
- An atom feed is generated if this key is set to `true`. Defaults to `true`.
28
+ An atom feed is generated if this key is set to `true`. Defaults to `true`. The generated file
29
+ name derives from the feed file name but the extension is changed to `atom`.
35
30
 
36
31
  * `rss` (OPTIONAL)
37
32
 
38
- A RSS feed is generated if this key is set to `true`. Defaults to `true`.
33
+ A RSS feed is generated if this key is set to `true`. Defaults to `true`. The generated file
34
+ name derives from the feed file name but the extension is changed to `rss`.
39
35
 
40
36
  * `rss_version` (OPTIONAL)
41
37
 
@@ -98,8 +94,10 @@ The following meta information keys of page files are used if they are specified
98
94
 
99
95
  The URL of the homepage of the author. Only used if the `author` meta information is also set.
100
96
 
101
- The default implementation supports the generation of atom and RSS feeds. You can override the
102
- default generation mechanism by adding an `atom_template` and/or `rss_template` block in the feed
103
- file which are then used to generate the atom or the RSS feed respectively.
104
-
105
- [1]: http://sporkmonger.com/projects/feedtools
97
+ The default implementation supports the generation of atom and RSS feeds by using templates shipped
98
+ with webgen (the extension `feed` is changed to `atom` for atom feeds and to `rss` for rss feeds).
99
+ The default templates are located under the ALCNs `/templates/atom_feed.template` and
100
+ `/templates/rss_feed.template` and are automatically created and used if no such paths exist in the
101
+ webgen website. You can also override the default generation mechanism on a file per file basis by
102
+ adding an `atom_template` and/or `rss_template` block in the feed file which are then used to
103
+ generate the atom or the RSS feed respectively.
@@ -13,16 +13,21 @@ This source handler provides the ability to set meta information for any path. I
13
13
  * `alcn`: This block specifies meta information for nodes and this meta information is applied
14
14
  directly after a node has been created. When specifying patterns, remember that the patterns are
15
15
  matched against absolute localized canonical names! So you always need to take the language part
16
- into account, ie. `/index.html` won't match but `/index.en.html`.
16
+ into account, ie. `/index.html` won't match but `/index.en.html` will.
17
17
 
18
18
  When no name is specified in the meta information file, the first block is assumed to be the `paths`
19
19
  block and the second block is assumed to be the `alcn` block. The format of the two blocks is the
20
20
  same: they need to be in YAML format and provide a hash with path patterns as keys and the
21
- to-be-assigned meta information as values. This is best showed in an example:
21
+ to-be-assigned meta information as values. The patterns can be normal file system paths or node
22
+ (a)lcns but you can also use some special characters like `*` (match any file), `**` (match
23
+ recursively or expansively) and `?` (match a single character). You can find the full information in
24
+ the documentation for [File.fnmatch].
25
+
26
+ All this is best showed in an example:
22
27
 
23
28
  --- name:paths
24
29
  /**/index.page:
25
- output_path_style: [:parent, :cnbase, :ext, [., :lang]]
30
+ output_path_style: [:parent, :basename, :ext, [., :lang]]
26
31
 
27
32
  mypic.jpg:
28
33
  in_menu: true
@@ -39,3 +44,5 @@ second form is taken relative to the directory in which the meta information fil
39
44
 
40
45
  And last but not least, all nodes with a localized canonical name of `index.en.html` will show up in
41
46
  the menu (again, notice that the pattern is relative).
47
+
48
+ [File.fnmatch]: http://ruby-doc.org/core/classes/File.html#M002603
@@ -3,10 +3,10 @@ title: Webgen::SourceHandler::Page
3
3
  ---
4
4
  ## Description
5
5
 
6
- This source handler uses page files which are used to specify the actual content for the
7
- website. These files are written using [Webgen Page Format]({relocatable:
8
- ../webgen_page_format.html}). Therefore they contain the content for the web page and, optionally,
9
- meta information.
6
+ This source handler uses page files which are used to specify the actual content for the website.
7
+ These files are written using [Webgen Page Format]({relocatable: ../webgen_page_format.html}).
8
+ Therefore they contain the content for the web page and, optionally, meta information. The extension
9
+ `page` is changed to `html` for the output file and canonical names.
10
10
 
11
11
  *In contrast* to other handled files, page files can never be unlocalized! If they have no language
12
12
  set, the default language specified using the configuration option `website.lang` is used. This
@@ -5,13 +5,8 @@ title: Webgen::SourceHandler::Sitemap
5
5
 
6
6
  This source handler automatically generates a sitemap based on the specification of
7
7
  [sitemaps.org](http://sitemaps.org) from a file in [Webgen Page Format]({relocatable:
8
- ../webgen_page_format.html}).
9
-
10
- > This extension can only be used if you have installed the [builder](http://builder.rubyforge.org)
11
- > library. The preferred way to do this is via Rubygems:
12
- >
13
- > gem install builder
14
- {.warning}
8
+ ../webgen_page_format.html}). The output and canonical names have the extension `xml` instead of
9
+ `sitemap`.
15
10
 
16
11
  The following meta information keys are supported:
17
12
 
@@ -44,3 +39,9 @@ The following meta information keys of files are used if they are specified:
44
39
  * `priority`
45
40
 
46
41
  The priority of the file in respect to the other files.
42
+
43
+ The generation of the sitemap is done via a template and the template used needs to be located under
44
+ the ALCN `/templates/sitemap.template`. This default template is automatically created and used if
45
+ no such path exists in the webgen website. You can also override the default generation mechanism on
46
+ a file per file basis by adding a `template` block in the sitemap file which is then used to generate
47
+ the sitemap.
@@ -8,6 +8,7 @@ used_options:
8
8
  - tag.coderay.line_number_start
9
9
  - tag.coderay.bold_every
10
10
  - tag.coderay.tab_width
11
+ - tag.coderay.css
11
12
  ---
12
13
  ## Description
13
14
 
@@ -15,6 +16,9 @@ This tag applies syntax highlighting to its body by using the [coderay][1] libra
15
16
  to highlight many different languages (see `tag.coderay.lang` documentation). The body of the tag
16
17
  specifies what should be highlighted.
17
18
 
19
+ By using the configuration option `tag.coderay.css` you can specify whether you want to have inline
20
+ styles, the default external stylesheet file or your own stylesheet file.
21
+
18
22
  > It is easy to include and highlight an entire file by combining this tag with the `include_file` tag:
19
23
  >
20
24
  > \{coderay:: ruby}{include_file: test.rb}{coderay}
@@ -43,7 +47,7 @@ specifies what should be highlighted.
43
47
  <% end %>
44
48
  </tr>
45
49
  <tr>
46
- <td>\{coderay:: {lang: ruby, wrap: span}}puts 5+5{coderay}</td>
47
- <td><code>{coderay:: {lang: ruby, wrap: span}}puts 5+5{coderay}</code></td>
50
+ <td>\{coderay:: {lang: ruby, wrap: span, css: class}}puts 5+5{coderay}</td>
51
+ <td><code>{coderay:: {lang: ruby, wrap: span, css: class}}puts 5+5{coderay}</code></td>
48
52
  </tr>
49
53
  </table>
@@ -8,7 +8,7 @@ used_options:
8
8
  ## Description
9
9
 
10
10
  The include file tag is used to include the content of a file. The filename needs to be specified
11
- relative to the website directory or an absolute filename.
11
+ relative to the website directory or as an absolute filename.
12
12
 
13
13
  > By surrounding the include file tag with a syntax highlighting tag it is possible to highlight the
14
14
  > contents of a file.
@@ -27,6 +27,9 @@ generating an in-page content menu of all the header sections.
27
27
 
28
28
  > When using the option value `files` for `tag.menu.used_nodes`, all nodes which are only in the
29
29
  > menu because they have fragment nodes beneath them are not included in the menu.
30
+ >
31
+ > However, when using the value `all` for `tag.menu.used_nodes`, some nodes which have `in_menu` set
32
+ > to `false` may appear in the menu if they have fragments beneath them that are in the menu!
30
33
  {.important}
31
34
 
32
35
  The rendered menu consists of `ul` and `li` tags and the links (or `span` elements) to the menu
@@ -44,7 +44,7 @@ module Webgen::CLI
44
44
  # Apply the style specified in <tt>args[0]</tt> to the webgen website.
45
45
  def execute(args)
46
46
  wm = Webgen::WebsiteManager.new(commandparser.directory)
47
- if !File.directory?(commandparser.directory)
47
+ if !File.directory?(wm.website.directory)
48
48
  raise "You need to specify a valid webgen website directory!"
49
49
  elsif args.length == 0
50
50
  raise OptionParser::MissingArgument.new('STYLE')
@@ -11,8 +11,8 @@ module Webgen::CLI
11
11
  # Provides methods for other CLI classes for formatting text in a consistent manner.
12
12
  class Utils
13
13
 
14
- USE_ANSI_COLORS = !Config::CONFIG['arch'].include?('mswin32')
15
- DEFAULT_WIDTH = if Config::CONFIG['arch'].include?('mswin32')
14
+ USE_ANSI_COLORS = Config::CONFIG['host_os'] !~ /mswin|mingw/
15
+ DEFAULT_WIDTH = if Config::CONFIG['host_os'] =~ /mswin|mingw/
16
16
  72
17
17
  else
18
18
  ((size = %x{stty size 2>/dev/null}).length > 0 ? size.split.last.to_i : 72) rescue 72
@@ -1,7 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require 'pathname'
4
-
5
3
  module Webgen
6
4
 
7
5
  # Namespace for classes and methods that provide common functionality.
@@ -9,13 +7,6 @@ module Webgen
9
7
 
10
8
  autoload :Sitemap, 'webgen/common/sitemap'
11
9
 
12
- # Make the given +path+ absolute by prepending the absolute path +base+ if necessary. Also
13
- # resolves all '..' and '.' references in +path+.
14
- def self.absolute_path(path, base)
15
- raise(ArgumentError, 'base has to be an absolute path') unless base =~ /\//
16
- Pathname.new(path =~ /^\// ? path : File.join(base, path)).cleanpath.to_s
17
- end
18
-
19
10
  end
20
11
 
21
12
  end
@@ -18,8 +18,13 @@ module Webgen
18
18
  #
19
19
  # After writing the content processor class, one needs to add it to the
20
20
  # <tt>contentprocessor.map</tt> hash so that it is used by webgen. The key for the entry needs to
21
- # be a short name without special characters or spaces and the value is the class name, not as
22
- # constant but as a string.
21
+ # be a short name without special characters or spaces and the value can be:
22
+ #
23
+ # * the class name, not as constant but as a string - then this content processor is assumed to
24
+ # work with textual data -, or
25
+ #
26
+ # * an array with the class name like before and the type, which needs to be <tt>:binary</tt> or
27
+ # <tt>:text</tt>.
23
28
  #
24
29
  # == Sample Content Processor
25
30
  #
@@ -52,6 +57,8 @@ module Webgen
52
57
  # end
53
58
  #
54
59
  # WebsiteAccess.website.config['contentprocessor.map']['replacer'] = 'SampleProcessor'
60
+ # # Or one could equally write
61
+ # # WebsiteAccess.website.config['contentprocessor.map']['replacer'] = ['SampleProcessor', :text]
55
62
  #
56
63
  module ContentProcessor
57
64
 
@@ -67,6 +74,8 @@ module Webgen
67
74
  autoload :Erubis, 'webgen/contentprocessor/erubis'
68
75
  autoload :RDiscount, 'webgen/contentprocessor/rdiscount'
69
76
  autoload :Fragments, 'webgen/contentprocessor/fragments'
77
+ autoload :Head, 'webgen/contentprocessor/head'
78
+ autoload :Tidy, 'webgen/contentprocessor/tidy'
70
79
 
71
80
  # Return the list of all available content processors.
72
81
  def self.list
@@ -75,10 +84,16 @@ module Webgen
75
84
 
76
85
  # Return the content processor object identified by +name+.
77
86
  def self.for_name(name)
78
- klass = WebsiteAccess.website.config['contentprocessor.map'][name]
87
+ klass, cp_type = WebsiteAccess.website.config['contentprocessor.map'][name]
79
88
  klass.nil? ? nil : WebsiteAccess.website.cache.instance(klass)
80
89
  end
81
90
 
91
+ # Return whether the content processor identified by +name+ is processing binary data.
92
+ def self.is_binary?(name)
93
+ WebsiteAccess.website.config['contentprocessor.map'][name].kind_of?(Array) &&
94
+ WebsiteAccess.website.config['contentprocessor.map'][name].last == :binary
95
+ end
96
+
82
97
  # Helper class for accessing content processors in a Webgen::Context object.
83
98
  class AccessHash
84
99