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
data/Rakefile CHANGED
@@ -59,9 +59,9 @@ Webgen::WebgenTask.new('htmldoc') do |site|
59
59
  prefix = "webgen-website-bundle-"
60
60
  config['resources'].select {|name, data| name =~ /^#{prefix}style/}.each do |name, data|
61
61
  config['sources'] <<
62
- ["/website_styles/#{name.sub(prefix, '')}", "Webgen::Source::FileSystem", 'misc', 'style.page']
62
+ ["/website_styles/#{name.sub(prefix, '')}/", "Webgen::Source::FileSystem", 'misc', 'style.page']
63
63
  config['sources'] <<
64
- ["/website_styles/#{name.sub(prefix, '')}", 'Webgen::Source::Resource', name, '/src/**', '/src']
64
+ ["/website_styles/#{name.sub(prefix, '')}/", 'Webgen::Source::Resource', name, '/src/**', '/src/']
65
65
  end
66
66
  config['output'] = ['Webgen::Output::FileSystem', 'htmldoc']
67
67
  end
@@ -171,8 +171,7 @@ EOF
171
171
  s.add_development_dependency('haml', '>= 2.0.9')
172
172
  s.add_development_dependency('builder', '>= 2.1.0')
173
173
  s.add_development_dependency('rdoc', '>= 2.4.2')
174
- s.add_development_dependency('coderay', '>= 0.7.4.214')
175
- s.add_development_dependency('feedtools', '>= 0.2.29')
174
+ s.add_development_dependency('coderay', '>= 0.8.312')
176
175
  s.add_development_dependency('erubis', '>= 2.6.2')
177
176
  s.add_development_dependency('rdiscount', '>= 1.2.9')
178
177
  s.add_development_dependency('archive-tar-minitar', '>= 0.5.2')
@@ -279,9 +278,9 @@ The official version is called 'webgen' and can be installed via
279
278
  prefix = "webgen-website-bundle-"
280
279
  config['resources'].select {|name, data| name =~ /^#{prefix}style/}.each do |name, data|
281
280
  config['sources'] <<
282
- ["/documentation/website_styles/#{name.sub(prefix, '')}", "Webgen::Source::FileSystem", '../misc', 'style.page']
281
+ ["/documentation/website_styles/#{name.sub(prefix, '')}/", "Webgen::Source::FileSystem", '../misc', 'style.page']
283
282
  config['sources'] <<
284
- ["/documentation/website_styles/#{name.sub(prefix, '')}", 'Webgen::Source::Resource', name, '/src/**', '/src']
283
+ ["/documentation/website_styles/#{name.sub(prefix, '')}/", 'Webgen::Source::Resource', name, '/src/**', '/src/']
285
284
  end
286
285
  end
287
286
  end
data/THANKS CHANGED
@@ -16,3 +16,4 @@ Thanks for donations to:
16
16
  * Andrew Pietsch
17
17
  * Mateusz Szczap
18
18
  * Michael Franzl
19
+ * Roger Pack
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.8
1
+ 0.5.9
data/bin/webgen CHANGED
@@ -6,7 +6,7 @@ require 'webgen/cli'
6
6
  begin
7
7
  Webgen::CLI::CommandParser.new.parse
8
8
  rescue
9
- puts 'An error has occurred: ' + $!.message
9
+ puts "An error has occurred:\n " + $!.message
10
10
  puts $!.backtrace if $DEBUG
11
11
  exit(-1)
12
12
  end
@@ -0,0 +1,129 @@
1
+ /* This file has been generated with the coderay_stylesheet binary from the coderay gem. */
2
+ /* Copyright by Kornelius Kalnbach, licensed under LGPL - see coderay.rubychan.de */
3
+
4
+ .CodeRay {
5
+ background-color: #f8f8f8;
6
+ border: 1px solid silver;
7
+ font-family: 'Courier New', 'Terminal', monospace;
8
+ color: #000;
9
+ }
10
+ .CodeRay pre { margin: 0px }
11
+
12
+ div.CodeRay { }
13
+
14
+ span.CodeRay { white-space: pre; border: 0px; padding: 2px }
15
+
16
+ table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px }
17
+ table.CodeRay td { padding: 2px 4px; vertical-align: top }
18
+
19
+ .CodeRay .line_numbers, .CodeRay .no {
20
+ background-color: #def;
21
+ color: gray;
22
+ text-align: right;
23
+ }
24
+ .CodeRay .line_numbers tt { font-weight: bold }
25
+ .CodeRay .no { padding: 0px 4px }
26
+ .CodeRay .code { width: 100% }
27
+
28
+ ol.CodeRay { font-size: 10pt }
29
+ ol.CodeRay li { white-space: pre }
30
+
31
+ .CodeRay .code pre { overflow: auto }
32
+
33
+ .CodeRay .debug { color:white ! important; background:blue ! important; }
34
+
35
+ .CodeRay .af { color:#00C }
36
+ .CodeRay .an { color:#007 }
37
+ .CodeRay .at { color:#f08 }
38
+ .CodeRay .av { color:#700 }
39
+ .CodeRay .aw { color:#C00 }
40
+ .CodeRay .bi { color:#509; font-weight:bold }
41
+ .CodeRay .c { color:#888; }
42
+
43
+ .CodeRay .ch { color:#04D }
44
+ .CodeRay .ch .k { color:#04D }
45
+ .CodeRay .ch .dl { color:#039 }
46
+
47
+ .CodeRay .cl { color:#B06; font-weight:bold }
48
+ .CodeRay .co { color:#036; font-weight:bold }
49
+ .CodeRay .cr { color:#0A0 }
50
+ .CodeRay .cv { color:#369 }
51
+ .CodeRay .df { color:#099; font-weight:bold }
52
+ .CodeRay .di { color:#088; font-weight:bold }
53
+ .CodeRay .dl { color:black }
54
+ .CodeRay .do { color:#970 }
55
+ .CodeRay .dt { color:#34b }
56
+ .CodeRay .ds { color:#D42; font-weight:bold }
57
+ .CodeRay .e { color:#666; font-weight:bold }
58
+ .CodeRay .en { color:#800; font-weight:bold }
59
+ .CodeRay .er { color:#F00; background-color:#FAA }
60
+ .CodeRay .ex { color:#F00; font-weight:bold }
61
+ .CodeRay .fl { color:#60E; font-weight:bold }
62
+ .CodeRay .fu { color:#06B; font-weight:bold }
63
+ .CodeRay .gv { color:#d70; font-weight:bold }
64
+ .CodeRay .hx { color:#058; font-weight:bold }
65
+ .CodeRay .i { color:#00D; font-weight:bold }
66
+ .CodeRay .ic { color:#B44; font-weight:bold }
67
+
68
+ .CodeRay .il { background: #eee; color: black }
69
+ .CodeRay .il .il { background: #ddd }
70
+ .CodeRay .il .il .il { background: #ccc }
71
+ .CodeRay .il .idl { font-weight: bold; color: #777 }
72
+
73
+ .CodeRay .im { color:#f00; }
74
+ .CodeRay .in { color:#B2B; font-weight:bold }
75
+ .CodeRay .iv { color:#33B }
76
+ .CodeRay .la { color:#970; font-weight:bold }
77
+ .CodeRay .lv { color:#963 }
78
+ .CodeRay .oc { color:#40E; font-weight:bold }
79
+ .CodeRay .of { color:#000; font-weight:bold }
80
+ .CodeRay .op { }
81
+ .CodeRay .pc { color:#038; font-weight:bold }
82
+ .CodeRay .pd { color:#369; font-weight:bold }
83
+ .CodeRay .pp { color:#579; }
84
+ .CodeRay .ps { color:#00C; font-weight: bold; }
85
+ .CodeRay .pt { color:#349; font-weight:bold }
86
+ .CodeRay .r, .kw { color:#080; font-weight:bold }
87
+
88
+ .CodeRay .ke { color: #808; }
89
+ .CodeRay .ke .dl { color: #606; }
90
+ .CodeRay .ke .ch { color: #80f; }
91
+ .CodeRay .vl { color: #088; }
92
+
93
+ .CodeRay .rx { background-color:#fff0ff }
94
+ .CodeRay .rx .k { color:#808 }
95
+ .CodeRay .rx .dl { color:#404 }
96
+ .CodeRay .rx .mod { color:#C2C }
97
+ .CodeRay .rx .fu { color:#404; font-weight: bold }
98
+
99
+ .CodeRay .s { background-color:#fff0f0; color: #D20; }
100
+ .CodeRay .s .s { background-color:#ffe0e0 }
101
+ .CodeRay .s .s .s { background-color:#ffd0d0 }
102
+ .CodeRay .s .k { }
103
+ .CodeRay .s .ch { color: #b0b; }
104
+ .CodeRay .s .dl { color: #710; }
105
+
106
+ .CodeRay .sh { background-color:#f0fff0; color:#2B2 }
107
+ .CodeRay .sh .k { }
108
+ .CodeRay .sh .dl { color:#161 }
109
+
110
+ .CodeRay .sy { color:#A60 }
111
+ .CodeRay .sy .k { color:#A60 }
112
+ .CodeRay .sy .dl { color:#630 }
113
+
114
+ .CodeRay .ta { color:#070 }
115
+ .CodeRay .tf { color:#070; font-weight:bold }
116
+ .CodeRay .ts { color:#D70; font-weight:bold }
117
+ .CodeRay .ty { color:#339; font-weight:bold }
118
+ .CodeRay .v { color:#036 }
119
+ .CodeRay .xt { color:#444 }
120
+
121
+ .CodeRay .ins { background: #afa; }
122
+ .CodeRay .del { background: #faa; }
123
+ .CodeRay .chg { color: #aaf; background: #007; }
124
+ .CodeRay .head { color: #f8f; background: #505 }
125
+
126
+ .CodeRay .ins .ins { color: #080; font-weight:bold }
127
+ .CodeRay .del .del { color: #800; font-weight:bold }
128
+ .CodeRay .chg .chg { color: #66f; }
129
+ .CodeRay .head .head { color: #f4f; }
@@ -0,0 +1,38 @@
1
+ ---
2
+ template: ~
3
+ --- pipeline:erb
4
+ <?xml version="1.0" encoding="utf-8" ?>
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <title type="html"><%= h(context.node['title']) %></title>
7
+ <subtitle type="html"><%= h(context.node['description']) %></subtitle>
8
+ <author>
9
+ <name><%= h(context.node['author']) %></name>
10
+ <uri><%= h(context.node['author_url']) %></uri>
11
+ </author>
12
+
13
+ <link href="<%= context.node.feed_link %>" rel="alternate" />
14
+ <generator uri="http://webgen.rubyforge.org/documentation/sourcehandler/feed.html" version="<%= Webgen::VERSION %>">
15
+ webgen - Webgen::SourceHandler::Feed
16
+ </generator>
17
+ <updated><%= Time.now.xmlschema %></updated>
18
+ <id><%= context.node.feed_link %></id>
19
+
20
+ <% context.node.feed_entries.each do |entry| %>
21
+ <entry>
22
+ <title type="html"><%= h(entry['title']) %></title>
23
+ <% if entry['author'] %>
24
+ <author>
25
+ <name><%= h(entry['author']) %></name>
26
+ <uri><%= h(entry['author_url']) %></uri>
27
+ </author>
28
+ <% end %>
29
+ <link href="<%= Webgen::Node.url(File.join(context.node['site_url'], entry.path), false) %>" rel="alternate" />
30
+ <id><%= Webgen::Node.url(File.join(context.node['site_url'], entry.path), false) %></id>
31
+ <updated><%= entry['modified_at'].xmlschema %></updated>
32
+ <% if entry['created_at'].kind_of?(Time) %>
33
+ <published><%= entry['created_at'].xmlschema %></published>
34
+ <% end %>
35
+ <content type="html"><%= h(context.node.entry_content(entry)) %></content>
36
+ </entry>
37
+ <% end %>
38
+ </feed>
@@ -0,0 +1,28 @@
1
+ ---
2
+ template: ~
3
+ --- pipeline:erb
4
+ <?xml version="1.0" encoding="utf-8" ?>
5
+ <rss version="2.0">
6
+ <channel>
7
+ <title><%= h(context.node['title']) %></title>
8
+ <link><%= context.node.feed_link %>"</link>
9
+ <description><%= h(context.node['description']) %></description>
10
+ <pubDate><%= Time.now.rfc822 %></pubDate>
11
+ <lastBuildDate><%= Time.now.rfc822 %></lastBuildDate>
12
+ <generator>webgen - Webgen::SourceHandler::Feed</generator>
13
+
14
+ <% context.node.feed_entries.each do |entry| %>
15
+ <item>
16
+ <title><%= h(entry['title']) %></title>
17
+ <link><%= Webgen::Node.url(File.join(context.node['site_url'], entry.path), false) %></link>
18
+ <description><%= h(context.node.entry_content(entry)) %></description>
19
+ <pubDate><%= entry['modified_at'].rfc822 %></pubDate>
20
+ <guid isPermaLink="true"><%= Webgen::Node.url(File.join(context.node['site_url'], entry.path), false) %></guid>
21
+ </item>
22
+ <% end %>
23
+
24
+ </channel>
25
+ </rss>
26
+
27
+
28
+
@@ -0,0 +1,21 @@
1
+ ---
2
+ template: ~
3
+ --- pipeline:erb
4
+ <?xml version="1.0" encoding="utf-8" ?>
5
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
6
+ <%
7
+ context.node.alcns.each do |alcn|
8
+ item = context.node.tree[alcn]
9
+ %>
10
+ <url>
11
+ <loc><%= URI.escape(File.join(context.node['site_url'], item.path)) %></loc>
12
+ <lastmod><%= item['modified_at'].iso8601 %></lastmod>
13
+ <changefreq><%= item['change_freq'] || context.node['default_change_freq'] %></changefreq>
14
+ <% if priority = item['priority'] || context.node['default_priority'] %>
15
+ <priority><%= priority %></priority>
16
+ <% end %>
17
+ </url>
18
+ <%
19
+ end
20
+ %>
21
+ </urlset>
@@ -1,3 +1,4 @@
1
- website_skeleton: webgen-website-skeleton
1
+ website_skeleton: webgen-website-skeleton
2
2
  website_bundles/style/*: webgen-website-bundle-style-$basename
3
3
  website_bundles/default: webgen-website-bundle-default
4
+ passive_sources: webgen-passive-sources
@@ -31,7 +31,11 @@ task :auto_webgen do
31
31
  # you may need to adjust the glob so that all your sources are included
32
32
  paths = Dir['src/**/*'].sort
33
33
  if old_paths != paths || paths.any? {|p| File.mtime(p) > time}
34
- Rake::Task['webgen'].execute({})
34
+ begin
35
+ Rake::Task['webgen'].execute({})
36
+ rescue Webgen::Error => e
37
+ puts e.message
38
+ end
35
39
  end
36
40
  time = Time.now
37
41
  old_paths = paths
@@ -48,11 +48,11 @@ Following is a complete example which shows how to use this extension in a page
48
48
  a custom XML document (the `content` block has to be valid Ruby!):
49
49
 
50
50
  ---
51
- output_path_style: [:parent, :cnbase, ['.', :lang], '.xml']
51
+ output_path_style: [:parent, :basename, ['.', :lang], '.xml']
52
52
  title: Person Object
53
53
  template: ~
54
54
  --- pipeline:builder
55
- xml.persons(:path => context.node.absolute_lcn) do |p|
55
+ xml.persons(:path => context.node.alcn) do |p|
56
56
  p.person do |b|
57
57
  b.firstname('Thomas')
58
58
  b.lastname('Leitner')
@@ -8,7 +8,7 @@ a look at its documentation by executing `ri ERB` or the [ruby documentation
8
8
  site](http://www.ruby-doc.org/)!
9
9
 
10
10
  You can use the special object `context` in your ERB code which provides the whole rendering context
11
- and the following useful methods:
11
+ and, for example, the following useful methods:
12
12
 
13
13
  * `website`: Provides access to the `Webgen::Website` object which can be used to access all aspects
14
14
  of the currently rendered website.
@@ -22,6 +22,9 @@ and the following useful methods:
22
22
  * `dest_node`: The node in which the result gets inserted. Should be used for calculating relative
23
23
  paths.
24
24
 
25
+ For a complete list of supported methods have a look at the API documentation for
26
+ [Webgen::Context](../rdoc/Webgen/Context.html).
27
+
25
28
  Here is a small usage example. The following put in a page file
26
29
 
27
30
  Counting 5 items dynamically:
@@ -53,5 +56,5 @@ output the result of the Ruby code (note the equation sign!). And the fourth lin
53
56
 
54
57
  > You may need to ensure that the ERB start and end tags are not processed by the content
55
58
  > processor. For example, when using the RedCloth content processor, you may need to surround the
56
- > ERB code with `<textile>` tags!
59
+ > ERB code with `<notextile>` tags!
57
60
  {.important}
@@ -25,9 +25,9 @@ following configuration options:
25
25
 
26
26
  * `contentprocessor.erubis.use_pi`: Use processing instructions instead of ERB like
27
27
  instructions. Normally you use statements like `<%% result = some_method_call(opts) %>` or `<%%=
28
- context.content_node.absolute_lcn %>` in your content. When setting this option to `true`, you can
28
+ context.content_node.alcn %>` in your content. When setting this option to `true`, you can
29
29
  use XML processing instructions instead, like this: `<?rb result = some_method_call(opts) ?>` or
30
- `@{context.content_node.absolute_lcn}@`.
30
+ `@{context.content_node.alcn}@`.
31
31
 
32
32
  * `contentprocessor.erubis.options`: This is hash which is passed to the Erubis interpreter and
33
33
  which can be used to set additional options.
@@ -0,0 +1,21 @@
1
+ ---
2
+ title: Webgen::ContentProcessor::Head
3
+ ---
4
+ ## Description
5
+
6
+ This processor inserts before the end of the HTML head section links to used javascript and css
7
+ files, inline javascript and css content and general meta tags. This functionality can be used, for
8
+ example, by webgen tags to add needed javascript or css fragments on a page-per-page basis.
9
+
10
+ It can also be used to insert arbitrary meta tags on a page-per-page basis. This can be done by
11
+ setting the meta information named [`meta`]({relocatable: ../reference_metainfo.html#meta}) on a
12
+ page file.
13
+
14
+ This content processor should be used on template files since its output is only useful in the head
15
+ section of an HTML file. And it should be the last content processor in the pipeline because
16
+ otherwise not all needed information is available! There is no need for a special markup since the
17
+ HTML head end tag is unique in a HTML element and therefore the insertion place can easily be found.
18
+
19
+ Developers wanting to use the functionality of this content processor should have a look at its [API
20
+ documentation](../rdoc/Webgen/ContentProcessor/Head.html).
21
+
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Webgen::ContentProcessor::Tidy
3
+ ---
4
+ ## Description
5
+
6
+ This content processor uses the [`tidy`][1] program to convert the input into valid (X)HTML. It
7
+ supports a vast amount of options for specifying how the input should be processed. These options
8
+ can be set throught the configuration option [`contentprocessor.tidy.options`]({relocatable:
9
+ ../reference_configuration.html#contentprocessortidyoptions}).
10
+
11
+ The options `-q` and `-f FILE` are always set because they are needed internally and should
12
+ therefore not be set through `contentprocessor.tidy.options`!
13
+
14
+ [1]: http://tidy.sf.net
@@ -6,7 +6,7 @@ title: Extensions
6
6
  Following is a listing of all available extensions:
7
7
 
8
8
  <%
9
- pattern = /#{File.join(context.node.parent.absolute_lcn, '/')}(contentprocessor|output|source|sourcehandler|tag|)\/.*html$/
9
+ pattern = /#{File.join(context.node.parent.alcn, '/')}(contentprocessor|output|source|sourcehandler|tag|)\/.*html$/
10
10
  context.node.tree.node_access[:alcn].select {|alcn, n| alcn =~ pattern}.sort.each do |alcn, n|
11
11
  next if n.is_fragment?
12
12
  %>
@@ -124,14 +124,14 @@ You have several options of varying granularity:
124
124
 
125
125
  default_meta_info:
126
126
  :all:
127
- output_path_style: [:parent, :cnbase, [., :lang], :ext]
127
+ output_path_style: [:parent, :basename, [., :lang], :ext]
128
128
 
129
129
  * Set the meta information `output_path_style` for a specific source handler to only change the
130
130
  output paths of this source handler (the page source handler in the following example):
131
131
 
132
132
  default_meta_info:
133
133
  Page:
134
- output_path_style: [:parent, :cnbase, [., :lang], :ext]
134
+ output_path_style: [:parent, :basename, [., :lang], :ext]
135
135
 
136
136
  * Add the meta information `output_path_style` to a single file via, for example, a meta information
137
137
  backing file.
@@ -38,11 +38,12 @@ Following is a short overview of the available commands:
38
38
 
39
39
  * `apply [-f] (BUNDLE_NAME|BUNDLE_URL)`
40
40
 
41
- The argument may either be a valid bundle name or an URL to a bundle archive (a (gzipped) tar
42
- archive). The command applies the bundle to the given webgen website. The files that will be
43
- written to website directory are shown and the user is asked to confirm that the shown files
44
- should indeed be written (and sometimes overwritten). If the `-f` option is used, the files are
45
- always written.
41
+ The argument may either be a valid bundle name or an URL (in this case you will need to have all
42
+ dependencies for [Source::TarArchive]({relocatable: source/tararchive.html}) installed) to a
43
+ bundle archive (a (gzipped) tar archive). The command applies the bundle to the given webgen
44
+ website. The files that will be written to website directory are shown and the user is asked to
45
+ confirm that the shown files should indeed be written (and sometimes overwritten). If the `-f`
46
+ option is used, the files are always written.
46
47
 
47
48
  You can get the full list of available bundle names by running `webgen help apply`!
48
49
 
@@ -253,9 +254,32 @@ feeling of what files are handled by webgen.
253
254
  ## Source Paths Naming Convention {#source-naming}
254
255
 
255
256
  webgen assumes that the paths provided by the sources follow a special naming convention sothat meta
256
- information can be extracted correctly from the path name:
257
+ information can be extracted correctly from the path names. There are three different cases
258
+ depending on the type of path (the individual parts of a path are explained below):
257
259
 
258
- [sort_info.]basename[.lang].extension
260
+ * The path specifies a directory. It must end with a slash character and must not contain any hash
261
+ characters. A directory path has to follow the scheme:
262
+
263
+ /parent_path/basename/
264
+
265
+ * The path specifies a file. It must not end with a slash character and must not contain any hash
266
+ characters. A file path has to follow the scheme:
267
+
268
+ /parent_path/[sort_info.]basename[.lang][.extension]
269
+
270
+ * The path specifies a fragment (e.g. part of a file). It must contain exactly one hash character
271
+ and it has to follow the scheme (where `/parent_path` needs to be a file path):
272
+
273
+ /parent_path#basename
274
+
275
+ Following is the explanation of the parts of the path names:
276
+
277
+ * `/parent_path`
278
+
279
+ This part specifies the path of the parent of this path and is used internally to create a
280
+ hierarchy of paths. Although the leading slash is explicitly written here, it is part of the
281
+ parent path, i.e. each parent path begins with a slash. Also note that the parent path will end
282
+ with a slash if it is a directory!
259
283
 
260
284
  * `sort_info`
261
285
 
@@ -265,53 +289,85 @@ information can be extracted correctly from the path name:
265
289
  * `basename`
266
290
 
267
291
  This part is used on the one hand to generate the `title` meta information (but with `_` and `-`
268
- replaced by spaces). And on the other hand, the canonical name is derived from it. `basename`
269
- must not contain any dots, spaces or any character from the following list: ``; / ? * : ` & = +
270
- $ ,``. If you do use one of them webgen may not work correctly!
292
+ replaced by spaces). And on the other hand, the [canonical name]({relocatable: '#source-cn'}) is
293
+ derived from it. `basename` must not contain any dots, spaces or any character from the
294
+ following list: ``; ? * : ` & = + $ ,``. If you do use one of them, webgen may not work
295
+ correctly!
271
296
 
272
- > If two paths have the same `basename` and `extension` part, they should define the same
297
+ > If two file paths have the same `basename` and `extension` part, they should define the same
273
298
  > content but for different languages. This allows webgen to automatically deliver the right
274
- > language version of the content
299
+ > language version of the content.
275
300
  {.important}
276
301
 
277
302
  * `lang`
278
303
 
279
304
  This part is optional and has to be an [ISO-639-1/2](http://www.loc.gov/standards/iso639-2/)
280
- language identifier (two or three characters (a-z) long). If not specified, it is assumed that
281
- the path is language independent (for example, images are normally not specific for a specific
282
- language). However, this behaviour may be different for some source handler classes (for
283
- example, all paths handled by SourceHandler::Page are assigned the default language if none is
284
- set).
305
+ language identifier (two or three characters (a-z) long). It can only be specified if an
306
+ extension is also specified. If the file path should not have an extension, then just add a
307
+ trailing dot, e.g. `/dir/file.de.` - the trailing dot is ignored by webgen.
308
+
309
+ If the language part is not specified, it is assumed that the path is language independent (for
310
+ example, images are normally not specific for a specific language). However, this behaviour may
311
+ be different for some source handler classes (for example, all paths handled by
312
+ SourceHandler::Page are assigned the default language if none is set).
285
313
 
286
314
  If the language identifier can't be matched to a valid language, it is assumed that this part
287
315
  isn't actually a language identifier but a part of the extension. This also means that in the
288
316
  special case where the first part of an extension is also a valid language identifier, the first
289
- part is interpreted as language identifier and not as part of the extension.
317
+ part is interpreted as language identifier and not as part of the extension!
290
318
 
291
319
  * `extension`
292
320
 
293
321
  The file extension can be anything and can include dots.
294
322
 
295
- Following are some examples of source path names:
323
+ Following are some examples of source path names (the acn and alcn parts are explained
324
+ [below]({relocatable: '#source-cn'})):
296
325
 
297
- |Path name | Parsed meta information
298
- |--------------------------|------------------------------------------------
299
- |`name.png` | title: Name, language: none, sort\_info: 0, basename: name, cn: name.png
300
- |`name.de.png` | title: Name, language: de, sort\_info: 0, basename: name, cn: name.png
301
- |`01.name_of-file.eo.page` | title: Name of file, language: eo, sort\_info: 1, basename: name_of-file, cn: name_of-file.page
302
- |`name.tar.bz2` | title: Name, language: none, sort\_info: 0, basename: name, cn: name.tar.bz2
303
- |`name.de.tar.bz2` | title: Name, language: de, sort\_info: 0, basename: name, cn: name.tar.bz2
326
+ | Path | Basename | Language | `title` | `sort_info` | acn | alcn |
327
+ |----------------------------|--------------|----------|--------------|-------------|------------------------|-------------------------|
328
+ | `/directory/` | directory | -none- | Directory | -none- | `/directory/` | `/directory/` |
329
+ | `/image.png` | image | -none- | Image | 0 | `/image.png` | `/image.png` |
330
+ | `/image.de.png` | image | de | Image | 0 | `/image.png` | `/image.de.png` |
331
+ | `/01.name_of-file.eo.page` | name_of-file | eo | Name of file | 1 | `/name_of-file.page` | `/name_of-file.eo.page` |
332
+ | `/archive.tar.bz2` | archive | -none- | Archive | 0 | `/archive.tar.bz2` | `/archive.tar.bz2` |
333
+ | `/archive.de.tar.bz2` | archive | de | Archive | 0 | `/archive.tar.bz2` | `/archive.de.tar.bz2` |
334
+ | `/manual.html#sources` | manual | -none- | Manual | -none- | `/manual.html#sources` | `/manual.html#sources` |
335
+ {#source-path-example-table style="border: 1px solid black; width: 100%"}
304
336
 
305
- Notice: The first two and the last two examples define the same content for two different languages
306
- (or more exactly: the first one is unlocalized and the second one localized to German) as they have
307
- the same canonical name.
337
+ Notice: The first two file path and the last two file path examples define the same content for two
338
+ different languages (or more exactly: the first one is unlocalized in both cases and the second one
339
+ localized to German) as they have the same canonical name.
308
340
 
309
341
 
310
- ## Canonical Name of a File ### {#source-cn}
342
+ ## Canonical Name (CN) of a File ### {#source-cn}
311
343
 
312
344
  webgen provides the functionality to define the same content in more than one language, ie. to
313
345
  localize content. This is achieved with the _canonical name_ of a path, short CN.
314
346
 
347
+ The canonical name as well as all the other variants (\[absolute] \[localized] canonical name, all
348
+ described below) are created directly from the source paths sothat one can easily derive the
349
+ canonical name onself. Here are some examples:
350
+
351
+ | Source path | CN | ACN | LCN | ALCN |
352
+ |-----------------------|------------|--------------------|---------------|-----------------------|
353
+ | `/images/test/` | `test/` | `/images/test/` | `test/` | `/images/test/` |
354
+ | `/images/logo.png` | `logo.png` | `/images/logo.png` | `logo.png` | `/images/logo.png` |
355
+ | `/images/logo.de.png` | `logo.png` | `/images/logo.png` | `logo.de.png` | `/images/logo.de.png` |
356
+ | `/test.de.html#frag` | `#frag` | `/test.html#frag` | `#frag` | `/test.de.html#frag` |
357
+ {#cn-example-table style="border: 1px solid black; width: 100%"}
358
+
359
+ What one can immediately see is that if a source path is unlocalized, the CN is the same as the LCN
360
+ and the ACN is the same as the ALCN. This is always true for directory and fragment paths since they
361
+ are always unlocalized! The first example shows a directory path - note the trailing slash! And the
362
+ last example shows a fragment path - note the difference in the ACN and the ALCN! Another
363
+ good-to-know fact is that an LCN is unique within its hierarchy level and that an ALCN is globally
364
+ unique!
365
+
366
+ > Source handlers can change some parts of a source path. For example, the page source handler
367
+ > changes the extension from `page` to `html`. This has to be taken into account when specifying
368
+ > canonical names! These changes are documented on the documentation pages for the source handlers!
369
+ {.information}
370
+
315
371
  When multiple paths share the same canonical name, webgen assumes that they have the same content
316
372
  but in different languages. It is also possible to specify a _language independent_ path (i.e. one
317
373
  without a language) which is used as a fallback. Therefore when a path should be resolved using a
@@ -344,7 +400,7 @@ specified language is ignored as it is assumed that the user really only wants t
344
400
  specified language!
345
401
 
346
402
  Continuing the above example, this means that `images/my.de.jpg` is always returned when one
347
- specifies `images/my.de.jpg` in any of the index page files, e.g. in `index.fr.page`.
403
+ specifies `images/my.de.jpg` in any of the index page files, e.g. even in `index.fr.page`.
348
404
 
349
405
  Both canonical and localized canonical names can be absolute (ACN and ALCN) which is done by using
350
406
  the full path starting with a slash. This is especially useful when you don't exactly know in which
@@ -353,7 +409,9 @@ hierarchy level a certain canoncial name gets evaluated.
353
409
  Everything said above also means that all paths are not resolved using their real source or output
354
410
  names but using the (localized) canonical name! So when specifying paths for extensions, for example
355
411
  when using the [relocatable tag]({relocatable: tag/relocatable.html}), you always have to use the
356
- (absolute) (localized) canonical names. This is different from previous webgen versions!
412
+ (absolute) (localized) canonical names. This is different from previous webgen versions! However, it
413
+ allows for using a naming scheme based on the source paths to be used independently from the output
414
+ paths and therefore the output paths may change but no changes in the files themselves are needed.
357
415
 
358
416
 
359
417
  ## Output Path Name Construction ### {#source-output}
@@ -370,7 +428,7 @@ information key is an array which can have the following values:
370
428
  * strings (for inserting arbitrary text into output names)
371
429
  * arrays (for grouping values - only interesting for the language part)
372
430
  * symbols for inserting special values:
373
- * `:cnbase`: The basename of the path.
431
+ * `:basename`: The basename of the path.
374
432
  * `:parent`: The parent path.
375
433
  * `:lang`: The language.
376
434
  * `:ext`: The file extension including the leading dot.
@@ -384,7 +442,7 @@ information key is an array which can have the following values:
384
442
  Following are some examples of output path names for given source path names (assuming that `en` is
385
443
  the default language and that the path is under a directory called `/img/`):
386
444
 
387
- * `output_path_style=[:parent, :cnbase, [., :lang], :ext]` (the default)
445
+ * `output_path_style=[:parent, :basename, [., :lang], :ext]` (the default)
388
446
 
389
447
  * `index.jpg` --> `/img/index.jpg`
390
448
 
@@ -405,13 +463,13 @@ the default language and that the path is under a directory called `/img/`):
405
463
 
406
464
  Since `de` is not the default language, the language part is always used!
407
465
 
408
- * `output_path_style=[:parent, :cnbase, :ext, ., :lang]`
466
+ * `output_path_style=[:parent, :basename, :ext, ., :lang]`
409
467
 
410
468
  * `index.jpg` --> `/img/index.jpg.`
411
469
 
412
470
  Be aware of the trailing dot since the `:lang` value is not defined in a sub array!
413
471
 
414
- * `output_path_style=[:parent, :year, /, :month, /, :cnbase, [., :lang], :ext]`
472
+ * `output_path_style=[:parent, :year, /, :month, /, :basename, [., :lang], :ext]`
415
473
 
416
474
  * `index.jpg` --> `/img/2008/09/index.jpg`
417
475
 
@@ -537,14 +595,21 @@ There are several types of extensions:
537
595
  Webgen Page Format. It is not specified how they have to process the content but this type of
538
596
  extension can basically be divided into two groups:
539
597
 
540
- * Markup processors: Processors like Maruku or RedCloth belong to this group and they convert
541
- markup text that is easy to read and write to a more structure format like HTML. This allows
542
- you to write an HTML page without knowing HTML.
598
+ * Text content processors: These processors are used to process textual content like files in
599
+ Webgen Page Format. This group can furthe be divided:
600
+
601
+ * Markup processors: Processors like Maruku or RedCloth belong to this group and they
602
+ convert markup text that is easy to read and write to a more structure format like HTML.
603
+ This allows you to write an HTML page without knowing HTML.
604
+
605
+ * String replacers: These processors normally process special strings and substitute them
606
+ with other content. For example, the `erb` processors replaces delimited strings
607
+ interpreted as Ruby code with the interpreted value. Another example would be webgen's
608
+ `tags` processor which replaces strings like `\{relocatable: ../index.html}` with a
609
+ processed value.
543
610
 
544
- * String replacers: These processors normally process special strings and substitute them with
545
- other content. For example, the `erb` processors replaces delimited strings interpreted as
546
- Ruby code with the interpreted value. Another example would be webgen's `tags` processor which
547
- replaces strings like `\{relocatable: ../index.html}` with a processed value.
611
+ * Binary content processors: These processors are used to process binary data. For example, one
612
+ might want to process an image to produce a thumbnailed version of it.
548
613
 
549
614
  * **Source Handler**: These extensions are used for handling source paths. They read the content of
550
615
  a path and produce one or more nodes (the internal representation of an output path, see [source