webgen 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. data/Rakefile +15 -4
  2. data/VERSION +1 -1
  3. data/data/webgen/webgui/controller/main.rb +1 -1
  4. data/data/webgen/website_skeleton/ext/init.rb +6 -0
  5. data/data/webgen/website_styles/1024px/src/default.css +188 -188
  6. data/data/webgen/website_styles/1024px/src/default.template +51 -51
  7. data/data/webgen/website_styles/andreas00/src/default.template +1 -1
  8. data/data/webgen/website_styles/andreas01/src/default.css +8 -8
  9. data/data/webgen/website_styles/andreas01/src/default.template +1 -1
  10. data/data/webgen/website_styles/andreas03/src/default.css +3 -3
  11. data/data/webgen/website_styles/andreas03/src/default.template +2 -2
  12. data/data/webgen/website_styles/andreas04/src/default.css +1 -1
  13. data/data/webgen/website_styles/andreas05/src/default.css +3 -3
  14. data/data/webgen/website_styles/andreas05/src/default.template +26 -26
  15. data/data/webgen/website_styles/andreas06/src/default.css +6 -6
  16. data/data/webgen/website_styles/andreas06/src/default.template +1 -1
  17. data/data/webgen/website_styles/andreas07/src/default.css +6 -6
  18. data/data/webgen/website_styles/andreas08/src/default.css +7 -7
  19. data/data/webgen/website_styles/andreas08/src/default.template +2 -2
  20. data/data/webgen/website_styles/andreas09/src/default.css +3 -3
  21. data/data/webgen/website_styles/andreas09/src/default.template +1 -1
  22. data/data/webgen/website_styles/simple/src/default.css +84 -84
  23. data/data/webgen/website_styles/simple/src/default.template +1 -1
  24. data/doc/index.page +27 -12
  25. data/doc/manual.page +52 -10
  26. data/doc/reference_configuration.page +108 -52
  27. data/doc/reference_metainfo.page +77 -2
  28. data/doc/sourcehandler/feed.page +82 -0
  29. data/doc/sourcehandler/metainfo.page +3 -2
  30. data/doc/sourcehandler/sitemap.page +46 -0
  31. data/doc/tag.template +2 -3
  32. data/doc/tag/breadcrumbtrail.page +11 -3
  33. data/doc/tag/menu.page +6 -4
  34. data/doc/tag/sitemap.page +31 -0
  35. data/doc/upgrading.page +67 -0
  36. data/lib/webgen/cli/utils.rb +4 -4
  37. data/lib/webgen/cli/webgui_command.rb +2 -1
  38. data/lib/webgen/common.rb +10 -0
  39. data/lib/webgen/common/sitemap.rb +76 -0
  40. data/lib/webgen/configuration.rb +64 -1
  41. data/lib/webgen/contentprocessor.rb +1 -1
  42. data/lib/webgen/contentprocessor/builder.rb +1 -1
  43. data/lib/webgen/contentprocessor/erb.rb +1 -1
  44. data/lib/webgen/contentprocessor/haml.rb +1 -1
  45. data/lib/webgen/contentprocessor/maruku.rb +1 -1
  46. data/lib/webgen/contentprocessor/sass.rb +1 -1
  47. data/lib/webgen/coreext.rb +10 -0
  48. data/lib/webgen/default_config.rb +35 -4
  49. data/lib/webgen/node.rb +12 -6
  50. data/lib/webgen/page.rb +1 -1
  51. data/lib/webgen/path.rb +1 -1
  52. data/lib/webgen/sourcehandler.rb +11 -6
  53. data/lib/webgen/sourcehandler/base.rb +5 -2
  54. data/lib/webgen/sourcehandler/feed.rb +121 -0
  55. data/lib/webgen/sourcehandler/metainfo.rb +22 -13
  56. data/lib/webgen/sourcehandler/page.rb +5 -3
  57. data/lib/webgen/sourcehandler/sitemap.rb +60 -0
  58. data/lib/webgen/sourcehandler/template.rb +5 -1
  59. data/lib/webgen/sourcehandler/virtual.rb +1 -0
  60. data/lib/webgen/tag.rb +1 -0
  61. data/lib/webgen/tag/breadcrumbtrail.rb +42 -10
  62. data/lib/webgen/tag/langbar.rb +1 -1
  63. data/lib/webgen/tag/menu.rb +10 -14
  64. data/lib/webgen/tag/sitemap.rb +42 -0
  65. data/lib/webgen/tree.rb +1 -1
  66. data/lib/webgen/version.rb +1 -1
  67. data/lib/webgen/website.rb +5 -6
  68. data/misc/default.css +6 -2
  69. data/test/helper.rb +13 -0
  70. data/test/test_common_sitemap.rb +56 -0
  71. data/test/test_configuration.rb +24 -0
  72. data/test/test_contentprocessor_maruku.rb +4 -1
  73. data/test/test_node.rb +4 -1
  74. data/test/test_page.rb +11 -5
  75. data/test/test_path.rb +10 -10
  76. data/test/test_sourcehandler_feed.rb +74 -0
  77. data/test/test_sourcehandler_metainfo.rb +26 -12
  78. data/test/test_sourcehandler_page.rb +1 -0
  79. data/test/test_sourcehandler_sitemap.rb +47 -0
  80. data/test/test_sourcehandler_template.rb +3 -0
  81. data/test/test_sourcehandler_virtual.rb +4 -1
  82. data/test/test_tag_breadcrumbtrail.rb +33 -23
  83. data/test/test_tag_menu.rb +24 -25
  84. data/test/test_tag_sitemap.rb +44 -0
  85. metadata +37 -4
