gettalong-webgen 0.5.4.20080929
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +5 -0
- data/COPYING +10 -0
- data/GPL +340 -0
- data/Rakefile +324 -0
- data/THANKS +17 -0
- data/bin/webgen +10 -0
- data/data/webgen/resources.yaml +3 -0
- data/data/webgen/webgui/controller/main.rb +129 -0
- data/data/webgen/webgui/overrides/win32console.rb +0 -0
- data/data/webgen/webgui/public/css/jquery.autocomplete.css +50 -0
- data/data/webgen/webgui/public/css/ramaze_error.css +90 -0
- data/data/webgen/webgui/public/css/style.css +55 -0
- data/data/webgen/webgui/public/img/headerbg.jpg +0 -0
- data/data/webgen/webgui/public/img/webgen_logo.png +0 -0
- data/data/webgen/webgui/public/js/jquery.autocomplete.js +15 -0
- data/data/webgen/webgui/public/js/jquery.js +32 -0
- data/data/webgen/webgui/view/create_website.xhtml +22 -0
- data/data/webgen/webgui/view/error.xhtml +64 -0
- data/data/webgen/webgui/view/index.xhtml +22 -0
- data/data/webgen/webgui/view/manage_website.xhtml +18 -0
- data/data/webgen/webgui/view/page.xhtml +40 -0
- data/data/webgen/website_skeleton/README +10 -0
- data/data/webgen/website_skeleton/Rakefile +40 -0
- data/data/webgen/website_skeleton/config.yaml +17 -0
- data/data/webgen/website_skeleton/ext/init.rb +6 -0
- data/data/webgen/website_styles/1024px/README +13 -0
- data/data/webgen/website_styles/1024px/src/default.css +188 -0
- data/data/webgen/website_styles/1024px/src/default.template +60 -0
- data/data/webgen/website_styles/1024px/src/images/background.gif +0 -0
- data/data/webgen/website_styles/andreas00/README +13 -0
- data/data/webgen/website_styles/andreas00/src/default.css +290 -0
- data/data/webgen/website_styles/andreas00/src/default.template +60 -0
- data/data/webgen/website_styles/andreas00/src/images/bg.gif +0 -0
- data/data/webgen/website_styles/andreas00/src/images/front.jpg +0 -0
- data/data/webgen/website_styles/andreas00/src/images/menubg.gif +0 -0
- data/data/webgen/website_styles/andreas00/src/images/menubg2.gif +0 -0
- data/data/webgen/website_styles/andreas01/README +14 -0
- data/data/webgen/website_styles/andreas01/src/default.css +310 -0
- data/data/webgen/website_styles/andreas01/src/default.template +61 -0
- data/data/webgen/website_styles/andreas01/src/images/bg.gif +0 -0
- data/data/webgen/website_styles/andreas01/src/images/front.jpg +0 -0
- data/data/webgen/website_styles/andreas01/src/print.css +35 -0
- data/data/webgen/website_styles/andreas03/README +14 -0
- data/data/webgen/website_styles/andreas03/src/default.css +223 -0
- data/data/webgen/website_styles/andreas03/src/default.template +58 -0
- data/data/webgen/website_styles/andreas03/src/images/bodybg.png +0 -0
- data/data/webgen/website_styles/andreas03/src/images/contbg.png +0 -0
- data/data/webgen/website_styles/andreas03/src/images/footerbg.png +0 -0
- data/data/webgen/website_styles/andreas03/src/images/gradient1.png +0 -0
- data/data/webgen/website_styles/andreas03/src/images/gradient2.png +0 -0
- data/data/webgen/website_styles/andreas04/README +15 -0
- data/data/webgen/website_styles/andreas04/src/default.css +290 -0
- data/data/webgen/website_styles/andreas04/src/default.template +81 -0
- data/data/webgen/website_styles/andreas04/src/images/blinkarrow.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/bodybg.png +0 -0
- data/data/webgen/website_styles/andreas04/src/images/contentbg.png +0 -0
- data/data/webgen/website_styles/andreas04/src/images/entrybg.png +0 -0
- data/data/webgen/website_styles/andreas04/src/images/flash.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/flash2.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/globe.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/globebottom.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/linkarrow.gif +0 -0
- data/data/webgen/website_styles/andreas04/src/images/menuhover.png +0 -0
- data/data/webgen/website_styles/andreas05/README +14 -0
- data/data/webgen/website_styles/andreas05/src/default.css +33 -0
- data/data/webgen/website_styles/andreas05/src/default.template +40 -0
- data/data/webgen/website_styles/andreas05/src/images/bodybg.gif +0 -0
- data/data/webgen/website_styles/andreas05/src/images/front.png +0 -0
- data/data/webgen/website_styles/andreas06/README +14 -0
- data/data/webgen/website_styles/andreas06/src/default.css +354 -0
- data/data/webgen/website_styles/andreas06/src/default.template +70 -0
- data/data/webgen/website_styles/andreas06/src/images/bodybg.gif +0 -0
- data/data/webgen/website_styles/andreas06/src/images/boxbg.gif +0 -0
- data/data/webgen/website_styles/andreas06/src/images/greypx.gif +0 -0
- data/data/webgen/website_styles/andreas06/src/images/header.jpg +0 -0
- data/data/webgen/website_styles/andreas06/src/images/innerbg.gif +0 -0
- data/data/webgen/website_styles/andreas06/src/images/leaves.jpg +0 -0
- data/data/webgen/website_styles/andreas06/src/images/tabs.gif +0 -0
- data/data/webgen/website_styles/andreas07/README +15 -0
- data/data/webgen/website_styles/andreas07/src/browserfix.css +7 -0
- data/data/webgen/website_styles/andreas07/src/default.css +92 -0
- data/data/webgen/website_styles/andreas07/src/default.template +42 -0
- data/data/webgen/website_styles/andreas07/src/images/bodybg.gif +0 -0
- data/data/webgen/website_styles/andreas07/src/images/sidebarbg.gif +0 -0
- data/data/webgen/website_styles/andreas08/README +14 -0
- data/data/webgen/website_styles/andreas08/src/default.css +224 -0
- data/data/webgen/website_styles/andreas08/src/default.template +51 -0
- data/data/webgen/website_styles/andreas09/README +14 -0
- data/data/webgen/website_styles/andreas09/src/default.css +308 -0
- data/data/webgen/website_styles/andreas09/src/default.template +68 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-black.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-green.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-orange.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-purple.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg-red.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/bodybg.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/footerbg.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-black.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-green.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-orange.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-purple.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover-red.jpg +0 -0
- data/data/webgen/website_styles/andreas09/src/images/menuhover.jpg +0 -0
- data/data/webgen/website_styles/simple/README +6 -0
- data/data/webgen/website_styles/simple/src/default.css +84 -0
- data/data/webgen/website_styles/simple/src/default.template +36 -0
- data/data/webgen/website_templates/default/README +6 -0
- data/data/webgen/website_templates/default/src/index.page +8 -0
- data/data/webgen/website_templates/project/README +5 -0
- data/data/webgen/website_templates/project/src/about.page +12 -0
- data/data/webgen/website_templates/project/src/download.page +15 -0
- data/data/webgen/website_templates/project/src/features.page +8 -0
- data/data/webgen/website_templates/project/src/index.page +9 -0
- data/data/webgen/website_templates/project/src/screenshots.page +18 -0
- data/doc/contentprocessor.template +11 -0
- data/doc/contentprocessor/blocks.page +66 -0
- data/doc/contentprocessor/builder.page +80 -0
- data/doc/contentprocessor/erb.page +56 -0
- data/doc/contentprocessor/erubis.page +46 -0
- data/doc/contentprocessor/haml.page +47 -0
- data/doc/contentprocessor/maruku.page +41 -0
- data/doc/contentprocessor/rdiscount.page +37 -0
- data/doc/contentprocessor/rdoc.page +36 -0
- data/doc/contentprocessor/redcloth.page +39 -0
- data/doc/contentprocessor/sass.page +31 -0
- data/doc/contentprocessor/tags.page +73 -0
- data/doc/extensions.metainfo +29 -0
- data/doc/extensions.page +16 -0
- data/doc/extensions.template +17 -0
- data/doc/faq.page +214 -0
- data/doc/getting_started.page +134 -0
- data/doc/index.page +65 -0
- data/doc/manual.page +532 -0
- data/doc/reference_configuration.page +646 -0
- data/doc/reference_metainfo.page +213 -0
- data/doc/sourcehandler.template +21 -0
- data/doc/sourcehandler/copy.page +19 -0
- data/doc/sourcehandler/directory.page +27 -0
- data/doc/sourcehandler/feed.page +82 -0
- data/doc/sourcehandler/metainfo.page +41 -0
- data/doc/sourcehandler/page.page +30 -0
- data/doc/sourcehandler/sitemap.page +46 -0
- data/doc/sourcehandler/template.page +45 -0
- data/doc/sourcehandler/virtual.page +49 -0
- data/doc/tag.template +25 -0
- data/doc/tag/breadcrumbtrail.page +40 -0
- data/doc/tag/coderay.page +49 -0
- data/doc/tag/date.page +31 -0
- data/doc/tag/executecommand.page +26 -0
- data/doc/tag/includefile.page +32 -0
- data/doc/tag/langbar.page +22 -0
- data/doc/tag/menu.page +92 -0
- data/doc/tag/metainfo.page +29 -0
- data/doc/tag/relocatable.page +38 -0
- data/doc/tag/sitemap.page +31 -0
- data/doc/upgrading.page +139 -0
- data/doc/webgen_page_format.page +128 -0
- data/lib/webgen/blackboard.rb +73 -0
- data/lib/webgen/cache.rb +85 -0
- data/lib/webgen/cli.rb +118 -0
- data/lib/webgen/cli/create_command.rb +64 -0
- data/lib/webgen/cli/run_command.rb +20 -0
- data/lib/webgen/cli/utils.rb +86 -0
- data/lib/webgen/cli/webgui_command.rb +49 -0
- data/lib/webgen/common.rb +10 -0
- data/lib/webgen/common/sitemap.rb +76 -0
- data/lib/webgen/configuration.rb +147 -0
- data/lib/webgen/contentprocessor.rb +96 -0
- data/lib/webgen/contentprocessor/blocks.rb +46 -0
- data/lib/webgen/contentprocessor/builder.rb +26 -0
- data/lib/webgen/contentprocessor/context.rb +90 -0
- data/lib/webgen/contentprocessor/erb.rb +24 -0
- data/lib/webgen/contentprocessor/erubis.rb +40 -0
- data/lib/webgen/contentprocessor/haml.rb +25 -0
- data/lib/webgen/contentprocessor/maruku.rb +18 -0
- data/lib/webgen/contentprocessor/rdiscount.rb +15 -0
- data/lib/webgen/contentprocessor/rdoc.rb +17 -0
- data/lib/webgen/contentprocessor/redcloth.rb +15 -0
- data/lib/webgen/contentprocessor/sass.rb +18 -0
- data/lib/webgen/contentprocessor/tags.rb +134 -0
- data/lib/webgen/coreext.rb +10 -0
- data/lib/webgen/default_config.rb +198 -0
- data/lib/webgen/languages.rb +578 -0
- data/lib/webgen/loggable.rb +23 -0
- data/lib/webgen/logger.rb +78 -0
- data/lib/webgen/node.rb +347 -0
- data/lib/webgen/output.rb +37 -0
- data/lib/webgen/output/filesystem.rb +67 -0
- data/lib/webgen/page.rb +133 -0
- data/lib/webgen/path.rb +182 -0
- data/lib/webgen/source.rb +24 -0
- data/lib/webgen/source/filesystem.rb +58 -0
- data/lib/webgen/source/resource.rb +42 -0
- data/lib/webgen/source/stacked.rb +53 -0
- data/lib/webgen/sourcehandler.rb +202 -0
- data/lib/webgen/sourcehandler/base.rb +211 -0
- data/lib/webgen/sourcehandler/copy.rb +41 -0
- data/lib/webgen/sourcehandler/directory.rb +31 -0
- data/lib/webgen/sourcehandler/feed.rb +121 -0
- data/lib/webgen/sourcehandler/fragment.rb +71 -0
- data/lib/webgen/sourcehandler/metainfo.rb +117 -0
- data/lib/webgen/sourcehandler/page.rb +77 -0
- data/lib/webgen/sourcehandler/sitemap.rb +60 -0
- data/lib/webgen/sourcehandler/template.rb +68 -0
- data/lib/webgen/sourcehandler/virtual.rb +75 -0
- data/lib/webgen/tag.rb +23 -0
- data/lib/webgen/tag/base.rb +162 -0
- data/lib/webgen/tag/breadcrumbtrail.rb +71 -0
- data/lib/webgen/tag/coderay.rb +32 -0
- data/lib/webgen/tag/date.rb +18 -0
- data/lib/webgen/tag/executecommand.rb +29 -0
- data/lib/webgen/tag/includefile.rb +42 -0
- data/lib/webgen/tag/langbar.rb +52 -0
- data/lib/webgen/tag/menu.rb +186 -0
- data/lib/webgen/tag/metainfo.rb +25 -0
- data/lib/webgen/tag/relocatable.rb +53 -0
- data/lib/webgen/tag/sitemap.rb +42 -0
- data/lib/webgen/tree.rb +80 -0
- data/lib/webgen/version.rb +6 -0
- data/lib/webgen/webgentask.rb +148 -0
- data/lib/webgen/website.rb +214 -0
- data/lib/webgen/websiteaccess.rb +29 -0
- data/lib/webgen/websitemanager.rb +125 -0
- data/man/man1/webgen.1 +67 -0
- data/misc/default.css +360 -0
- data/misc/default.template +75 -0
- data/misc/htmldoc.metainfo +25 -0
- data/misc/htmldoc.virtual +5 -0
- data/misc/images/arrow.gif +0 -0
- data/misc/images/error.gif +0 -0
- data/misc/images/exclamation.gif +0 -0
- data/misc/images/headerbg.jpg +0 -0
- data/misc/images/information.gif +0 -0
- data/misc/images/quote.gif +0 -0
- data/setup.rb +1585 -0
- data/test/helper.rb +41 -0
- data/test/test_blackboard.rb +58 -0
- data/test/test_cache.rb +57 -0
- data/test/test_common_sitemap.rb +56 -0
- data/test/test_configuration.rb +66 -0
- data/test/test_contentprocessor.rb +31 -0
- data/test/test_contentprocessor_blocks.rb +34 -0
- data/test/test_contentprocessor_builder.rb +19 -0
- data/test/test_contentprocessor_context.rb +38 -0
- data/test/test_contentprocessor_erb.rb +20 -0
- data/test/test_contentprocessor_erubis.rb +47 -0
- data/test/test_contentprocessor_haml.rb +20 -0
- data/test/test_contentprocessor_maruku.rb +27 -0
- data/test/test_contentprocessor_rdiscount.rb +15 -0
- data/test/test_contentprocessor_rdoc.rb +16 -0
- data/test/test_contentprocessor_redcloth.rb +12 -0
- data/test/test_contentprocessor_sass.rb +20 -0
- data/test/test_contentprocessor_tags.rb +97 -0
- data/test/test_languages.rb +53 -0
- data/test/test_loggable.rb +30 -0
- data/test/test_logger.rb +73 -0
- data/test/test_node.rb +339 -0
- data/test/test_output_filesystem.rb +58 -0
- data/test/test_page.rb +203 -0
- data/test/test_path.rb +131 -0
- data/test/test_source_filesystem.rb +59 -0
- data/test/test_source_resource.rb +26 -0
- data/test/test_source_stacked.rb +34 -0
- data/test/test_sourcehandler_base.rb +92 -0
- data/test/test_sourcehandler_copy.rb +45 -0
- data/test/test_sourcehandler_directory.rb +25 -0
- data/test/test_sourcehandler_feed.rb +74 -0
- data/test/test_sourcehandler_fragment.rb +67 -0
- data/test/test_sourcehandler_metainfo.rb +93 -0
- data/test/test_sourcehandler_page.rb +70 -0
- data/test/test_sourcehandler_sitemap.rb +47 -0
- data/test/test_sourcehandler_template.rb +63 -0
- data/test/test_sourcehandler_virtual.rb +56 -0
- data/test/test_tag_base.rb +82 -0
- data/test/test_tag_breadcrumbtrail.rb +89 -0
- data/test/test_tag_coderay.rb +30 -0
- data/test/test_tag_date.rb +16 -0
- data/test/test_tag_executecommand.rb +39 -0
- data/test/test_tag_includefile.rb +48 -0
- data/test/test_tag_langbar.rb +60 -0
- data/test/test_tag_menu.rb +195 -0
- data/test/test_tag_metainfo.rb +17 -0
- data/test/test_tag_relocatable.rb +57 -0
- data/test/test_tag_sitemap.rb +44 -0
- data/test/test_tree.rb +69 -0
- data/test/test_webgentask.rb +21 -0
- data/test/test_website.rb +96 -0
- data/test/test_websiteaccess.rb +23 -0
- data/test/test_websitemanager.rb +68 -0
- metadata +575 -0
@@ -0,0 +1,134 @@
|
|
1
|
+
---
|
2
|
+
title: Getting Started Guide
|
3
|
+
---
|
4
|
+
## Tutorial: Creating a Basic Website
|
5
|
+
|
6
|
+
|
7
|
+
### Creating the Basic Directories
|
8
|
+
|
9
|
+
webgen needs a special directory structure so that it works out of the box. Basically, you have a
|
10
|
+
website directory under which the following directories are located:
|
11
|
+
|
12
|
+
* `src`: The source directory in which all the source files for the website are.
|
13
|
+
|
14
|
+
* `out`: This directory is created, if it does not exist, when webgen generates the HTML files. All
|
15
|
+
the output files are put into this directory.
|
16
|
+
|
17
|
+
* `ext`: The extension directory (optional). You can put self-written extensions into this directory
|
18
|
+
so that they are used by webgen.
|
19
|
+
|
20
|
+
The directory in which these directories are in is called the *website directory*.
|
21
|
+
|
22
|
+
Don't worry too much about these directories since webgen is able to create the correct directory
|
23
|
+
structure for you. By running the command `webgen create sample_site`, the website directory
|
24
|
+
`sample_site` is created with the default website template and website style. You can naturally use
|
25
|
+
any available template or style by passing their names to the respective options of the `create`
|
26
|
+
command.
|
27
|
+
|
28
|
+
> A *website template* provides a starting point for your website. For example, the `project`
|
29
|
+
> template defines several pages including a features and about page.
|
30
|
+
>
|
31
|
+
> A *website style* defines the look and feel of your website. webgen comes with many predefined
|
32
|
+
> styles (nearly all of them are converted open source web design styles).
|
33
|
+
{.information}
|
34
|
+
|
35
|
+
Don't worry if you don't like the used website style - you can easily change it later. Have a look
|
36
|
+
at [the examples section](0.4.x/examples/website_styles/index.html) (note: these are still the
|
37
|
+
example from the previous version of webgen but the styles haven't changed) to see demonstrations
|
38
|
+
for all shipped website templates and styles!
|
39
|
+
|
40
|
+
Since the basic parts are now in place, you can generate the HTML files. There are two
|
41
|
+
possibilities:
|
42
|
+
|
43
|
+
* Either you change into the `sample_site` directory and run the command `webgen`.
|
44
|
+
|
45
|
+
* Or you run webgen from any directory and specify the website directory using the `-d` option, for
|
46
|
+
example `webgen -d sample_site`.
|
47
|
+
|
48
|
+
Easy! webgen has used all files in the `src` directory and created the HTML output in the directory
|
49
|
+
`out`. Now you just need to open the `out/index.html` file to view your website! However, as we did
|
50
|
+
not write any content yet, there is not much to see (only the default pages). So let's do that now!
|
51
|
+
|
52
|
+
> Since webgen automatically creates relative links, you will have a fully functional website
|
53
|
+
> without needing a web server! This also implies that you can deploy your website to any directory
|
54
|
+
> on your web server and it will just work!
|
55
|
+
{.information}
|
56
|
+
|
57
|
+
|
58
|
+
### Adding Content
|
59
|
+
|
60
|
+
When using the `create` command, webgen does not only create the needed directories but it also
|
61
|
+
provides you with some default files, you will normally have at least the following ones:
|
62
|
+
|
63
|
+
* `src/default.template`: The default template for the new website.
|
64
|
+
* `src/default.css`: The default css file for the new website.
|
65
|
+
* `src/index.page`: The index file for the root directory of the website.
|
66
|
+
* `config.yaml`: The configuration file for setting configuration options.
|
67
|
+
|
68
|
+
> *Template files* and *page files* are the heart of webgen. Template files are used to define a
|
69
|
+
> general layout for web pages and page files define the real content. Both file types are written
|
70
|
+
> in [Webgen Page Format]({relocatable: webgen_page_format.html}). Page files are normally written
|
71
|
+
> in a markup language like Markdown or Textile which is easier to learn and edit for non-technical
|
72
|
+
> persons.
|
73
|
+
{.information}
|
74
|
+
|
75
|
+
The basic scaffolding is already in place. Now we only have to adapt the page file `index.page` and
|
76
|
+
add other page files.
|
77
|
+
|
78
|
+
All page files are written using the Webgen Page Format. Basically, you have an optional meta
|
79
|
+
information block at the beginning of the file and one or more content blocks. Blocks are separated
|
80
|
+
by three dashes (ie. `---`) on a separate line and if you want to have a meta information block you
|
81
|
+
need to have a block separator line at the beginning of your file.
|
82
|
+
|
83
|
+
Open the file `index.page` in your favorite text editor and change its content (ie. the first
|
84
|
+
content block). After that create a new file, `hello.page`, in the source directory with the
|
85
|
+
following content:
|
86
|
+
|
87
|
+
---
|
88
|
+
title: Sample hello page
|
89
|
+
in_menu: true
|
90
|
+
---
|
91
|
+
This is a sample page with the title "\{title:}" and it is in the menu!!!
|
92
|
+
|
93
|
+
We define two meta information items (namely `title` and `in_menu`) and added some content to the
|
94
|
+
first content block. Run webgen again and open `out/index.html` to view your changes. Add
|
95
|
+
page files and other content to your website and let it grow!
|
96
|
+
|
97
|
+
|
98
|
+
### Adding Dynamic Content
|
99
|
+
|
100
|
+
A static website is, as the name implies, static. However, since we generate the website it is
|
101
|
+
possible to add some dynamicity to it. For example, it gets very tedious to update menu links every
|
102
|
+
time we add a file that should be in the menu.
|
103
|
+
|
104
|
+
Therefore webgen provides two ways to add dynamic content out of the box:
|
105
|
+
|
106
|
+
* *ERB*: This term stands for "embedded ruby". It means that you can embed ruby statements in page
|
107
|
+
and templates files that get evaluated when the files are rendered.
|
108
|
+
|
109
|
+
* *webgen tags*: These are a way to add dynamic content without knowing a programming language
|
110
|
+
(although limiting you to the existing tags). You just state what tag you want to use and it does
|
111
|
+
its job. For example, there exists a very flexible menu generation tag.
|
112
|
+
|
113
|
+
You have already encountered a webgen tag in the last section when you created the `hello.page`
|
114
|
+
file: the `\{title:}` part. webgen tags can generally be specified like this: `\{tagname: {param:
|
115
|
+
value, param2: value2}}`. For detailed information on tags have a look at the
|
116
|
+
[Webgen::ContentProcessor::Tags]({relocatable: contentprocessor/tags.html}) documentation.
|
117
|
+
|
118
|
+
|
119
|
+
### Setting configuration options
|
120
|
+
|
121
|
+
webgen provides a default configuration out of the box. If you can live with that, you do not need
|
122
|
+
to change any configuration option. However, most users need to change some configuration option
|
123
|
+
sometime. The configuration file is called `config.yaml` and has to be placed directly under the
|
124
|
+
website directory. It uses YAML as file format.
|
125
|
+
|
126
|
+
> Have a look at the [Configuration Options Reference]({relocatable: reference_configuration.html})
|
127
|
+
> to get an overview over all available configuration options.
|
128
|
+
{.information}
|
129
|
+
|
130
|
+
Each configuration option can be set in the configuration file by specifing the configuration option
|
131
|
+
name and the new value as a key/value pair. A sample configuration file looks like this:
|
132
|
+
|
133
|
+
website.lang: de
|
134
|
+
website.link_to_current_page: true
|
data/doc/index.page
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
title: Overview
|
3
|
+
in_menu: false
|
4
|
+
---
|
5
|
+
|
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
|
+
|
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
|
+
|
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
|
+
|
15
|
+
If you don't find an answer to your questions in the documentation, there are also:
|
16
|
+
|
17
|
+
* [forums][forum] hosted on Rubyforge
|
18
|
+
* [mailing lists][ml] hosted on Rubyforge (the `webgen-users` mailing list is mirrored to the
|
19
|
+
[webgen-users google group][google-group])
|
20
|
+
* the IRC channel `#webgen` on Freenode where I can be found whenever I'm online.
|
21
|
+
|
22
|
+
[forum]: http://rubyforge.org/forum/?group_id=296
|
23
|
+
[ml]: http://rubyforge.org/mail/?group_id=296
|
24
|
+
[google-group]: http://groups.google.com/group/webgen-users/
|
25
|
+
|
26
|
+
# User Documentation
|
27
|
+
|
28
|
+
Depending on whether you are new to webgen, you want more information about a specific topic or read
|
29
|
+
a reference, go to one of the following pages:
|
30
|
+
|
31
|
+
* [**Getting Started Guide**]({relocatable: getting_started.html}): If you are new to webgen, this
|
32
|
+
should be your first read. It explains the usage of the CLI command and how to create your first
|
33
|
+
website with webgen.
|
34
|
+
|
35
|
+
* [**Manual**]({relocatable: manual.html}): Detailed information about how webgen works can be found
|
36
|
+
here. After reading the Getting Started Guide, this should be the next read. Have a look at the
|
37
|
+
section headers to get a quick overview of what can be found here.
|
38
|
+
|
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
|
+
|
43
|
+
* [**Upgrade information**]({relocatable: upgrading.html}): This document provides some information
|
44
|
+
on upgrading a website from the 0.4.x to the 0.5.x series.
|
45
|
+
|
46
|
+
|
47
|
+
Following is a list of all the reference documentation of webgen:
|
48
|
+
|
49
|
+
* [**Extensions Documentation**]({relocatable: extensions.html}): Detailed information on every usage
|
50
|
+
related extension class (**source handlers, tags, content processors**, ...)
|
51
|
+
|
52
|
+
* [**Webgen Page Format**]({relocatable: webgen_page_format.html}): Information about/Specification of
|
53
|
+
the format used, for example, by page and template files
|
54
|
+
|
55
|
+
* [**Meta Information Reference**]({relocatable: reference_metainfo.html}): Descriptions for every
|
56
|
+
meta information key that is used by webgen.
|
57
|
+
|
58
|
+
* [**Configuration Options Reference**]({relocatable: reference_configuration.html}): Overview of all
|
59
|
+
configuration options.
|
60
|
+
|
61
|
+
# Developer Documentation
|
62
|
+
|
63
|
+
webgen makes it easy to extend its functionality by writing simple extension classes. All
|
64
|
+
information about how to do this is provided in the [API documentation](rdoc/index.html). You will
|
65
|
+
also find examples for all existing extension types there.
|
data/doc/manual.page
ADDED
@@ -0,0 +1,532 @@
|
|
1
|
+
---
|
2
|
+
title: Manual
|
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
|
+
|
14
|
+
|
15
|
+
# The `webgen` command
|
16
|
+
|
17
|
+
The executable for webgen is called... webgen ;-) It uses a command style syntax (like Subversion's
|
18
|
+
`svn` or Rubygem's `gem` commands) through the [cmdparse] library. To get an overview of the
|
19
|
+
possible commands run `webgen help`.
|
20
|
+
|
21
|
+
The main command is the `render` command which does the actual website generation. This command uses
|
22
|
+
the current working directory as website directory if none was specified via the gloabl `-d` option.
|
23
|
+
|
24
|
+
You can invoke a command by specifying its name after the executable name. Also counting the
|
25
|
+
executable `webgen` as a command, the options for a command are specified directly after the command
|
26
|
+
name and before the next command or any arguments. For example, all the following command lines are
|
27
|
+
valid:
|
28
|
+
|
29
|
+
$ webgen
|
30
|
+
$ webgen render
|
31
|
+
$ webgen -d doc render
|
32
|
+
$ webgen -v create -t project new_site
|
33
|
+
$ webgen help create
|
34
|
+
|
35
|
+
Following is a short overview of the available commands:
|
36
|
+
|
37
|
+
* `create [-t TEMPLATE] [-s STYLE] SITE_DIR`
|
38
|
+
|
39
|
+
Creates a basic webgen website in `SITE_DIR` using the optional template and styles. All
|
40
|
+
available templates and styles are listed in the help output for the command.
|
41
|
+
|
42
|
+
* `help`
|
43
|
+
|
44
|
+
Displays usage information. Can be used to show information about a command by using the command
|
45
|
+
name as argument, eg. `webgen help create`.
|
46
|
+
|
47
|
+
* `render`
|
48
|
+
|
49
|
+
Renders the given webgen website.
|
50
|
+
|
51
|
+
* `version`
|
52
|
+
|
53
|
+
Displays the version of webgen.
|
54
|
+
|
55
|
+
* `webgui`
|
56
|
+
|
57
|
+
Starts the webgen webgui, a browser based graphical user interface for managing webgen
|
58
|
+
websites. First the webgui web application is started and then the webgui is opened in the
|
59
|
+
default browser.
|
60
|
+
|
61
|
+
[cmdparse]: http://cmdparse.rubyforge.org
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
# A webgen Website {#website}
|
66
|
+
|
67
|
+
webgen needs a special directory structure so that it works out of the box. This directory structure
|
68
|
+
is automatically created by the `webgen create` command. You can alternatively use the webgui to
|
69
|
+
create the website directory.
|
70
|
+
|
71
|
+
The root directory of webgen website is called the website directory. You can have the following
|
72
|
+
files and directories under this directory:
|
73
|
+
|
74
|
+
* `src`: The source directory in which all the source files for the website are. If this directory
|
75
|
+
should not be called `src` or you want to include additional source directories, you need to
|
76
|
+
change the `sources` configuration option.
|
77
|
+
|
78
|
+
* `out`: This directory is created, if it does not exist, when webgen generates the HTML files. All
|
79
|
+
the output files are put into this directory. The name of this directory can be changed by setting
|
80
|
+
the `output` configuration option.
|
81
|
+
|
82
|
+
* `ext`: The extension directory (optional). You can put self-written extensions into this directory
|
83
|
+
so that they are used by webgen. See the [extension directory]({relocatable: '#website-ext'})
|
84
|
+
section for more information.
|
85
|
+
|
86
|
+
* `config.yaml`: This file can be used to set configuration options for the website. See the
|
87
|
+
[Configuration File]({relocatable: '#website-configfile'}) section for more information.
|
88
|
+
|
89
|
+
* `Rakefile`: This file is provided for your convenience to execute tasks via `rake` and provides
|
90
|
+
some useful tasks out of the box. See the [Rakefile]({relocatable: '#website-rakefile'}) section
|
91
|
+
for more information.
|
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.
|
101
|
+
|
102
|
+
## Configuration File {#website-configfile}
|
103
|
+
|
104
|
+
Many user will want to change some configuration options, for example, the default language of the
|
105
|
+
website since not all people will want to write websites in English. This is primarily done via the
|
106
|
+
configuration file.
|
107
|
+
|
108
|
+
The configuration file is called `config.yaml` and has to be placed directly under the website
|
109
|
+
directory. It uses [YAML](http://www.yaml.org) as file format. You can find a list of all available
|
110
|
+
configuration options that can be set in the [Configuration Options Reference]({relocatable:
|
111
|
+
reference_configuration.html}).
|
112
|
+
|
113
|
+
Each configuration option can be set in the configuration file by specifing the configuration option
|
114
|
+
name and the new value as a key/value pair. A sample configuration file looks like this:
|
115
|
+
|
116
|
+
website.lang: de
|
117
|
+
website.link_to_current_page: true
|
118
|
+
|
119
|
+
Since some configuration options have a complex structure, there exist several special configuration
|
120
|
+
keys to help setting these configuration options:
|
121
|
+
|
122
|
+
* `default_meta_info`: Set the default meta information for one or more source handlers.
|
123
|
+
|
124
|
+
This key needs needs a Hash as value which should be of the following form:
|
125
|
+
|
126
|
+
SOURCE_HANDLER_NAME:
|
127
|
+
mi_key: mi_value
|
128
|
+
other_key: other_value
|
129
|
+
:action: replace
|
130
|
+
|
131
|
+
So each entry has to specify the name of a source handler (or the special value `:all` which
|
132
|
+
sets the default meta information for all source handlers) and the meta information items that
|
133
|
+
should be set or modified. If you don't want to update the meta information hash but want to
|
134
|
+
replace it, you need to add `:action: replace` as meta information entry.
|
135
|
+
|
136
|
+
If a source handler called `Webgen::SourceHandler::SOURCE_HANDLER_NAME` exists, the meta
|
137
|
+
information is set for this source handler instead.
|
138
|
+
|
139
|
+
For example, the following snippet of a configuration file sets the meta information item
|
140
|
+
`in_menu` to `true` for `Webgen::SourceHandler::Page`:
|
141
|
+
|
142
|
+
default_meta_info:
|
143
|
+
Page:
|
144
|
+
in_menu: true
|
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
|
+
|
169
|
+
* `patterns`: Set the used path patterns for one or more source handlers.
|
170
|
+
|
171
|
+
This key needs a Hash value and provides two different ways of setting the path patterns:
|
172
|
+
|
173
|
+
SOURCE_HANDLER_NAME: [**/*.jpg, **/*.css]
|
174
|
+
|
175
|
+
SOURCE_HANDLER_NAME:
|
176
|
+
add: [**/*.jpg]
|
177
|
+
del: [**/*.js]
|
178
|
+
|
179
|
+
The first form replaces the path patterns for the source handler with the given patterns. The
|
180
|
+
second form allows to add or delete individual patterns.
|
181
|
+
|
182
|
+
If a source handler called `Webgen::SourceHandler::SOURCE_HANDLER_NAME` exists, the meta
|
183
|
+
information is set for this source handler instead.
|
184
|
+
|
185
|
+
For example, the following snippet of a configuration file adds the pattern `**/*.pdf` to the
|
186
|
+
patterns of `Webgen::SourceHandler::Copy`:
|
187
|
+
|
188
|
+
patterns:
|
189
|
+
Copy:
|
190
|
+
add: [**/*.pdf]
|
191
|
+
|
192
|
+
## Rakefile {#website-rakefile}
|
193
|
+
|
194
|
+
The Rakefile that is automatically created upon website creation provides a place to specify
|
195
|
+
recurring task for your website, for example, for deploying the website to a server. It contains
|
196
|
+
some useful tasks out of the box:
|
197
|
+
|
198
|
+
* `webgen`: Renders the webgen website once.
|
199
|
+
* `auto_webgen`: Automatically renders the website when a source file has changed. This is very
|
200
|
+
useful when developing a website because you don't need to change back and forth between your
|
201
|
+
website code and the command line to rebuild the site.
|
202
|
+
* `clobber_webgen`: Removes all webgen generated products (the output files and the cache file).
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
# All About Paths and Sources {#source}
|
207
|
+
|
208
|
+
A source provides paths that identity files or directories. webgen can use paths from many sources.
|
209
|
+
The most commonly used source is the file system source which provides paths and information on them
|
210
|
+
from the file system.
|
211
|
+
|
212
|
+
|
213
|
+
## Path Types {#source-types}
|
214
|
+
|
215
|
+
webgen can handle many different types of files through the different source handler classes.
|
216
|
+
|
217
|
+
The most important files are the page and template files as they are used to define the content and
|
218
|
+
the layout of a website. Have a look at the [Webgen Page Format documentation]({relocatable:
|
219
|
+
webgen_page_format.html}) to see how these files look like and how they are structured. After that
|
220
|
+
have a look at the documentation of the source handler class SourceHandler::Page and
|
221
|
+
SourceHandler::Template as they are responsible for handling these page and template files!
|
222
|
+
|
223
|
+
You can naturally use any other type of file. However, be aware that some files may not be processed
|
224
|
+
by webgen when no source handler class for them exists. For example, there is currently no source
|
225
|
+
handler class for `.svg` files, so those files would be ignored. If you just want to have files
|
226
|
+
copied from a source to the output directory (like images or CSS files), the SourceHandler::Copy
|
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.
|
229
|
+
|
230
|
+
|
231
|
+
## Source Paths Naming Convention {#source-naming}
|
232
|
+
|
233
|
+
webgen assumes that the paths provided by the sources follow a special naming convention sothat meta
|
234
|
+
information can be extracted correctly from the path name:
|
235
|
+
|
236
|
+
[sort_info.]basename[.lang].extension
|
237
|
+
|
238
|
+
* `sort_info`
|
239
|
+
|
240
|
+
This part is optional and has to consist of the digits 0 to 9. Its value is used for the meta
|
241
|
+
information `sort_info`. If not specified, it defaults to the value zero.
|
242
|
+
|
243
|
+
* `basename`
|
244
|
+
|
245
|
+
This part is used on the one hand to generate the `title` meta information (but with `_` and `-`
|
246
|
+
replaced by spaces). And on the other hand, the canonical name is derived from it. `basename`
|
247
|
+
must not contain any dots, spaces or any character from the following list: ``; / ? * : ` & = +
|
248
|
+
$ ,``. If you do use one of them webgen may not work correctly!
|
249
|
+
|
250
|
+
> If two paths have the same `basename` and `extension` part, they should define the same
|
251
|
+
> content but for different languages. This allows webgen to automatically deliver the right
|
252
|
+
> language version of the content
|
253
|
+
{.information}
|
254
|
+
|
255
|
+
* `lang`
|
256
|
+
|
257
|
+
This part is optional and has to be an [ISO-639-1/2](http://www.loc.gov/standards/iso639-2/)
|
258
|
+
language identifier (two or three characters (a-z) long). If not specified, it is assumed that
|
259
|
+
the path is language independent (for example, images are normally not specific for a specific
|
260
|
+
language). However, this behaviour may be different for some source handler classes (for
|
261
|
+
example, all paths handled by SourceHandler::Page are assigned the default language if none is
|
262
|
+
set).
|
263
|
+
|
264
|
+
If the language identifier can't be matched to a valid language, it is assumed that this part
|
265
|
+
isn't actually a language identifier but a part of the extension. This also means that in the
|
266
|
+
special case where the first part of an extension is also a valid language identifier, the first
|
267
|
+
part is interpreted as language identifier and not as part of the extension.
|
268
|
+
|
269
|
+
* `extension`
|
270
|
+
|
271
|
+
The file extension can be anything and can include dots.
|
272
|
+
|
273
|
+
Following are some examples of source path names:
|
274
|
+
|
275
|
+
|Path name | Parsed meta information
|
276
|
+
|--------------------------|------------------------------------------------
|
277
|
+
|`name.png` | title: Name, language: none, sort\_info: 0, basename: name, cn: name.png
|
278
|
+
|`name.de.png` | title: Name, language: de, sort\_info: 0, basename: name, cn: name.png
|
279
|
+
|`01.name_of-file.eo.page` | title: Name of file, language: eo, sort\_info: 1, basename: name_of-file, cn: name_of-file.page
|
280
|
+
|`name.tar.bz2` | title: Name, language: none, sort\_info: 0, basename: name, cn: name.tar.bz2
|
281
|
+
|`name.de.tar.bz2` | title: Name, language: de, sort\_info: 0, basename: name, cn: name.tar.bz2
|
282
|
+
|
283
|
+
Notice: The first two and the last two examples define the same content for two different languages
|
284
|
+
(or more exactly: the first one is unlocalized and the second one localized to German) as they have
|
285
|
+
the same canonical name.
|
286
|
+
|
287
|
+
|
288
|
+
## Canonical Name of a File ### {#source-cn}
|
289
|
+
|
290
|
+
webgen provides the functionality to define the same content in more than one language, ie. to
|
291
|
+
localize content. This is achieved with the _canonical name_ of a path.
|
292
|
+
|
293
|
+
When multiple paths share the same canonical name, webgen assumes that they have the same content
|
294
|
+
but in different languages. It is also possible to specify a _language independent_ path which is
|
295
|
+
used as a fallback. Therefore when a path should be resolved using a canonical name and a given
|
296
|
+
language, it is first tried to get the path in the requested language. If this is not possible
|
297
|
+
(ie. no such localization exists), the unlocalized path is returned if it exists.
|
298
|
+
|
299
|
+
> Directories and fragments are never localized, only files are!
|
300
|
+
{.exclamation}
|
301
|
+
|
302
|
+
It is also possible to use the _localized canonical name_ of a path to resolve it. The localized
|
303
|
+
canonical name is the same as the canonical name but with a language code inserted before the
|
304
|
+
extension. If the localized canonical name is used to resolve a path, a possibly additionally
|
305
|
+
specified language is ignored as it is assumed that the user really only wants the path in the
|
306
|
+
specified language!
|
307
|
+
|
308
|
+
This also means that all paths are not resolved using their real source or output names but using
|
309
|
+
the (localized) canonical name! This is different from previous webgen versions!
|
310
|
+
|
311
|
+
|
312
|
+
## Output Path Name Construction ### {#source-output}
|
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
|
+
|
318
|
+
The output path for a given source path is constructed using the meta information
|
319
|
+
`output_path_style`. This meta information is set to a default value and can be overwritten by
|
320
|
+
setting it for a specific source handler or for a path individually. The value for this meta
|
321
|
+
information key is an array which can have the following values:
|
322
|
+
|
323
|
+
* strings (for inserting arbitrary text into output names)
|
324
|
+
* arrays (for grouping values - only interesting for the language part)
|
325
|
+
* symbols for inserting special values:
|
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.
|
332
|
+
|
333
|
+
> The contructed output path must always be an absolute one, ie. it has to start at the root of the
|
334
|
+
> output directory. Therefore, the `:parent` part should always be included!
|
335
|
+
{.information}
|
336
|
+
|
337
|
+
Following are some examples of output path names for given source path names (assuming that `en` is
|
338
|
+
the default language and that the path is under a directory called `/img/`):
|
339
|
+
|
340
|
+
* `output_path_style=[:parent, :cnbase, [., :lang], :ext]` (the default)
|
341
|
+
|
342
|
+
* `index.jpg` --> `/img/index.jpg`
|
343
|
+
|
344
|
+
Since the source path is unlocalized, no language part is used and the whole sub array with
|
345
|
+
the `:lang` symbol is dropped.
|
346
|
+
|
347
|
+
* `index.en.jpg` --> `/img/index.jpg`
|
348
|
+
|
349
|
+
This happens if the configuration option `sourcehandler.default_lang_in_output_path` is
|
350
|
+
`false` and no unlocalized version of this path exists.
|
351
|
+
|
352
|
+
* `index.en.jpg` --> `/img/index.en.jpg`
|
353
|
+
|
354
|
+
Similar to the last example but this result occurs when there is an unlocalized version of
|
355
|
+
the path which is naturally named `index.jpg`!
|
356
|
+
|
357
|
+
* `index.de.jpg` --> `/img/index.de.jpg`
|
358
|
+
|
359
|
+
Since `de` is not the default language, the language part is always used!
|
360
|
+
|
361
|
+
* `output_path_style=[:parent, :cnbase, :ext, ., :lang]`
|
362
|
+
|
363
|
+
* `index.jpg` --> `/img/index.jpg.`
|
364
|
+
|
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.
|
372
|
+
|
373
|
+
|
374
|
+
## Path Patterns {#source-pathpattern}
|
375
|
+
|
376
|
+
Each source handler specifies path patterns which are used to locate the files that the class can
|
377
|
+
handle. Normally these patterns are used to match file extensions, however, they are much more
|
378
|
+
powerful. For detailed information on the structure of path patterns have a look at the
|
379
|
+
[Dir.glob](http://ruby-doc.org/core/classes/Dir.html#M002375) API documentation.
|
380
|
+
|
381
|
+
The path patterns that are handled by a particular source handler are stated on its documentation
|
382
|
+
page. These patterns can be changed by modfying the configuration option `sourcehandler.patterns`
|
383
|
+
although that is not recommended except in some few cases (for example, it is useful to add some
|
384
|
+
patterns for SourceHandler::Copy). The information about how these path patterns work are useful for
|
385
|
+
the usage of webgen because of two reasons:
|
386
|
+
|
387
|
+
* so that you know which files will be processed by a specific source handler class
|
388
|
+
|
389
|
+
* so that you can specify additional path patterns for some source handlers like the
|
390
|
+
SourceHandler::Copy
|
391
|
+
|
392
|
+
Here are some example path patterns:
|
393
|
+
|
394
|
+
<table class="examples" markdown='1'>
|
395
|
+
<tr><th>Path Pattern</th><th>Result</th></tr>
|
396
|
+
<tr>
|
397
|
+
<td>`*/*.html`</td>
|
398
|
+
<td>All files with the extension `html` in the subdirectories of the source directory</td>
|
399
|
+
</tr>
|
400
|
+
<tr>
|
401
|
+
<td>`**/*.html`</td>
|
402
|
+
<td>All files with the extension `html` in all directories</td>
|
403
|
+
</tr>
|
404
|
+
<tr>
|
405
|
+
<td>`**/{foo,bar}*`</td>
|
406
|
+
<td>All files in all directories which start with `foo` or `bar`</td>
|
407
|
+
</tr>
|
408
|
+
<tr>
|
409
|
+
<td>`**/???`</td>
|
410
|
+
<td>All files in all directories whose file name is exactly three characters long</td>
|
411
|
+
</tr>
|
412
|
+
</table>
|
413
|
+
|
414
|
+
|
415
|
+
## Handling of files in the source directory {#source-handling}
|
416
|
+
|
417
|
+
Following is the list of rules how source files are handled by webgen:
|
418
|
+
|
419
|
+
* All path names of all sources specified in the configuration option `sources` are fetched. Prior
|
420
|
+
listed sources have priority over later listed sources if both specify the same path.
|
421
|
+
|
422
|
+
* Those paths which match a pattern of the configuration option `sourcehandler.ignore` are excluded.
|
423
|
+
|
424
|
+
* The source handler classes are invoked according to the invocation order specified in
|
425
|
+
`sourcehandler.invoke` and they use only those paths that match one of their path patterns
|
426
|
+
specified in `sourcehandler.patterns`.
|
427
|
+
|
428
|
+
As you might have deduced from the processing list above, it is possible that one path is handled by
|
429
|
+
multiple source handlers. This can be used, for example, to render an XML file as HTML and copy it
|
430
|
+
verbatim.
|
431
|
+
|
432
|
+
Internally a tree structure is created reflecting the source directory hierarchy and each path that
|
433
|
+
is handled by webgen. Normally a source handler creates one node from one path but it is also
|
434
|
+
possible that a source handler creates multiple nodes from one path.
|
435
|
+
|
436
|
+
> The name used for describing a directory or file once it is placed in the internal tree structure
|
437
|
+
> is 'node'.
|
438
|
+
{.information}
|
439
|
+
|
440
|
+
After this internal tree structure is created, it is traversed and each node is processed. First the
|
441
|
+
node is checked if has changed (the notion of 'changed' depends on many things but a node is
|
442
|
+
changed, for example, if its meta information or the associated source path has changed since the
|
443
|
+
last webgen run). If it has not changed, nothing needs to be written. Otherwise, the information
|
444
|
+
needed to write out the node is gathered and its content is written to the output path represented
|
445
|
+
by the node.
|
446
|
+
|
447
|
+
|
448
|
+
## Path Meta Information {#source-metainfo}
|
449
|
+
|
450
|
+
Each path can have meta information, i.e. information about the path itself, associated with it, for
|
451
|
+
example the title of the path, if it should appear in a menu and so on. This meta information can be
|
452
|
+
specified in several ways, including:
|
453
|
+
|
454
|
+
* Source handlers can provide default meta information for their handled paths (set using the
|
455
|
+
configuration option `sourcehandler.default_meta_info`)
|
456
|
+
|
457
|
+
* Some file types allow meta information to be specified directly in the file, for example page
|
458
|
+
files in [Webgen Page Format]({relocatable: webgen_page_format.html}).
|
459
|
+
|
460
|
+
* Meta information can also be specified in special meta information backing files. These files are
|
461
|
+
handled by the source handler SourceHandler::Metainfo.
|
462
|
+
|
463
|
+
There is clearly defined order in which meta information is applied to a node for a path:
|
464
|
+
|
465
|
+
1. The path gets read by a source and some meta information is extracted from the path name.
|
466
|
+
|
467
|
+
2. This meta information is overwritten with meta information specified for all source handlers and
|
468
|
+
then with meta information specified for the source handler that handles the path.
|
469
|
+
|
470
|
+
3. Extensions can now overwrite meta information before the path gets handled by a source
|
471
|
+
handler. For example, the SourceHandler::Metainfo assigns meta information specified for paths at
|
472
|
+
this stage.
|
473
|
+
|
474
|
+
4. Before the node for the path gets created, meta information from the content of the path itself
|
475
|
+
may overwrite the current meta information (this is the case, for example, with files in Webgen
|
476
|
+
Page Format).
|
477
|
+
|
478
|
+
5. The node gets created with the provided meta information.
|
479
|
+
|
480
|
+
6. After the node has been created, extensions may overwrite meta information again. For example,
|
481
|
+
the SourceHandler::Metainfo assigns meta information specified for nodes at this stage.
|
482
|
+
|
483
|
+
|
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
|
+
|
524
|
+
# Extending webgen
|
525
|
+
|
526
|
+
If you know the programming language Ruby a little bit, you can easily extend webgen and add new
|
527
|
+
features that you need. All the needed developer documentation is available in the [API
|
528
|
+
documentation](rdoc/index.html), along with sample implementations for all major types of extensions
|
529
|
+
(source class, output classes, source handler class, content processors classes, tag classes, ...)
|
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.
|