gettalong-webgen 0.5.8.20090507 → 0.5.9.20090620
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -6
- data/data/webgen/passive_sources/images/generated_by_webgen.png +0 -0
- data/data/webgen/passive_sources/images/webgen_logo.png +0 -0
- data/data/webgen/passive_sources/templates/atom_feed.template +38 -0
- data/data/webgen/passive_sources/templates/rss_feed.template +28 -0
- data/data/webgen/resources.yaml +2 -1
- data/doc/contentprocessor/builder.page +1 -1
- data/doc/contentprocessor/erb.page +5 -2
- data/doc/contentprocessor/erubis.page +2 -2
- data/doc/extensions.page +1 -1
- data/doc/manual.page +56 -26
- data/doc/reference_configuration.page +36 -1
- data/doc/reference_website_styles.page +1 -1
- data/doc/sourcehandler/feed.page +6 -11
- data/doc/tag/includefile.page +1 -1
- data/lib/webgen/cli/apply_command.rb +1 -1
- data/lib/webgen/cli/utils.rb +2 -2
- data/lib/webgen/common.rb +0 -9
- data/lib/webgen/contentprocessor/blocks.rb +60 -36
- data/lib/webgen/contentprocessor/builder.rb +2 -2
- data/lib/webgen/contentprocessor/erb.rb +3 -2
- data/lib/webgen/contentprocessor/erubis.rb +2 -2
- data/lib/webgen/contentprocessor/haml.rb +2 -2
- data/lib/webgen/contentprocessor/maruku.rb +1 -1
- data/lib/webgen/contentprocessor/sass.rb +2 -2
- data/lib/webgen/contentprocessor/tags.rb +25 -11
- data/lib/webgen/context.rb +4 -1
- data/lib/webgen/context/render.rb +32 -0
- data/lib/webgen/context/tags.rb +20 -0
- data/lib/webgen/default_config.rb +4 -1
- data/lib/webgen/deprecated.rb +37 -4
- data/lib/webgen/node.rb +37 -38
- data/lib/webgen/path.rb +151 -54
- data/lib/webgen/source.rb +6 -6
- data/lib/webgen/source/stacked.rb +13 -5
- data/lib/webgen/sourcehandler.rb +71 -45
- data/lib/webgen/sourcehandler/base.rb +51 -21
- data/lib/webgen/sourcehandler/copy.rb +4 -4
- data/lib/webgen/sourcehandler/directory.rb +3 -9
- data/lib/webgen/sourcehandler/feed.rb +23 -49
- data/lib/webgen/sourcehandler/fragment.rb +10 -8
- data/lib/webgen/sourcehandler/memory.rb +9 -10
- data/lib/webgen/sourcehandler/metainfo.rb +9 -9
- data/lib/webgen/sourcehandler/page.rb +5 -5
- data/lib/webgen/sourcehandler/sitemap.rb +3 -3
- data/lib/webgen/sourcehandler/template.rb +6 -6
- data/lib/webgen/sourcehandler/virtual.rb +19 -17
- data/lib/webgen/tag/base.rb +34 -26
- data/lib/webgen/tag/breadcrumbtrail.rb +3 -3
- data/lib/webgen/tag/executecommand.rb +3 -3
- data/lib/webgen/tag/langbar.rb +2 -2
- data/lib/webgen/tag/link.rb +3 -3
- data/lib/webgen/tag/menu.rb +2 -2
- data/lib/webgen/tag/metainfo.rb +1 -1
- data/lib/webgen/tag/relocatable.rb +17 -21
- data/lib/webgen/tag/tikz.rb +5 -6
- data/lib/webgen/tree.rb +7 -7
- data/lib/webgen/version.rb +1 -1
- data/lib/webgen/website.rb +4 -2
- data/misc/default.css +8 -2
- data/misc/default.template +2 -2
- data/misc/logo.svg +313 -0
- data/misc/style.page +1 -1
- data/test/helper.rb +2 -2
- data/test/test_common_sitemap.rb +1 -1
- data/test/test_contentprocessor_blocks.rb +12 -4
- data/test/test_contentprocessor_builder.rb +2 -1
- data/test/test_contentprocessor_erb.rb +2 -1
- data/test/test_contentprocessor_erubis.rb +1 -1
- data/test/test_contentprocessor_fragments.rb +12 -11
- data/test/test_contentprocessor_haml.rb +2 -1
- data/test/test_contentprocessor_maruku.rb +1 -0
- data/test/test_contentprocessor_rdiscount.rb +1 -0
- data/test/test_contentprocessor_rdoc.rb +1 -0
- data/test/test_contentprocessor_sass.rb +1 -0
- data/test/test_contentprocessor_tags.rb +13 -0
- data/test/test_context.rb +28 -0
- data/test/test_node.rb +40 -20
- data/test/test_path.rb +106 -65
- data/test/test_source_filesystem.rb +1 -1
- data/test/test_source_stacked.rb +19 -6
- data/test/test_sourcehandler_base.rb +53 -47
- data/test/test_sourcehandler_copy.rb +6 -6
- data/test/test_sourcehandler_directory.rb +8 -12
- data/test/test_sourcehandler_feed.rb +10 -6
- data/test/test_sourcehandler_fragment.rb +6 -5
- data/test/test_sourcehandler_main.rb +39 -0
- data/test/test_sourcehandler_memory.rb +4 -4
- data/test/test_sourcehandler_metainfo.rb +10 -10
- data/test/test_sourcehandler_page.rb +9 -9
- data/test/test_sourcehandler_sitemap.rb +4 -4
- data/test/test_sourcehandler_template.rb +14 -14
- data/test/test_sourcehandler_virtual.rb +9 -5
- data/test/test_tag_base.rb +2 -2
- data/test/test_tag_executecommand.rb +1 -1
- data/test/test_tag_link.rb +4 -3
- data/test/test_tag_menu.rb +15 -15
- data/test/test_tag_metainfo.rb +1 -0
- data/test/test_tag_relocatable.rb +2 -1
- data/test/test_tag_tikz.rb +3 -3
- data/test/test_tree.rb +8 -8
- data/test/test_website.rb +15 -0
- metadata +14 -14
- 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.
|
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
|
Binary file
|
Binary file
|
@@ -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
|
+
|
data/data/webgen/resources.yaml
CHANGED
@@ -52,7 +52,7 @@ a custom XML document (the `content` block has to be valid Ruby!):
|
|
52
52
|
title: Person Object
|
53
53
|
template: ~
|
54
54
|
--- pipeline:builder
|
55
|
-
xml.persons(:path => context.node.
|
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 `<
|
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.
|
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.
|
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.
|
data/doc/extensions.page
CHANGED
@@ -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.
|
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
|
%>
|
data/doc/manual.page
CHANGED
@@ -253,9 +253,31 @@ feeling of what files are handled by webgen.
|
|
253
253
|
## Source Paths Naming Convention {#source-naming}
|
254
254
|
|
255
255
|
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
|
256
|
+
information can be extracted correctly from the path names. There are three different cases
|
257
|
+
depending on the type of path (the individual parts of a path are explained below):
|
257
258
|
|
258
|
-
|
259
|
+
* The path specifies a directory. It must end with a slash character and must not contain any hash
|
260
|
+
characters. A directory path has to follow the scheme:
|
261
|
+
|
262
|
+
/parent_path/basename/
|
263
|
+
|
264
|
+
* The path specifies a file. It must not end with a slash character and must not contain any hash
|
265
|
+
characters. A file path has to follow the scheme:
|
266
|
+
|
267
|
+
/parent_path/[sort_info.]basename[.lang][.extension]
|
268
|
+
|
269
|
+
* The path specifies a fragment (e.g. part of a file). It must contain exactly one hash character
|
270
|
+
and it has to follow the scheme (where `/parent_path` needs to be a file path):
|
271
|
+
|
272
|
+
/parent_path#basename
|
273
|
+
|
274
|
+
Following is the explanation of the parts of the path names:
|
275
|
+
|
276
|
+
* `/parent_path`
|
277
|
+
|
278
|
+
This part specifies the path of the parent of this path and is used internally to create a
|
279
|
+
hierarchy of paths. Although the leading slash is explicitly written here, it is part of the
|
280
|
+
parent path, i.e. each parent path begins with a slash.
|
259
281
|
|
260
282
|
* `sort_info`
|
261
283
|
|
@@ -265,46 +287,54 @@ information can be extracted correctly from the path name:
|
|
265
287
|
* `basename`
|
266
288
|
|
267
289
|
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
|
269
|
-
must not contain any dots, spaces or any character from the
|
270
|
-
$ ,``. If you do use one of them webgen may not work
|
290
|
+
replaced by spaces). And on the other hand, the [canonical name]({relocatable: '#source-cn'}) is
|
291
|
+
derived from it. `basename` must not contain any dots, spaces or any character from the
|
292
|
+
following list: ``; ? * : ` & = + $ ,``. If you do use one of them, webgen may not work
|
293
|
+
correctly!
|
271
294
|
|
272
|
-
> If two paths have the same `basename` and `extension` part, they should define the same
|
295
|
+
> If two file paths have the same `basename` and `extension` part, they should define the same
|
273
296
|
> content but for different languages. This allows webgen to automatically deliver the right
|
274
|
-
> language version of the content
|
297
|
+
> language version of the content.
|
275
298
|
{.important}
|
276
299
|
|
277
300
|
* `lang`
|
278
301
|
|
279
302
|
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).
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
303
|
+
language identifier (two or three characters (a-z) long). It can only be specified if an
|
304
|
+
extension is also specified. If the file path should not have an extension, then just add a
|
305
|
+
trailing dot, e.g. `/dir/file.de.` - the trailing dot is ignored by webgen.
|
306
|
+
|
307
|
+
If the language part is not specified, it is assumed that the path is language independent (for
|
308
|
+
example, images are normally not specific for a specific language). However, this behaviour may
|
309
|
+
be different for some source handler classes (for example, all paths handled by
|
310
|
+
SourceHandler::Page are assigned the default language if none is set).
|
285
311
|
|
286
312
|
If the language identifier can't be matched to a valid language, it is assumed that this part
|
287
313
|
isn't actually a language identifier but a part of the extension. This also means that in the
|
288
314
|
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
|
315
|
+
part is interpreted as language identifier and not as part of the extension!
|
290
316
|
|
291
317
|
* `extension`
|
292
318
|
|
293
319
|
The file extension can be anything and can include dots.
|
294
320
|
|
295
|
-
Following are some examples of source path names
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
321
|
+
Following are some examples of source path names (the acn and alcn parts are explained
|
322
|
+
[below]({relocatable: '#source-cn'})):
|
323
|
+
|
324
|
+
| Path | Basename | Language | `title` | `sort_info` | acn | alcn |
|
325
|
+
|----------------------------|--------------|----------|--------------|-------------|------------------------|-------------------------|
|
326
|
+
| `/directory/` | directory | -none- | Directory | -none- | `/directory/` | `/directory/` |
|
327
|
+
| `/image.png` | image | -none- | Image | 0 | `/image.png` | `/image.png` |
|
328
|
+
| `/image.de.png` | image | de | Image | 0 | `/image.png` | `/image.de.png` |
|
329
|
+
| `/01.name_of-file.eo.page` | name_of-file | eo | Name of file | 1 | `/name_of-file.page` | `/name_of-file.eo.page` |
|
330
|
+
| `/archive.tar.bz2` | archive | -none- | Archive | 0 | `/archive.tar.bz2` | `/archive.tar.bz2` |
|
331
|
+
| `/archive.de.tar.bz2` | archive | de | Archive | 0 | `/archive.tar.bz2` | `/archive.de.tar.bz2` |
|
332
|
+
| `/manual.html#sources` | manual | -none- | Manual | -none- | `/manual.html#sources` | `/manual.html#sources` |
|
333
|
+
{#source-path-example-table style="border: 1px solid black; width: 100%"}
|
334
|
+
|
335
|
+
Notice: The first two file path and the last two file path examples define the same content for two
|
336
|
+
different languages (or more exactly: the first one is unlocalized in both cases and the second one
|
337
|
+
localized to German) as they have the same canonical name.
|
308
338
|
|
309
339
|
|
310
340
|
## Canonical Name of a File ### {#source-cn}
|
@@ -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
|
@@ -17,7 +17,7 @@ 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.
|
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
23
|
<h2 id="<%= node.cn %>"><%= node.cn %></h2>
|
data/doc/sourcehandler/feed.page
CHANGED
@@ -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)
|
@@ -98,8 +92,9 @@ The following meta information keys of page files are used if they are specified
|
|
98
92
|
|
99
93
|
The URL of the homepage of the author. Only used if the `author` meta information is also set.
|
100
94
|
|
101
|
-
The default implementation supports the generation of atom and RSS feeds
|
102
|
-
default
|
103
|
-
|
104
|
-
|
105
|
-
|
95
|
+
The default implementation supports the generation of atom and RSS feeds by using templates shipped
|
96
|
+
with webgen. The default templates are located under the ALCNs `/templates/atom_feed.template` and
|
97
|
+
`/templates/rss_feed.template` and are automatically created and used if no such paths exist in the
|
98
|
+
webgen website. You can also override the default generation mechanism on a file per file basis by
|
99
|
+
adding an `atom_template` and/or `rss_template` block in the feed file which are then used to
|
100
|
+
generate the atom or the RSS feed respectively.
|
data/doc/tag/includefile.page
CHANGED
@@ -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.
|
@@ -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?(
|
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')
|
data/lib/webgen/cli/utils.rb
CHANGED
@@ -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 =
|
15
|
-
DEFAULT_WIDTH = if Config::CONFIG['
|
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
|
data/lib/webgen/common.rb
CHANGED
@@ -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
|
@@ -10,49 +10,73 @@ module Webgen::ContentProcessor
|
|
10
10
|
BLOCK_RE = /<webgen:block\s*?((?:\s\w+=('|")[^'"]+\2)+)\s*\/>/
|
11
11
|
BLOCK_ATTR_RE = /(\w+)=('|")([^'"]+)\2/
|
12
12
|
|
13
|
-
# Replace
|
13
|
+
# Replace the webgen:block xml tags with the rendered content of the specified node.
|
14
14
|
def call(context)
|
15
|
-
chain = context[:chain]
|
16
|
-
new_chain = (chain.length > 1 ? chain[1..-1] : chain)
|
17
|
-
|
18
15
|
context.content.gsub!(BLOCK_RE) do |match|
|
19
16
|
attr = {}
|
20
|
-
match.scan(BLOCK_ATTR_RE) {|name, sep, content| attr[name] = content}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
used_chain = paths.collect do |path|
|
26
|
-
temp_node = context.ref_node.resolve(path.strip, context.dest_node.lang)
|
27
|
-
log(:error) { "Could not resolve <#{path.strip}> in <#{context.ref_node.absolute_lcn}> in '#{match.to_s}'" } if temp_node.nil?
|
28
|
-
temp_node
|
29
|
-
end.compact
|
30
|
-
next match if used_chain.length != paths.length
|
31
|
-
dest_node = context.content_node
|
32
|
-
end
|
17
|
+
match.scan(BLOCK_ATTR_RE) {|name, sep, content| attr[name.to_sym] = content}
|
18
|
+
render_block(context, attr)
|
19
|
+
end
|
20
|
+
context
|
21
|
+
end
|
33
22
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
23
|
+
# Render a block of a page node and return the result.
|
24
|
+
#
|
25
|
+
# The Webgen::Context object +context+ is used as the render context and the +options+ hash
|
26
|
+
# needs to hold all relevant information, that is:
|
27
|
+
#
|
28
|
+
# [<tt>:name</tt> (mandatory)]
|
29
|
+
# The name of the block that should be used.
|
30
|
+
# [<tt>:chain</tt>]
|
31
|
+
# The node chain used for rendering. If this is not specified, the node chain from the context
|
32
|
+
# is used. It needs to be a String in the format <tt>(A)LCN;(A)LCN;...</tt> or an array of
|
33
|
+
# nodes.
|
34
|
+
# [<tt>:node</tt>]
|
35
|
+
# Defines which node in the node chain should be used. Valid values are +next+ (= default
|
36
|
+
# value; the next node in the node chain), +first+ (the first node in the node chain with a
|
37
|
+
# block called +name+) or +current+ (the currently rendered node, ignores the +chain+ option).
|
38
|
+
# [<tt>:notfound</tt>]
|
39
|
+
# If this property is set to +ignore+, a missing block will not raise an error. It is unset by
|
40
|
+
# default, so missing blocks will raise errors.
|
41
|
+
def render_block(context, options)
|
42
|
+
if options[:chain].nil?
|
43
|
+
used_chain = (context[:chain].length > 1 ? context[:chain][1..-1] : context[:chain]).dup
|
44
|
+
elsif options[:chain].kind_of?(Array)
|
45
|
+
used_chain = options[:chain]
|
46
|
+
else
|
47
|
+
paths = options[:chain].split(';')
|
48
|
+
used_chain = paths.collect do |path|
|
49
|
+
temp_node = context.ref_node.resolve(path.strip, context.dest_node.lang)
|
50
|
+
if temp_node.nil?
|
51
|
+
context.dest_node.flag(:dirty)
|
52
|
+
log(:error) { "Could not resolve <#{path.strip}> in <#{context.ref_node.alcn}> while rendering blocks" }
|
48
53
|
end
|
49
|
-
|
54
|
+
temp_node
|
55
|
+
end.compact
|
56
|
+
return '' if used_chain.length != paths.length
|
57
|
+
dest_node = context.content_node
|
58
|
+
end
|
50
59
|
|
51
|
-
|
52
|
-
|
53
|
-
|
60
|
+
if options[:node] == 'first'
|
61
|
+
used_chain.shift while used_chain.length > 0 && !used_chain.first.node_info[:page].blocks.has_key?(options[:name])
|
62
|
+
elsif options[:node] == 'current'
|
63
|
+
used_chain = context[:chain].dup
|
54
64
|
end
|
55
|
-
|
65
|
+
block_node = used_chain.first
|
66
|
+
|
67
|
+
if !block_node || !block_node.node_info[:page].blocks.has_key?(options[:name])
|
68
|
+
if options[:notfound] == 'ignore'
|
69
|
+
return ''
|
70
|
+
elsif block_node
|
71
|
+
raise "Node <#{block_node.alcn}> has no block named '#{options[:name]}'"
|
72
|
+
else
|
73
|
+
raise "No node in the chain has a block named '#{options[:name]}'"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context.dest_node.node_info[:used_nodes] << block_node.alcn
|
78
|
+
tmp_context = block_node.node_info[:page].blocks[options[:name]].render(context.clone(:chain => used_chain, :dest_node => dest_node))
|
79
|
+
tmp_context.content
|
56
80
|
end
|
57
81
|
|
58
82
|
end
|