@@ -11,8 +11,26 @@ follows the same pattern:
11
11
  * Then the paths for which this item is valid are listed.
12
12
  * And at last follows a detailed description.
13
13
 
14
+
14
15
  {:miref: .meta-information-ref}
15
16
 
17
+ ### author
18
+
19
+ {:miref}
20
+ * String: `Thomas Leitner`
21
+ * Any
22
+
23
+ Sets the author of the path. This information is used, for example, by Webgen::SourceHandler::Feed.
24
+
25
+ ### author\_url
26
+
27
+ {:miref}
28
+ * String: `http://webgen.rubyforge.org`
29
+ * Any where `author` is also set
30
+
31
+ Sets the homepage of the author of the path. This information is used, for example, by
32
+ Webgen::SourceHandler::Feed and normally only when `author` is also set.
33
+
16
34
  ### blocks
17
35
 
18
36
  {:miref}
@@ -23,6 +41,34 @@ Specifies the default names and additional options for the blocks. The special k
23
41
  to set default options for all blocks. Specific options for (or the name of) a block can be set by
24
42
  using the block index as key (numbering starts from one).
25
43
 
44
+ ### change\_freq
45
+
46
+ {:miref}
47
+ * String: `hourly`
48
+ * Any
49
+
50
+ Sets the change frequency of the page. This information is used, for example, by the sitemap source
51
+ handler. You can use the following values for this key: `hourly, daily, weekly, monthly, yearly,
52
+ never`.
53
+
54
+ ### created\_at
55
+
56
+ {:miref}
57
+ * Time: `2008-08-14 10:25:34 +02:00`
58
+ * Any
59
+
60
+ Sets the time when the path was created. This information cannot automatically be derived for paths
61
+ provided by Webgen::Source::FileSystem, so this has to be set manually.
62
+
63
+ ### draft
64
+
65
+ {:miref}
66
+ * Boolean: `true`
67
+ * Any
68
+
69
+ If this meta information is set on a path, no node will be created from it. This is useful to add
70
+ content to a website which should only be used later on.
71
+
26
72
  ### fragments\_in\_menu
27
73
 
28
74
  {:miref}
@@ -47,6 +93,15 @@ Sets the directory index path for the directory overriding the default value.
47
93
 
48
94
  Specifies if the path should appear in menus.
49
95
 
96
+ ### kind
97
+
98
+ {:miref}
99
+ * String: `page`
100
+ * Any
101
+
102
+ Specifies the kind of the path. Some source handlers define a default value for this meta
103
+ information for nodes created by them.
104
+
50
105
  ### lang
51
106
 
52
107
  {:miref}
