webgen 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/bin/webgen +1 -0
- data/doc/contentprocessor.template +4 -3
- data/doc/contentprocessor/blocks.page +5 -6
- data/doc/contentprocessor/builder.page +1 -1
- data/doc/contentprocessor/erb.page +1 -1
- data/doc/contentprocessor/erubis.page +46 -0
- data/doc/contentprocessor/haml.page +1 -1
- data/doc/contentprocessor/maruku.page +1 -1
- data/doc/contentprocessor/rdiscount.page +37 -0
- data/doc/contentprocessor/rdoc.page +1 -1
- data/doc/contentprocessor/redcloth.page +0 -1
- data/doc/contentprocessor/sass.page +0 -1
- data/doc/contentprocessor/tags.page +1 -1
- data/doc/extensions.page +2 -7
- data/doc/faq.page +49 -12
- data/doc/index.page +9 -9
- data/doc/manual.page +110 -22
- data/doc/reference_configuration.page +28 -3
- data/doc/reference_metainfo.page +2 -1
- data/doc/sourcehandler/page.page +16 -0
- data/doc/upgrading.page +109 -37
- data/doc/webgen_page_format.page +3 -1
- data/lib/webgen/configuration.rb +14 -1
- data/lib/webgen/contentprocessor.rb +2 -0
- data/lib/webgen/contentprocessor/erubis.rb +40 -0
- data/lib/webgen/contentprocessor/rdiscount.rb +15 -0
- data/lib/webgen/default_config.rb +8 -0
- data/lib/webgen/node.rb +22 -7
- data/lib/webgen/page.rb +9 -5
- data/lib/webgen/sourcehandler/base.rb +51 -31
- data/lib/webgen/tag/menu.rb +1 -3
- data/lib/webgen/version.rb +1 -1
- data/test/test_configuration.rb +7 -0
- data/test/test_contentprocessor_erubis.rb +47 -0
- data/test/test_contentprocessor_rdiscount.rb +15 -0
- data/test/test_node.rb +8 -0
- data/test/test_page.rb +6 -1
- data/test/test_sourcehandler_base.rb +35 -21
- metadata +28 -2
data/Rakefile
CHANGED
@@ -162,6 +162,8 @@ EOF
|
|
162
162
|
s.add_development_dependency('rdoc', '>= 2.0.0')
|
163
163
|
s.add_development_dependency('coderay', '>= 0.7.4.215')
|
164
164
|
s.add_development_dependency('feedtools', '>= 0.2.29')
|
165
|
+
s.add_development_dependency('erubis', '>= 2.6.2')
|
166
|
+
s.add_development_dependency('rdiscount', '>= 1.2.9')
|
165
167
|
|
166
168
|
s.require_path = 'lib'
|
167
169
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.4
|
data/bin/webgen
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
template: extensions.template
|
3
3
|
--- name:summary pipeline:erb,tags,maruku,blocks
|
4
4
|
|
5
|
-
|
6
|
-
file in [Webgen Page Format]({relocatable: webgen_page_format.html})
|
7
|
-
context.website.config['contentprocessor.map'].
|
5
|
+
As short name for the content processor (used, for example, in the `pipeline` option of a block in a
|
6
|
+
file in [Webgen Page Format]({relocatable: webgen_page_format.html})) one of the following can be
|
7
|
+
used: `<%= context.website.config['contentprocessor.map'].select {|k,v| v ==
|
8
|
+
context.content_node['title']}.map {|k,v| k}.join(', ') %>`.
|
8
9
|
|
9
10
|
--- name:content
|
10
11
|
<webgen:block name='content' />
|
@@ -4,8 +4,7 @@ title: Webgen::ContentProcessor::Blocks
|
|
4
4
|
## Description
|
5
5
|
|
6
6
|
This processor replaces a special xml tag with rendered blocks. It is used, for example, in
|
7
|
-
templates to define the place where the actual page content should be.
|
8
|
-
processor is `blocks`!
|
7
|
+
templates to define the place where the actual page content should be.
|
9
8
|
|
10
9
|
The general syntax is as follows:
|
11
10
|
|
@@ -27,23 +26,23 @@ This is more easily explained with examples. Assume we have a `default.template`
|
|
27
26
|
|
28
27
|
The `default.template` file:
|
29
28
|
|
30
|
-
--- name:content
|
29
|
+
--- name:content pipeline:blocks
|
31
30
|
before default
|
32
31
|
<webgen:block name='content' />
|
33
32
|
after default 1
|
34
|
-
<webgen:block name='content' chain='page.template;my.
|
33
|
+
<webgen:block name='content' chain='page.template;my.html' />
|
35
34
|
after default 2
|
36
35
|
|
37
36
|
The `page.template` file:
|
38
37
|
|
39
|
-
--- name:content
|
38
|
+
--- name:content pipeline:blocks
|
40
39
|
before page 1
|
41
40
|
<webgen:block name='content' />
|
42
41
|
after page 1
|
43
42
|
|
44
43
|
And the `my.page` file:
|
45
44
|
|
46
|
-
--- name:content
|
45
|
+
--- name:content pipeline:
|
47
46
|
The content of the page file.
|
48
47
|
|
49
48
|
When `my.page` gets rendered to `my.html`, the node chain looks like this by default:
|
@@ -6,7 +6,7 @@ title: Webgen::ContentProcessor::Builder
|
|
6
6
|
This content processor can be used to programatically create XHTML/XML documents
|
7
7
|
([Reference][1]). The top builder object is provided through the `xml` object. There are also other
|
8
8
|
objects provided by webgen available - have a look at the [erb documentation]({relocatable:
|
9
|
-
erb.html}).
|
9
|
+
erb.html}).
|
10
10
|
|
11
11
|
> This extension is only available if you have installed the [builder][1] library. The preferred way
|
12
12
|
> to do this is via Rubygems:
|
@@ -5,7 +5,7 @@ title: Webgen::ContentProcessor::Erb
|
|
5
5
|
|
6
6
|
This processer uses ERB (embedded Ruby) to process content. For detailed information about ERB have
|
7
7
|
a look at its documentation by executing `ri ERB` or the [ruby documentation
|
8
|
-
site](http://www.ruby-doc.org/)!
|
8
|
+
site](http://www.ruby-doc.org/)!
|
9
9
|
|
10
10
|
You can use the following special objects in your ERB code:
|
11
11
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
title: Webgen::ContentProcessor::Erubis
|
3
|
+
---
|
4
|
+
## Description
|
5
|
+
|
6
|
+
This processor uses the [Erubis][1] library to process embedded Ruby statements. Erubis is quite a
|
7
|
+
bit faster than the standard ERB library that is shipped with Ruby and provides many other useful
|
8
|
+
options.
|
9
|
+
|
10
|
+
> This extension is only available if you have installed the [erubis][1] library. The preferred
|
11
|
+
> way to do this is via Rubygems:
|
12
|
+
>
|
13
|
+
> gem install erubis
|
14
|
+
{.exclamation}
|
15
|
+
|
16
|
+
[1]: http://www.kuwata-lab.com/erubis/ "Erubis Homepage"
|
17
|
+
|
18
|
+
You can use some special objects provided by webgen in your embedded Ruby code. These are the same
|
19
|
+
objects that are available to the `erb` processor, have a look at its [documentation
|
20
|
+
page]({relocatable: erb.html}).
|
21
|
+
|
22
|
+
The default mode of Erubis works like ERB. So everyting said on the [erb page]({relocatable:
|
23
|
+
erb.html}) is also true for Erubis. However, you can customize how this processor works by using the
|
24
|
+
following configuration options:
|
25
|
+
|
26
|
+
* `contentprocessor.erubis.use_pi`: Use processing instructions instead of ERB like
|
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
|
29
|
+
use XML processing instructions instead, like this: `<?rb result = some_method_call(opts) ?>` or
|
30
|
+
`@{context.content_node.absolute_lcn}@`.
|
31
|
+
|
32
|
+
* `contentprocessor.erubis.options`: This is hash which is passed to the Erubis interpreter and
|
33
|
+
which can be used to set additional options.
|
34
|
+
|
35
|
+
For more information on the additional options or on how to use the processing instructions mode of
|
36
|
+
Erubis, have a look at the [Erubis User Guide](http://www.kuwata-lab.com/erubis/users-guide.html)!
|
37
|
+
|
38
|
+
You can also use block options to modify the behavior of Erubis. The block option `erubis_use_pi` is
|
39
|
+
used instead of the configuration option `contentprocessor.erubis.use_pi` and all other block
|
40
|
+
options starting with `erubis_` are added the options hash that is passed to the Erubis
|
41
|
+
interpreter. For example, the following page tells the Erubis interpreter to use the processing
|
42
|
+
instructions mode and to trim spaces:
|
43
|
+
|
44
|
+
--- erubis_use_pi:true erubis_trim:true
|
45
|
+
Here are the numbers from 1 to 5:
|
46
|
+
<?rb for i in [1,2,3,4,5] ?>@{i}@<?rb end ?>
|
@@ -5,7 +5,7 @@ title: Webgen::ContentProcessor::Haml
|
|
5
5
|
|
6
6
|
This processor converts the content, which is assumed to be in the Haml markup language, to valid
|
7
7
|
XHTML by using the Haml library. For detailed information about Haml have a look at the [Haml
|
8
|
-
Homepage][1]!
|
8
|
+
Homepage][1]!
|
9
9
|
|
10
10
|
You can use some special objects provided by webgen in your Haml markup. These are the same objects
|
11
11
|
that are available to the `erb` processor, have a look at its [documentation page]({relocatable:
|
@@ -6,7 +6,7 @@ title: Webgen::ContentProcessor::Maruku
|
|
6
6
|
This processor converts the content, which is assumed to be in Markdown markup, to HTML by using the
|
7
7
|
Maruku library. Maruku is a Markdown processor which supports a superset of Markdown, including
|
8
8
|
support for assigning ids and classes to every element, support for Markdown inside HTML elements
|
9
|
-
and footnotes.
|
9
|
+
and footnotes.
|
10
10
|
|
11
11
|
For detailed information about Maruku have a look at the [Maruku Homepage][1]. There you will find
|
12
12
|
information about the general Markdown syntax as well as information about the extras added by
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
title: Webgen::ContentProcessor::RDiscount
|
3
|
+
---
|
4
|
+
## Description
|
5
|
+
|
6
|
+
This processor converts the content, which is assumed to be in Markdown markup, to HTML by using the
|
7
|
+
RDiscount library. This library is based on the C based discount library which provides very fast
|
8
|
+
Markdown processing. However, this processor does not support advanced features like the [Maruku
|
9
|
+
Markdown processor]({relocatable: maruku.html}) does.
|
10
|
+
|
11
|
+
> This extension is only available if you have installed the [rdiscount][1] library. The preferred
|
12
|
+
> way to do this is via Rubygems:
|
13
|
+
>
|
14
|
+
> gem install rdiscount
|
15
|
+
{.exclamation}
|
16
|
+
|
17
|
+
[1]: http://github.com/rtomayko/rdiscount
|
18
|
+
|
19
|
+
Example
|
20
|
+
-------
|
21
|
+
|
22
|
+
Here is a short sample of a text in Markdown markup:
|
23
|
+
|
24
|
+
# This a h1 header
|
25
|
+
|
26
|
+
You can just write *your* paragraphs here and
|
27
|
+
[link][1] them below. This is **nice** format!
|
28
|
+
|
29
|
+
> Citations are easy too.
|
30
|
+
> Really. And you can assign them attributes.
|
31
|
+
|
32
|
+
* Lists
|
33
|
+
* aren't
|
34
|
+
* difficult
|
35
|
+
* either.
|
36
|
+
|
37
|
+
[1]: http://someurl.com
|
@@ -4,7 +4,7 @@ title: Webgen::ContentProcessor::RDoc
|
|
4
4
|
## Description
|
5
5
|
|
6
6
|
This content processors converts content written in RDoc markup (the default documentation format
|
7
|
-
for Ruby source files, [reference][1]) to HTML.
|
7
|
+
for Ruby source files, [reference][1]) to HTML.
|
8
8
|
|
9
9
|
> This extension needs the [new RDoc implementation][2] and is not compatible with the
|
10
10
|
> implementation included in the Ruby distribution. The preferred way to install the new
|
@@ -5,7 +5,6 @@ title: Webgen::ContentProcessor::RedCloth
|
|
5
5
|
|
6
6
|
This processor converts the content, which is assumed to be in Textile markup, to HTML by using the
|
7
7
|
RedCloth library. For detailed information about Textile have a look at the [Textile Reference][1]!
|
8
|
-
The short name of the processor is `redcloth`!
|
9
8
|
|
10
9
|
> This extension is only available if you have installed the [redcloth][2] library. The preferred
|
11
10
|
> way to do this is via Rubygems:
|
@@ -5,7 +5,6 @@ title: Webgen::ContentProcessor::Sass
|
|
5
5
|
|
6
6
|
This processor converts the content, which is assumed to be in the Sass meta language, to valid CSS
|
7
7
|
using the Haml library. For detailed information about Sass have a look at the [Haml Homepage][1]!
|
8
|
-
The short name of the processor is `sass`!
|
9
8
|
|
10
9
|
> This extension is only available if you have installed the [haml][1] library. The preferred way to
|
11
10
|
> do this is via Rubygems:
|
@@ -7,7 +7,7 @@ This processor provides an easy method for adding dynamic content to web pages.
|
|
7
7
|
webgen tags to replace special markup constructs with dynamic content. This system allows webgen to
|
8
8
|
generate menus and breadcrumb trails, include files and much more. webgen already comes with many
|
9
9
|
tags that handle simple things, like including a file, to advanced things, like generating a
|
10
|
-
menu.
|
10
|
+
menu.
|
11
11
|
|
12
12
|
Each webgen tag is defined using a unique name and handled by a tag class. A tag can have zero or
|
13
13
|
more parameters some of which are mandatory. Tag parameters map directly to configuration options,
|
data/doc/extensions.page
CHANGED
@@ -1,14 +1,9 @@
|
|
1
1
|
---
|
2
2
|
title: Extensions
|
3
3
|
---
|
4
|
-
#
|
4
|
+
# Extension Listing
|
5
5
|
|
6
|
-
|
7
|
-
the extensions allows you to use your tools of choice, for example, your preferred markup
|
8
|
-
language. And if your choice is not available, you can write the extension for it yourself or make a
|
9
|
-
feature request!
|
10
|
-
|
11
|
-
Here is a list of all extensions:
|
6
|
+
Following is a listing of all available extensions:
|
12
7
|
|
13
8
|
<%
|
14
9
|
pattern = /#{File.join(node.parent.absolute_lcn, '/')}(contentprocessor|output|source|sourcehandler|tag|)\//
|
data/doc/faq.page
CHANGED
@@ -3,9 +3,36 @@ title: FAQ
|
|
3
3
|
---
|
4
4
|
# General Questions
|
5
5
|
|
6
|
-
|
7
|
-
{.exclamation}
|
6
|
+
* **webgen fails with an error after upgrading to a newer version - what to do?**
|
8
7
|
|
8
|
+
Delete the cache file and try again. The structure of the cache may not be valid anymore after a
|
9
|
+
version update. So it is always good to delete the cache after installing a new webgen version.
|
10
|
+
|
11
|
+
* **Why can I specify multiple blocks in a page/template file?**
|
12
|
+
|
13
|
+
This allows you to provide different content parts for one page. For example, image you have a
|
14
|
+
layout with a sidebar and you want to have page specific sidebar contents. The easiest way to
|
15
|
+
achieve that is to add a `sidebar` block to the page files that provide a page specific sidebar
|
16
|
+
content and conditionally include the `sidebar` block in your `default.template`, like this:
|
17
|
+
|
18
|
+
<%% if node.node_info[:page].blocks.has_key?('sidebar') %>
|
19
|
+
\<webgen:block name='sidebar' />
|
20
|
+
<%% end %>
|
21
|
+
|
22
|
+
* **What do I have to do to use the extensions?**
|
23
|
+
|
24
|
+
Nothing! Extensions are initialized and used automatically when needed. So, for example, if you
|
25
|
+
add a `my.feed` file to your website, the `Webgen::SourceHandler::Feed` extension gets
|
26
|
+
automatically used. The same is true for all types of extensions (source handler, content
|
27
|
+
processors, tags, ...).
|
28
|
+
|
29
|
+
* **Is there any way to add comments to my webgen website?**
|
30
|
+
|
31
|
+
Surely! There are several comment engines out there, however, the following two look very
|
32
|
+
promising:
|
33
|
+
|
34
|
+
* [JS-Kit](http://js-kit.com/comments/)
|
35
|
+
* [DISQUS](http://disqus.com)
|
9
36
|
|
10
37
|
# How to ...
|
11
38
|
|
@@ -53,13 +80,11 @@ The value needs to be a valid ISO-639-1/2 language code.
|
|
53
80
|
If you want to change the processing pipeline (ie. how a page file get rendered), you need to add
|
54
81
|
the following to your configuration file:
|
55
82
|
|
56
|
-
|
57
|
-
|
58
|
-
blocks:
|
59
|
-
default:
|
60
|
-
pipeline: erb,tags,textile,blocks
|
83
|
+
default_processing_pipeline:
|
84
|
+
Page: erb,tags,textile,blocks
|
61
85
|
|
62
|
-
|
86
|
+
The `default_processing_pipeline` key is a special key which allows to directly set the processing
|
87
|
+
pipeline (instead of going through all the meta information).
|
63
88
|
|
64
89
|
If you just want to change the pipeline for one block, you can do it like this:
|
65
90
|
|
@@ -72,7 +97,7 @@ Use the configuration file! For example, to change the meta information `in-menu
|
|
72
97
|
to `true` for all page files use the following in your configuration file:
|
73
98
|
|
74
99
|
default_meta_info:
|
75
|
-
|
100
|
+
Page:
|
76
101
|
inMenu: true
|
77
102
|
|
78
103
|
The key `default_meta_info` is a special key in the configuration file which allows to update the
|
@@ -102,7 +127,7 @@ You have several options of varying granularity:
|
|
102
127
|
output paths of this source handler (the page source handler in the following example):
|
103
128
|
|
104
129
|
default_meta_info:
|
105
|
-
|
130
|
+
Page:
|
106
131
|
output_path_style: [:parent, :cnbase, [., :lang], :ext]
|
107
132
|
|
108
133
|
* Add the meta information `output_path_style` to a single file via, for example, a meta information
|
@@ -151,9 +176,9 @@ There are many ways to accomplish this, I will show only one way here using bloc
|
|
151
176
|
following to the sidebar part in your `default.template` (ensure that you haven't disabled `erb` in
|
152
177
|
the processing pipeline):
|
153
178
|
|
154
|
-
|
179
|
+
<%% if node.node_info[:page].blocks.has_key?('sidebar') %>
|
155
180
|
\<webgen:block name='sidebar' />
|
156
|
-
|
181
|
+
<%% end %>
|
157
182
|
|
158
183
|
This will include the contents of the block `sidebar` in the sidebar if such a block exists for a
|
159
184
|
page. You can then add a sidebar block to each page file which needs it. Following is such a sample
|
@@ -175,3 +200,15 @@ Webgen::ContentProcessor::Builder!
|
|
175
200
|
|
176
201
|
You can use virtual nodes to define virtually any menu structure you like, including things like
|
177
202
|
having menu entries that point to the same page and links to external pages.
|
203
|
+
|
204
|
+
### ... use short menu title?
|
205
|
+
|
206
|
+
You can use a special of the meta information `link_attrs` to achieve that. Just use the following
|
207
|
+
in the meta information block of the page file for which you want a short menu title:
|
208
|
+
|
209
|
+
link_attrs:
|
210
|
+
:link_text: Short title
|
211
|
+
|
212
|
+
> Be aware that this changes not only how the page appears in a menu but also how it appears in
|
213
|
+
> breadcrumb trails and other links generated by webgen.
|
214
|
+
{.exclamation}
|
data/doc/index.page
CHANGED
@@ -3,14 +3,14 @@ title: Overview
|
|
3
3
|
in_menu: false
|
4
4
|
---
|
5
5
|
|
6
|
-
This documentation is for the *repository version*
|
7
|
-
are not available in the latest released version.
|
6
|
+
This documentation is for the *repository version*{: style='color: red; font-weight: bold'} of
|
7
|
+
webgen and therefore may state features that are not available in the latest released version.
|
8
8
|
|
9
|
-
* The documentation for the latest released 0.5.x
|
10
|
-
[here](http://webgen.rubyforge.org/documentation/0.5.x/index.html)
|
9
|
+
* The documentation for the *latest released 0.5.x*{: style='color: red; font-weight: bold'} version
|
10
|
+
can be found [here](http://webgen.rubyforge.org/documentation/0.5.x/index.html)
|
11
11
|
|
12
|
-
* If you are looking for the documentation of the 0.4.x
|
13
|
-
[here](http://webgen.rubyforge.org/documentation/0.4.x/index.html).
|
12
|
+
* If you are looking for the documentation of the *0.4.x*{: style='color: red; font-weight: bold'}
|
13
|
+
series, it can be found [here](http://webgen.rubyforge.org/documentation/0.4.x/index.html).
|
14
14
|
|
15
15
|
If you don't find an answer to your questions in the documentation, there are also:
|
16
16
|
|
@@ -36,9 +36,9 @@ a reference, go to one of the following pages:
|
|
36
36
|
here. After reading the Getting Started Guide, this should be the next read. Have a look at the
|
37
37
|
section headers to get a quick overview of what can be found here.
|
38
38
|
|
39
|
-
* [**FAQ**]({relocatable: faq.html}): If you want to do something with webgen, but you don't know
|
40
|
-
this page is exactly for you. It provides answers to frequently asked questions
|
41
|
-
question which you think should be added, just mail me.
|
39
|
+
* [**FAQ**]({relocatable: faq.html}): If you want to do something with webgen, but you don't know
|
40
|
+
how, this page is exactly for you. It provides answers to frequently asked questions and
|
41
|
+
HowTos. If you have a question which you think should be added, just mail me.
|
42
42
|
|
43
43
|
* [**Upgrade information**]({relocatable: upgrading.html}): This document provides some information
|
44
44
|
on upgrading a website from the 0.4.x to the 0.5.x series.
|
data/doc/manual.page
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
---
|
2
2
|
title: Manual
|
3
3
|
---
|
4
|
+
# Introduction
|
5
|
+
|
6
|
+
This manual describes all of webgen in as much detail as possible. If you still find something
|
7
|
+
missing, don't hesistate to write a mail to the mailing list!
|
8
|
+
|
9
|
+
The manual is structured in such a way that it can be read from top to bottom while creating a
|
10
|
+
webgen website. This means that first the information on how to use the webgen CLI comes, then how a
|
11
|
+
webgen website is structured and how content can be added and so on.
|
12
|
+
|
13
|
+
|
4
14
|
|
5
15
|
# The `webgen` command
|
6
16
|
|
@@ -55,21 +65,23 @@ Following is a short overview of the available commands:
|
|
55
65
|
# A webgen Website {#website}
|
56
66
|
|
57
67
|
webgen needs a special directory structure so that it works out of the box. This directory structure
|
58
|
-
is automatically created by the `webgen create` command.
|
68
|
+
is automatically created by the `webgen create` command. You can alternatively use the webgui to
|
69
|
+
create the website directory.
|
59
70
|
|
60
71
|
The root directory of webgen website is called the website directory. You can have the following
|
61
72
|
files and directories under this directory:
|
62
73
|
|
63
74
|
* `src`: The source directory in which all the source files for the website are. If this directory
|
64
|
-
|
65
|
-
`sources` configuration option.
|
75
|
+
should not be called `src` or you want to include additional source directories, you need to
|
76
|
+
change the `sources` configuration option.
|
66
77
|
|
67
78
|
* `out`: This directory is created, if it does not exist, when webgen generates the HTML files. All
|
68
|
-
the output files are put into this directory.
|
69
|
-
`output` configuration option.
|
79
|
+
the output files are put into this directory. The name of this directory can be changed by setting
|
80
|
+
the `output` configuration option.
|
70
81
|
|
71
82
|
* `ext`: The extension directory (optional). You can put self-written extensions into this directory
|
72
|
-
so that they are used by webgen.
|
83
|
+
so that they are used by webgen. See the [extension directory]({relocatable: '#website-ext'})
|
84
|
+
section for more information.
|
73
85
|
|
74
86
|
* `config.yaml`: This file can be used to set configuration options for the website. See the
|
75
87
|
[Configuration File]({relocatable: '#website-configfile'}) section for more information.
|
@@ -78,6 +90,14 @@ files and directories under this directory:
|
|
78
90
|
some useful tasks out of the box. See the [Rakefile]({relocatable: '#website-rakefile'}) section
|
79
91
|
for more information.
|
80
92
|
|
93
|
+
## Extension Directory {#website-ext}
|
94
|
+
|
95
|
+
The extension directory is used for modifying core behaviour of webgen or adding extensions. It is
|
96
|
+
called `ext` and has to reside directly under the website directory. All files called `init.rb` in
|
97
|
+
this directory or any of its subdirectories are loaded when webgen renders the website. So you need
|
98
|
+
to make sure to either place all extensions in `init.rb` or load them from this file. The latter
|
99
|
+
approach is better since you can use the lazy loading feature that webgen uses internally,
|
100
|
+
ie. extensions are loaded only when they are needed.
|
81
101
|
|
82
102
|
## Configuration File {#website-configfile}
|
83
103
|
|
@@ -123,6 +143,29 @@ keys to help setting these configuration options:
|
|
123
143
|
Page:
|
124
144
|
in_menu: true
|
125
145
|
|
146
|
+
* `default_processing_pipeline`: Set the default processing pipeline for one or more source
|
147
|
+
handlers.
|
148
|
+
|
149
|
+
This key needs a Hash as value which should be of the following form:
|
150
|
+
|
151
|
+
SOURCE_HANDLER_NAME: PIPELINE
|
152
|
+
|
153
|
+
Each key-value pair specifies the name of a source handler and the new default processing
|
154
|
+
pipeline. The value for the processing pipeline has to consist of the short names of content
|
155
|
+
processors separated by commas and normally includes `erb`, `tags`, `blocks` and the name of a
|
156
|
+
content processor for a markup language. The short name(s) of a content processor is (are)
|
157
|
+
stated on its documentation page. Be aware that the content processors are executed in the order
|
158
|
+
in which they are specified!
|
159
|
+
|
160
|
+
If a source handler called `Webgen::SourceHandler::SOURCE_HANDLER_NAME` exists, the meta
|
161
|
+
information is set for this source handler instead.
|
162
|
+
|
163
|
+
For example, the following snippet of a configuration file sets the default processing pipeline
|
164
|
+
for 'Webgen::SourceHandler::Page':
|
165
|
+
|
166
|
+
default_processing_pipeline:
|
167
|
+
Page: erb,tags,textile,blocks
|
168
|
+
|
126
169
|
* `patterns`: Set the used path patterns for one or more source handlers.
|
127
170
|
|
128
171
|
This key needs a Hash value and provides two different ways of setting the path patterns:
|
@@ -146,8 +189,6 @@ keys to help setting these configuration options:
|
|
146
189
|
Copy:
|
147
190
|
add: [**/*.pdf]
|
148
191
|
|
149
|
-
|
150
|
-
|
151
192
|
## Rakefile {#website-rakefile}
|
152
193
|
|
153
194
|
The Rakefile that is automatically created upon website creation provides a place to specify
|
@@ -183,8 +224,8 @@ You can naturally use any other type of file. However, be aware that some files
|
|
183
224
|
by webgen when no source handler class for them exists. For example, there is currently no source
|
184
225
|
handler class for `.svg` files, so those files would be ignored. If you just want to have files
|
185
226
|
copied from a source to the output directory (like images or CSS files), the SourceHandler::Copy
|
186
|
-
class is what you need! Look through the documentation of the availabe source handler
|
187
|
-
a feeling of what files are handled by webgen.
|
227
|
+
class is what you need! Look through the documentation of the [availabe source handler
|
228
|
+
classes]({relocatable: extensions.html}) to get a feeling of what files are handled by webgen.
|
188
229
|
|
189
230
|
|
190
231
|
## Source Paths Naming Convention {#source-naming}
|
@@ -270,6 +311,10 @@ the (localized) canonical name! This is different from previous webgen versions!
|
|
270
311
|
|
271
312
|
## Output Path Name Construction ### {#source-output}
|
272
313
|
|
314
|
+
There is currently only one method, called `standard`, for creating output path names which is
|
315
|
+
described here. However, webgen allows developers to create other output path name creation
|
316
|
+
methods. More information on this can be found in the [API documentation]({relocatable: api.html}).
|
317
|
+
|
273
318
|
The output path for a given source path is constructed using the meta information
|
274
319
|
`output_path_style`. This meta information is set to a default value and can be overwritten by
|
275
320
|
setting it for a specific source handler or for a path individually. The value for this meta
|
@@ -278,10 +323,12 @@ information key is an array which can have the following values:
|
|
278
323
|
* strings (for inserting arbitrary text into output names)
|
279
324
|
* arrays (for grouping values - only interesting for the language part)
|
280
325
|
* symbols for inserting special values:
|
281
|
-
* `:cnbase`:
|
282
|
-
* `:parent`:
|
283
|
-
* `:lang`:
|
284
|
-
* `:ext`:
|
326
|
+
* `:cnbase`: The basename of the path.
|
327
|
+
* `:parent`: The parent path.
|
328
|
+
* `:lang`: The language.
|
329
|
+
* `:ext`: The file extension including the leading dot.
|
330
|
+
* `:year`, `:month`, `:day`: The creation year, month and day, respectively, of the source path.
|
331
|
+
An error is raised if the needed meta information `created_at` is not set on the path.
|
285
332
|
|
286
333
|
> The contructed output path must always be an absolute one, ie. it has to start at the root of the
|
287
334
|
> output directory. Therefore, the `:parent` part should always be included!
|
@@ -315,7 +362,13 @@ the default language and that the path is under a directory called `/img/`):
|
|
315
362
|
|
316
363
|
* `index.jpg` --> `/img/index.jpg.`
|
317
364
|
|
318
|
-
Be aware of the trailing dot since the `:lang` value is not defined in
|
365
|
+
Be aware of the trailing dot since the `:lang` value is not defined in a sub array!
|
366
|
+
|
367
|
+
* `output_path_style=[:parent, :year, /, :month, /, :cnbase, [., :lang], :ext]`
|
368
|
+
|
369
|
+
* `index.jpg` --> `/img/2008/09/index.jpg`
|
370
|
+
|
371
|
+
This output path style can be used to create blog archive style output names.
|
319
372
|
|
320
373
|
|
321
374
|
## Path Patterns {#source-pathpattern}
|
@@ -429,16 +482,51 @@ There is clearly defined order in which meta information is applied to a node fo
|
|
429
482
|
|
430
483
|
|
431
484
|
|
485
|
+
# webgen Extensions
|
486
|
+
|
487
|
+
webgen comes with many extensions that allow for rapid creation of static websites. The variety of
|
488
|
+
the extensions allows you to use your tools of choice, for example, your preferred markup
|
489
|
+
language. And if your choice is not available, you can write the extension for it yourself or make a
|
490
|
+
feature request!
|
491
|
+
|
492
|
+
Extensions are only loaded when they are needed. For example, if you don't use `.feed` files for
|
493
|
+
automatically generating atom/RSS feeds for your website, the source handler that handles these
|
494
|
+
files will never be loaded. Therefore you don't need to explicitly enable extensions, they just sit
|
495
|
+
in the background and wait till the webgen core needs them.
|
496
|
+
|
497
|
+
There are several types of extensions:
|
498
|
+
|
499
|
+
* **Content Processors**: These extensions process content, for example, the content of files in
|
500
|
+
Webgen Page Format. It is not specified how they have to process the content but this type of
|
501
|
+
extension can basically be divided into two groups:
|
502
|
+
|
503
|
+
* Markup processors: Processors like Maruku or RedCloth belong to this group and they convert
|
504
|
+
markup text that is easy to read and write to a more structure format like HTML. This allows
|
505
|
+
you to write an HTML page without knowing HTML.
|
506
|
+
|
507
|
+
* String replacers: These processors normally process special strings and substitute them with
|
508
|
+
other content. For example, the `erb` processors replaces delimited strings interpreted as
|
509
|
+
Ruby code with the interpreted value. Another example would be webgen's `tags` processor which
|
510
|
+
replaces strings like `\{relocatable: ../index.html}` with a processed value.
|
511
|
+
|
512
|
+
* **Source Handler**: These extensions are used for handling source paths. They read the content of
|
513
|
+
a path and produce one or more nodes (the internal representation of an output path, see [source
|
514
|
+
handling]({relocatable: '#source-handling'}) for more information on nodes). So a source handler
|
515
|
+
can do something simple like just copying a source path to the output directory but they can
|
516
|
+
also do complex things like creating a whole image gallery from just one source path.
|
517
|
+
|
518
|
+
* **Tags**: This type of extension allows the easy inclusion of dynamic content in, for example,
|
519
|
+
page and template files. Each tag extension is used for a specific task like creating a menu or
|
520
|
+
a breadcrumb trail.
|
521
|
+
|
522
|
+
|
523
|
+
|
432
524
|
# Extending webgen
|
433
525
|
|
434
526
|
If you know the programming language Ruby a little bit, you can easily extend webgen and add new
|
435
527
|
features that you need. All the needed developer documentation is available in the [API
|
436
528
|
documentation](rdoc/index.html), along with sample implementations for all major types of extensions
|
437
529
|
(source class, output classes, source handler class, content processors classes, tag classes, ...)
|
438
|
-
and detailed information about the inner workings of webgen.
|
439
|
-
|
440
|
-
|
441
|
-
website directory. All files called `init.rb` in any directory are loaded when the Webgen::Website
|
442
|
-
gets initialized. So you need to make sure to either place all extensions in `init.rb` or load them
|
443
|
-
from this file.
|
444
|
-
|
530
|
+
and detailed information about the inner workings of webgen. Have a look at the [extension
|
531
|
+
directory]({relocatable: '#website-ext'}) section for more information on naming files and where to
|
532
|
+
put the extensions.
|