@@ -65,15 +120,26 @@ meta information needs to be set before a node gets created.
65
120
  Specifies additional attribute-value pairs (in form of a Hash) that should be added to a link to the
66
121
  path.
67
122
 
123
+ ### modified\_at
124
+
125
+ {:miref}
126
+ * Time: `2008-08-14 10:25:34 +02:00`
127
+ * Any
128
+
129
+ Sets the time when the path was last modified. This information is automatically set for paths
130
+ provided by Webgen::Source::FileSystem but can be overridden by setting it manually. If not set to a
131
+ valid time, the time when webgen is executed is used for this meta information.
132
+
68
133
  ### no\_output
69
134
 
70
135
  {:miref}
71
136
  * Boolean: `true`
72
137
  * Any
73
138
 
74
- Specifies whether an output path for this node gets written or not.
139
+ Specifies whether an output path for the node should be written or not. This differs from `draft`
140
+ that a node for the path gets created nonetheless.
75
141
 
76
- ### omit_index_path
142
+ ### omit\_index\_path
77
143
 
78
144
  {:miref}
79
145
  * Boolean: `false`
@@ -97,6 +163,15 @@ in a sub-array, the whole sub-array is omitted, if the configuration option
97
163
  > only useful, for example, in the `paths` block of a meta information backing file.
98
164
  {.exclamation}
99
165
 
166
+ ### priority
167
+
168
+ {:miref}
169
+ * Float: `0.5`
170
+ * Any
171
+
172
+ Specifies the priority of this file in respect to all the other files of the website. This
173
+ information is used, for example, by the sitemap source handler.
174
+
100
175
  ### routed\_title
101
176
 
102
177
  {:miref}
@@ -0,0 +1,82 @@
1
+ ---
2
+ title: Webgen::SourceHandler::Feed
3
+ ---
4
+ ## Description
5
+
6
+ This source handler automatically generates an atom or RSS feed for a set of files from a file in
7
+ [Webgen Page Format]({relocatable: ../webgen_page_format.html}) (the format which is also used for
8
+ page files).
9
+
10
+ The following meta information keys are supported:
11
+
12
+ * `entries` (MANDATORY)
13
+
14
+ A LCN pattern (or an array of LCN patterns) which specify the page files that should be
15
+ used. Other matched files are excluded from the list.
16
+
17
+ * `number_of_entries` (OPTIONAL)
18
+
19
+ The number of entries that should be included in the feed. Defaults to 10.
20
+
21
+ * `atom` (OPTIONAL)
22
+
23
+ An atom feed is generated if this key is set to `true`. Defaults to `true`.
24
+
25
+ * `rss` (OPTIONAL)
26
+
27
+ A RSS feed is generated if this key is set to `true`. Defaults to `true`.
28
+
29
+ * `site_url` (MANDATORY)
30
+
31
+ The base url of the website for which the feed is generated.
32
+
33
+ * `author` (MANDATORY)
34
+
35
+ Specifies the author of the feed.
36
+
37
+ * `author_url` (OPTIONAL)
38
+
39
+ Specifies the URL of the homepage of the author.
40
+
41
+ * `title` (MANDATORY)
42
+
43
+ The title of the feed.
44
+
45
+ * `description` (OPTIONAL)
46
+
47
+ A short description of the feed.
48
+
49
+ * `created_at` (OPTIONAL)
50
+
51
+ The time at which this feed was created. Defaults to the current time if not set.
52
+
53
+ * `icon` (OPTIONAL)
54
+
55
+ The absolute localized canonical name of the feed's icon image.
56
+
57
+ The following meta information keys of page files are used if they are specified:
58
+
59
+ * `created_at`
60
+
61
+ The time at which the page file was created, used as the publication time.
62
+
63
+ * `modified_at`
64
+
65
+ The time at which the page file was last modified, used as the time at which this feed entry was
66
+ updated.
67
+
68
+ * `title`
69
+
70
+ The title of the page file, used as title of the feed entry.
71
+
72
+ * `author`
73
+
74
+ The name of the author of the page file, used as the author of the feed entry.
75
+
76
+ * `author_url`
77
+
78
+ The URL of the homepage of the author. Only used if the `author` meta information is also set.
79
+
80
+ The default implementation supports the generation of atom and RSS feeds. You can override the
81
+ default generation mechanism by adding an `atom_template` and/or `rss_template` block in the feed
82
+ file which are then used to generate the atom or the RSS feed respectively.
@@ -11,8 +11,9 @@ This source handler provides the ability to set meta information for any path. I
11
11
  path style. When specifying patterns, remember that the patterns are matched against paths!
12
12
 
13
13
  * `alcn`: This block specifies meta information for nodes and this meta information is applied
14
- directly after a node has been created. When specifying patterns, remember that the patterns
15
- are matched against absolute localized canonical names!
14
+ directly after a node has been created. When specifying patterns, remember that the patterns are
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
17
 
17
18
  When no name is specified in the meta information file, the first block is assumed to be the `paths`
18
19
  block and the second block is assumed to be the `alcn` block. The format of the two blocks is the
@@ -0,0 +1,46 @@
1
+ ---
2
+ title: Webgen::SourceHandler::Sitemap
3
+ ---
4
+ ## Description
5
+
6
+ This source handler automatically generates a sitemap based on the specification of
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
+ {.exclamation}
15
+
16
+ The following meta information keys are supported:
17
+
18
+ * `site_url` (MANDATORY)
19
+
20
+ The base url of the website for which the sitemap is generated.
21
+
22
+ * `default_change_freq` (OPTIONAL)
23
+
24
+ The default change frequency of a file.
25
+
26
+ * `default_priority` (OPTIONAL)
27
+
28
+ The default priority of a file.
29
+
30
+ You can also specify all common sitemap configuration options to customize the output of the source
31
+ handler.
32
+
33
+ The following meta information keys of files are used if they are specified:
34
+
35
+ * `modified_at`
36
+
37
+ The time at which the file was last modified, used as the time at which this feed entry was
38
+ updated.
39
+
40
+ * `change_freq`
41
+
42
+ The change frequency of the the file.
43
+
44
+ * `priority`
45
+
46
+ The priority of the file in respect to the other files.
@@ -8,14 +8,13 @@ The following tag names are registered for this tag class:
8
8
  map {|k,v| '`' + (k.kind_of?(Symbol) ? k.inspect : k.to_s) + '`'}.join(', ') %>
9
9
 
10
10
  <% if context.content_node['used_options'] %>
11
- This tag uses the following options (see [configuration option reference]({relocatable:
12
- reference_configuration.html}) for detailed information on the options):
11
+ This tag uses the following options:
13
12
 
14
13
  <%
15
14
  for option in context.content_node['used_options']
16
15
  temp = 'mandatory' if !context.website.config.meta_info[option][:mandatory].nil?
17
16
  temp += ' default' if context.website.config.meta_info[option][:mandatory] == 'default'
18
- %>* `<%= option %>` <%= temp ? '(' + temp + ')' : '' %>
17
+ %>* [`<%= option %>`]({relocatable: reference_configuration.html#<%= option.tr('.', '') %>}) <%= temp ? '(' + temp + ')' : '' %>
19
18
  <%
20
19
  temp = nil
21
20
  end
@@ -2,8 +2,9 @@
2
2
  title: Webgen::Tag::BreadcrumbTrail
3
3
  used_options:
4
4
  - tag.breadcrumbtrail.separator
5
- - tag.breadcrumbtrail.omit_last
6
5
  - tag.breadcrumbtrail.omit_index_path
6
+ - tag.breadcrumbtrail.start_level
7
+ - tag.breadcrumbtrail.end_level
7
8
  ---
8
9
  ## Description
9
10
 
@@ -11,6 +12,9 @@ The breadcrumb trail tag is used for displaying the hierarchy of the current pag
11
12
  the `tag.breadcrumbtrail.omit_index_path` option can be overridden for individual index paths by
12
13
  setting the meta information `omit_index_path` accordingly.
13
14
 
15
+ The amount of levels shown can be customized by using the options `tag.breadcrumbtrail.start_level`
16
+ and `tag.breadcrumbtrail.end_level`, see the examples below.
17
+
14
18
  ## Examples
15
19
 
16
20
  <table class="examples">
@@ -26,7 +30,11 @@ setting the meta information `omit_index_path` accordingly.
26
30
  <td>{breadcrumb_trail: {separator: " HELLO "}}</td>
27
31
  </tr>
28
32
  <tr>
29
- <td>\{breadcrumb_trail: {omit_last: true}}</td>
30
- <td>{breadcrumb_trail: {omit_last: true}}</td>
33
+ <td>\{breadcrumb_trail: {end_level: -2}}</td>
34
+ <td>{breadcrumb_trail: {end_level: -2}}</td>
35
+ </tr>
36
+ <tr>
37
+ <td>\{breadcrumb_trail: {start_level: 1}}</td>
38
+ <td>{breadcrumb_trail: {start_level: 1}}</td>
31
39
  </tr>
32
40
  </table>
@@ -28,16 +28,18 @@ generating an in-page content menu of all the header sections.
28
28
  > menu because they have fragment nodes beneath them are not included in the menu.
29
29
  {.exclamation}
30
30
 
31
- The rendered menu consists of `ul` and `li` tags and the links to the menu entries as well as a
32
- surrounding `div` tag. The `li` tags have special CSS classes set for styling. These CSS class names
33
- are as follows:
31
+ The rendered menu consists of `ul` and `li` tags and the links (or `span` elements) to the menu
32
+ entries . The `li` tags have special CSS classes set for styling. These CSS class names are as
33
+ follows:
34
34
 
35
+ * `webgen-menu-levelNUMBER`: Set on all menu items and can be used to style specific menu levels
36
+ only. `NUMBER` is replaced with the actual menu level, so the first level menu entries will get a
37
+ `webgen-menu-level1` class.
35
38
  * `webgen-menu-submenu`: Set if the menu item contains sub menu items.
36
39
  * `webgen-menu-submenu-inhierarchy`: Set if the menu item contains sub menu items and it is in the
37
40
  sub tree of the rendered node.
38
41
  * `webgen-menu-item-selected`: Set if the menu item corresponds to the rendered node.
39
42
 
40
-
41
43
  ## "Static" Menus
42
44
 
43
45
  It is also possible to define a "static" menu or to augment the dynamic menu with static entries by
@@ -0,0 +1,31 @@
1
+ ---
2
+ title: Webgen::Tag::Sitemap
3
+ used_options:
4
+ - common.sitemap.honor_in_menu
5
+ - common.sitemap.any_lang
6
+ - common.sitemap.used_kinds
7
+ ---
8
+ ## Description
9
+
10
+ This tag is used to display a site map of the current website. The used nodes can be customized by
11
+ setting the above mentioned configuration options accordingly.
12
+
13
+ ## Examples
14
+
15
+ <table class="examples">
16
+ <tr>
17
+ <th>Usage</th><th>Output</th>
18
+ </tr>
19
+ <tr>
20
+ <td>\{sitemap: }</td>
21
+ <td>{sitemap: }</td>
22
+ </tr>
23
+ <tr>
24
+ <td>\{sitemap: {honor_in_menu: true}}</td>
25
+ <td>{sitemap: {honor_in_menu: true}}</td>
26
+ </tr>
27
+ <tr>
28
+ <td>\{sitemap: {honor_in_menu: true, used_kinds: []}}</td>
29
+ <td>{sitemap: {honor_in_menu: true, used_kinds: []}}</td>
30
+ </tr>
31
+ </table>
@@ -0,0 +1,67 @@
1
+ ---
2
+ title: Upgrading from 0.4.x
3
+ ---
4
+ # Upgrading
5
+
6
+ Here are some helpers to make upgrading a webgen website from 0.4.x to 0.5.x more easy:
7
+
8
+ * **Files in [Webgen Page Format]({relocatable: webgen_page_format.html})**: Since the format of
9
+ these files changed a little bit you may need to adapt all your files that use it, that is
10
+ primarily page and template files. The main change in the format was a different use of the block
11
+ separator line. Whereas before you would write
12
+
13
+ --- content, textile
14
+
15
+ for specifying the name of the block and its processor, you now can specify any number of
16
+ options. Two options are currently used by webgen: `name` and `pipeline`. So you could change the
17
+ name and the processing pipeline of a block by using a block start line like:
18
+
19
+ --- name:other pipeline:tags,maruku,blocks
20
+
21
+ * **Block inclusion in template/page files**: The way how named blocks are included has
22
+ changed. This feature is now provided by the content processor [blocks]({relocatable:
23
+ contentprocessor/blocks.html}) instead of the tag `block`. This allows you to specify the point in
24
+ the processing pipeline when a block should be included. So you definitely need to update your
25
+ `default.template` file as well as any other page/template file where you used the `block` tag.
26
+
27
+ * **Meta information names**: The names of some meta information keys have been changed. Meta
28
+ information names are not specified in camelCase anymore but with under\_scores. You can find a
29
+ complete list of supported meta information names in the [meta information
30
+ reference]({relocatable: reference_metainfo.html}). The most notable changes are:
31
+
32
+ * directoryName → routed\_title
33
+ * inMenu → in\_menu
34
+ * indexFile → index\_path
35
+ * omitIndexPath → omit\_index\_path
36
+ * outputNameStyle → output\_path\_style
37
+ * orderInfo → sort\_info
38
+
39
+ * **website\_dir/metainfo.yaml**: This file is not supported anymore since webgen 0.5.x uses a more
40
+ flexible way for specifying meta information and virtual paths. You need to migrate its data to
41
+ `metainfo` and `virtual` files in the source directory. Have a look at the documentation of the
42
+ [metainfo source handler]({relocatable: sourcehandler/metainfo.html}) and the [virtual source
43
+ handler]({relocatable: sourcehandler/virtual.html}).
44
+
45
+ * **Configuration file syntax**: The configuration file syntax as well as the names of the
46
+ configuration options and some defaults changed. For example, the default processing pipeline now
47
+ uses Maruku (a Markdown converter) as markup language processor. You can find an overview over all
48
+ available configuration options in the [configuration option reference]({relocatable:
49
+ reference_configuration.html}). Also have a look at the [configuration file
50
+ documentation]({relocatable: manual.html#website-configfile}) for more information on the syntax
51
+ of this file and the available helpers.
52
+
53
+ * **Extensions development**: Since the complete core of webgen has changed you need to rewrite all
54
+ your plugins for the 0.5.x series. Howver, webgen has complete [API documentation]({relocatable:
55
+ api.html}) now which provides you with all needed information as well as examples on how to
56
+ implement source handlers, tags, content processors, ... If you still have any questions, don't
57
+ hesitate to contact me or write a mail to the mailing list!
58
+
59
+ * **Not Implement Yet**: There are several features of the 0.4.x series which are currently not
60
+ implemented in the 0.5.x series:
61
+
62
+ * source handlers: gallery, sipttra
63
+ * tags: customvar (won't be ported), download, htmlmetainfo, news (won't be ported, superceded
64
+ by blogging support), wikilink
65
+ * misc: smiley replacer, html validators
66
+
67
+ If you need any of those you have to wait till they are implemented or port them on your on.
@@ -1,8 +1,8 @@
1
1
  require 'facets/ansicode'
2
2
  require 'rbconfig'
3
3
 
4
- Console::ANSICode.define_ansicolor_method(:lred, '1;31')
5
- Console::ANSICode.define_ansicolor_method(:lblue, '1;34')
4
+ ANSICode.define_ansicolor_method(:lred, '1;31')
5
+ ANSICode.define_ansicolor_method(:lblue, '1;34')
6
6
 
7
7
  module Webgen::CLI
8
8
 
@@ -18,8 +18,8 @@ module Webgen::CLI
18
18
 
19
19
  # Used for dynamically formatting the text (setting color, bold face, ...).
20
20
  def self.method_missing(id, text = nil)
21
- if USE_ANSI_COLORS && Console::ANSICode.respond_to?(id)
22
- Console::ANSICode.send(id, text.to_s)
21
+ if USE_ANSI_COLORS && ANSICode.respond_to?(id)
22
+ ANSICode.send(id, text.to_s)
23
23
  else
24
24
  text.to_s
25
25
  end