webgen 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +76 -0
- data/Rakefile +23 -18
- data/TODO +5 -0
- data/VERSION +1 -1
- data/doc/metainfo.yaml +4 -1
- data/doc/src/default.template +5 -1
- data/doc/src/documentation/basics.page +148 -0
- data/doc/src/documentation/extending_webgen.page +4 -1
- data/doc/src/documentation/index.page +6 -3
- data/doc/src/documentation/plugins/core/filehandler.page +1 -1
- data/doc/src/documentation/plugins/file/directoryhandler.page +1 -1
- data/doc/src/documentation/references/index.page +20 -1
- data/doc/src/documentation/references/meta_info_reference.page +2 -1
- data/doc/src/documentation/{gettingstarted.page → tutorial.page} +6 -103
- data/doc/src/news.page +11 -0
- data/lib/webgen/config.rb +4 -4
- data/lib/webgen/node.rb +4 -2
- data/lib/webgen/plugins/filehandlers/template.rb +3 -1
- data/lib/webgen/plugins/miscplugins/rendered_files.rb +75 -0
- data/lib/webgen/rake/webgentask.rb +161 -0
- data/test/fixtures/sample_site/src/index.de.page +1 -0
- data/test/unittests/tc_filehandler_template.rb +3 -0
- data/test/unittests/tc_node.rb +3 -0
- metadata +6 -266
- data/doc/examples/website_styles/1024px/README +0 -9
- data/doc/examples/website_styles/1024px/config.yaml +0 -2
- data/doc/examples/website_styles/1024px/src/about.page +0 -12
- data/doc/examples/website_styles/1024px/src/default.css +0 -188
- data/doc/examples/website_styles/1024px/src/default.template +0 -62
- data/doc/examples/website_styles/1024px/src/download.page +0 -15
- data/doc/examples/website_styles/1024px/src/features.page +0 -8
- data/doc/examples/website_styles/1024px/src/images/background.gif +0 -0
- data/doc/examples/website_styles/1024px/src/index.page +0 -9
- data/doc/examples/website_styles/1024px/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas00/README +0 -9
- data/doc/examples/website_styles/andreas00/config.yaml +0 -2
- data/doc/examples/website_styles/andreas00/src/about.page +0 -12
- data/doc/examples/website_styles/andreas00/src/default.css +0 -290
- data/doc/examples/website_styles/andreas00/src/default.template +0 -62
- data/doc/examples/website_styles/andreas00/src/download.page +0 -15
- data/doc/examples/website_styles/andreas00/src/features.page +0 -8
- data/doc/examples/website_styles/andreas00/src/images/bg.gif +0 -0
- data/doc/examples/website_styles/andreas00/src/images/front.jpg +0 -0
- data/doc/examples/website_styles/andreas00/src/images/menubg.gif +0 -0
- data/doc/examples/website_styles/andreas00/src/images/menubg2.gif +0 -0
- data/doc/examples/website_styles/andreas00/src/index.page +0 -9
- data/doc/examples/website_styles/andreas00/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas01/README +0 -9
- data/doc/examples/website_styles/andreas01/config.yaml +0 -2
- data/doc/examples/website_styles/andreas01/src/about.page +0 -12
- data/doc/examples/website_styles/andreas01/src/default.css +0 -310
- data/doc/examples/website_styles/andreas01/src/default.template +0 -63
- data/doc/examples/website_styles/andreas01/src/download.page +0 -15
- data/doc/examples/website_styles/andreas01/src/features.page +0 -8
- data/doc/examples/website_styles/andreas01/src/images/bg.gif +0 -0
- data/doc/examples/website_styles/andreas01/src/images/front.jpg +0 -0
- data/doc/examples/website_styles/andreas01/src/index.page +0 -9
- data/doc/examples/website_styles/andreas01/src/print.css +0 -35
- data/doc/examples/website_styles/andreas01/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas03/README +0 -9
- data/doc/examples/website_styles/andreas03/config.yaml +0 -2
- data/doc/examples/website_styles/andreas03/src/about.page +0 -12
- data/doc/examples/website_styles/andreas03/src/default.css +0 -223
- data/doc/examples/website_styles/andreas03/src/default.template +0 -60
- data/doc/examples/website_styles/andreas03/src/download.page +0 -15
- data/doc/examples/website_styles/andreas03/src/features.page +0 -8
- data/doc/examples/website_styles/andreas03/src/images/bodybg.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/contbg.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/footerbg.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/gradient1.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/gradient2.png +0 -0
- data/doc/examples/website_styles/andreas03/src/index.page +0 -9
- data/doc/examples/website_styles/andreas03/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas04/README +0 -9
- data/doc/examples/website_styles/andreas04/config.yaml +0 -2
- data/doc/examples/website_styles/andreas04/src/about.page +0 -12
- data/doc/examples/website_styles/andreas04/src/default.css +0 -290
- data/doc/examples/website_styles/andreas04/src/default.template +0 -83
- data/doc/examples/website_styles/andreas04/src/download.page +0 -15
- data/doc/examples/website_styles/andreas04/src/features.page +0 -8
- data/doc/examples/website_styles/andreas04/src/images/blinkarrow.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/bodybg.png +0 -0
- data/doc/examples/website_styles/andreas04/src/images/contentbg.png +0 -0
- data/doc/examples/website_styles/andreas04/src/images/entrybg.png +0 -0
- data/doc/examples/website_styles/andreas04/src/images/flash.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/flash2.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/globe.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/globebottom.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/linkarrow.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/menuhover.png +0 -0
- data/doc/examples/website_styles/andreas04/src/index.page +0 -9
- data/doc/examples/website_styles/andreas04/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas05/README +0 -9
- data/doc/examples/website_styles/andreas05/config.yaml +0 -2
- data/doc/examples/website_styles/andreas05/src/about.page +0 -12
- data/doc/examples/website_styles/andreas05/src/default.css +0 -33
- data/doc/examples/website_styles/andreas05/src/default.template +0 -42
- data/doc/examples/website_styles/andreas05/src/download.page +0 -15
- data/doc/examples/website_styles/andreas05/src/features.page +0 -8
- data/doc/examples/website_styles/andreas05/src/images/bodybg.gif +0 -0
- data/doc/examples/website_styles/andreas05/src/images/front.png +0 -0
- data/doc/examples/website_styles/andreas05/src/index.page +0 -9
- data/doc/examples/website_styles/andreas05/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas06/README +0 -9
- data/doc/examples/website_styles/andreas06/config.yaml +0 -2
- data/doc/examples/website_styles/andreas06/src/about.page +0 -12
- data/doc/examples/website_styles/andreas06/src/default.css +0 -353
- data/doc/examples/website_styles/andreas06/src/default.template +0 -72
- data/doc/examples/website_styles/andreas06/src/download.page +0 -15
- data/doc/examples/website_styles/andreas06/src/features.page +0 -8
- data/doc/examples/website_styles/andreas06/src/images/bodybg.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/boxbg.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/greypx.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/header.jpg +0 -0
- data/doc/examples/website_styles/andreas06/src/images/innerbg.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/leaves.jpg +0 -0
- data/doc/examples/website_styles/andreas06/src/images/tabs.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/index.page +0 -9
- data/doc/examples/website_styles/andreas06/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas07/README +0 -9
- data/doc/examples/website_styles/andreas07/config.yaml +0 -2
- data/doc/examples/website_styles/andreas07/src/about.page +0 -12
- data/doc/examples/website_styles/andreas07/src/browserfix.css +0 -7
- data/doc/examples/website_styles/andreas07/src/default.css +0 -92
- data/doc/examples/website_styles/andreas07/src/default.template +0 -44
- data/doc/examples/website_styles/andreas07/src/download.page +0 -15
- data/doc/examples/website_styles/andreas07/src/features.page +0 -8
- data/doc/examples/website_styles/andreas07/src/images/bodybg.gif +0 -0
- data/doc/examples/website_styles/andreas07/src/images/sidebarbg.gif +0 -0
- data/doc/examples/website_styles/andreas07/src/index.page +0 -9
- data/doc/examples/website_styles/andreas07/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas08/README +0 -9
- data/doc/examples/website_styles/andreas08/config.yaml +0 -2
- data/doc/examples/website_styles/andreas08/src/about.page +0 -12
- data/doc/examples/website_styles/andreas08/src/default.css +0 -224
- data/doc/examples/website_styles/andreas08/src/default.template +0 -53
- data/doc/examples/website_styles/andreas08/src/download.page +0 -15
- data/doc/examples/website_styles/andreas08/src/features.page +0 -8
- data/doc/examples/website_styles/andreas08/src/index.page +0 -9
- data/doc/examples/website_styles/andreas08/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas09/README +0 -9
- data/doc/examples/website_styles/andreas09/config.yaml +0 -2
- data/doc/examples/website_styles/andreas09/src/about.page +0 -12
- data/doc/examples/website_styles/andreas09/src/default.css +0 -308
- data/doc/examples/website_styles/andreas09/src/default.template +0 -70
- data/doc/examples/website_styles/andreas09/src/download.page +0 -15
- data/doc/examples/website_styles/andreas09/src/features.page +0 -8
- data/doc/examples/website_styles/andreas09/src/images/bodybg-black.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-green.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-orange.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-purple.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-red.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/footerbg.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-black.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-green.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-orange.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-purple.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-red.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/index.page +0 -9
- data/doc/examples/website_styles/andreas09/src/screenshots.page +0 -18
- data/doc/examples/website_styles/default/README +0 -9
- data/doc/examples/website_styles/default/config.yaml +0 -2
- data/doc/examples/website_styles/default/src/about.page +0 -12
- data/doc/examples/website_styles/default/src/default.css +0 -84
- data/doc/examples/website_styles/default/src/default.template +0 -38
- data/doc/examples/website_styles/default/src/download.page +0 -15
- data/doc/examples/website_styles/default/src/features.page +0 -8
- data/doc/examples/website_styles/default/src/index.page +0 -9
- data/doc/examples/website_styles/default/src/screenshots.page +0 -18
- data/doc/examples/website_styles/plain/README +0 -9
- data/doc/examples/website_styles/plain/config.yaml +0 -2
- data/doc/examples/website_styles/plain/src/about.page +0 -12
- data/doc/examples/website_styles/plain/src/default.css +0 -244
- data/doc/examples/website_styles/plain/src/default.template +0 -63
- data/doc/examples/website_styles/plain/src/download.page +0 -15
- data/doc/examples/website_styles/plain/src/features.page +0 -8
- data/doc/examples/website_styles/plain/src/images/a_hover.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/desc.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/li.gif +0 -0
- data/doc/examples/website_styles/plain/src/images/mainbar.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/menu.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/submenua.gif +0 -0
- data/doc/examples/website_styles/plain/src/images/submenua_hover.jpg +0 -0
- data/doc/examples/website_styles/plain/src/index.page +0 -9
- data/doc/examples/website_styles/plain/src/screenshots.page +0 -18
- data/doc/examples/website_templates/default/README +0 -8
- data/doc/examples/website_templates/default/config.yaml +0 -2
- data/doc/examples/website_templates/default/src/default.css +0 -84
- data/doc/examples/website_templates/default/src/default.template +0 -38
- data/doc/examples/website_templates/default/src/index.page +0 -8
- data/doc/examples/website_templates/personal_hp/README +0 -8
- data/doc/examples/website_templates/personal_hp/config.yaml +0 -2
- data/doc/examples/website_templates/personal_hp/src/about.page +0 -12
- data/doc/examples/website_templates/personal_hp/src/default.css +0 -84
- data/doc/examples/website_templates/personal_hp/src/default.template +0 -38
- data/doc/examples/website_templates/personal_hp/src/index.page +0 -9
- data/doc/examples/website_templates/personal_hp/src/links.page +0 -22
- data/doc/examples/website_templates/personal_hp/src/projects.page +0 -20
- data/doc/examples/website_templates/project/README +0 -9
- data/doc/examples/website_templates/project/config.yaml +0 -2
- data/doc/examples/website_templates/project/src/about.page +0 -12
- data/doc/examples/website_templates/project/src/default.css +0 -84
- data/doc/examples/website_templates/project/src/default.template +0 -38
- data/doc/examples/website_templates/project/src/download.page +0 -15
- data/doc/examples/website_templates/project/src/features.page +0 -8
- data/doc/examples/website_templates/project/src/index.page +0 -9
- data/doc/examples/website_templates/project/src/screenshots.page +0 -18
- data/doc/plugin/gallery/slides/collage.rb +0 -334
- data/doc/src/examples/gallery_styles/default/default.gallery +0 -78
- data/doc/src/examples/gallery_styles/default/gallery_gallery.template +0 -38
- data/doc/src/examples/gallery_styles/default/gallery_image.template +0 -30
- data/doc/src/examples/gallery_styles/default/gallery_main.template +0 -18
- data/doc/src/examples/gallery_styles/index.page +0 -22
- data/doc/src/examples/gallery_styles/slides/gallery_gallery.template +0 -62
- data/doc/src/examples/gallery_styles/slides/gallery_image.template +0 -53
- data/doc/src/examples/gallery_styles/slides/gallery_main.template +0 -32
- data/doc/src/examples/gallery_styles/slides/slides.gallery +0 -79
- data/doc/src/examples/website_styles/1024px.page +0 -5
- data/doc/src/examples/website_styles/andreas00.page +0 -5
- data/doc/src/examples/website_styles/andreas01.page +0 -5
- data/doc/src/examples/website_styles/andreas03.page +0 -5
- data/doc/src/examples/website_styles/andreas04.page +0 -5
- data/doc/src/examples/website_styles/andreas05.page +0 -5
- data/doc/src/examples/website_styles/andreas06.page +0 -5
- data/doc/src/examples/website_styles/andreas07.page +0 -5
- data/doc/src/examples/website_styles/andreas08.page +0 -5
- data/doc/src/examples/website_styles/andreas09.page +0 -5
- data/doc/src/examples/website_styles/default.page +0 -5
- data/doc/src/examples/website_styles/index.page +0 -71
- data/doc/src/examples/website_styles/plain.page +0 -5
- data/doc/src/examples/website_templates/default.page +0 -5
- data/doc/src/examples/website_templates/index.page +0 -24
- data/doc/src/examples/website_templates/personal_hp.page +0 -5
- data/doc/src/examples/website_templates/project.page +0 -5
|
@@ -1,108 +1,8 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: Tutorial
|
|
3
3
|
inMenu: true
|
|
4
4
|
---
|
|
5
|
-
h1(#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
h2(#directories). The Needed Directories
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
webgen needs a special directory structure so that it can work correctly. Basically, you have a
|
|
12
|
-
website directory under which the following directories have to be:
|
|
13
|
-
|
|
14
|
-
* @src@: The source directory in which all the source files for the website are. The name of this
|
|
15
|
-
directory cannot be changed!
|
|
16
|
-
* @output@: This directory is created, if it does not exist, when webgen is run. All the output
|
|
17
|
-
files are put into this directory. The name of this directory and its location can be customized
|
|
18
|
-
using the parameter {param: Core/Configuration:outDir}.
|
|
19
|
-
* @plugin@: The extension directory. You can put self-written plugins into this directory so that
|
|
20
|
-
they can be used by webgen. All <notextile><tt>*.rb</tt></notextile> files in this directory and
|
|
21
|
-
its subdirectories are loaded as plugins. The name of this directory can't be customized, too!
|
|
22
|
-
|
|
23
|
-
The directory in which these directories are in is called the *website directory*.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
h2(#cmdline). The @webgen@ Command
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
The executable for webgen is called... webgen ;-) It uses a command style syntax (like Subversion's
|
|
30
|
-
@svn@ or Rubygem's @gem@ commands) through the "cmdparse":http://cmdparse.rubyforge.org library. To
|
|
31
|
-
get an overview of the possible commands run
|
|
32
|
-
|
|
33
|
-
<pre>
|
|
34
|
-
$ webgen help
|
|
35
|
-
</pre>
|
|
36
|
-
|
|
37
|
-
This will output something like this:
|
|
38
|
-
|
|
39
|
-
<pre>
|
|
40
|
-
Usage: webgen [options] COMMAND [options] [COMMAND [options] ...] [args]
|
|
41
|
-
|
|
42
|
-
Available commands:
|
|
43
|
-
check Checks things like validity of the config file or the availability of optional libraries
|
|
44
|
-
config Checks the validity of the configuration and outputs the used options (=default command)
|
|
45
|
-
libs Checks the availability of optional libraries used by plugins
|
|
46
|
-
create Creates the basic directories and files for webgen.
|
|
47
|
-
help Provide help for individual commands
|
|
48
|
-
run Runs webgen, ie. generates the HTML files (=default command)
|
|
49
|
-
show Shows various information
|
|
50
|
-
config Shows information like the parameters for all or the matched plugins
|
|
51
|
-
plugins Shows the available plugins
|
|
52
|
-
use Changes the used website or gallery styles
|
|
53
|
-
gallery_style Changes the used gallery style
|
|
54
|
-
website_style Changes the used website style
|
|
55
|
-
version Show the version of the program
|
|
56
|
-
|
|
57
|
-
Global options:
|
|
58
|
-
-d, --directory DIR The website directory, if none specified, current directory is used.
|
|
59
|
-
-V, --verbosity LEVEL The verbosity level (0-3)
|
|
60
|
-
-h, --help Show help
|
|
61
|
-
-v, --version Show the version of the program
|
|
62
|
-
</pre>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
As you can see, webgen supports many commands, from checking the validity of the configuration and
|
|
66
|
-
the available libraries to displaying the configuration values. However, the main command is the
|
|
67
|
-
@run@ command which does the actual website generation. This command uses the current working
|
|
68
|
-
directory as website directory if none was specified via the @-d@ option.
|
|
69
|
-
|
|
70
|
-
For more information on how the commands work have a look at the
|
|
71
|
-
"cmdparse":http://cmdparse.rubyforge.org documentation!
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
h2(#config). Configuration
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
webgen provides a default configuration out of the box. If you can live with that, you do not need
|
|
78
|
-
to write any configuration files. Because most people cannot, you can use your own configuration
|
|
79
|
-
file. The configuration file has to be written in YAML and is called @config.yaml@. webgen assumes
|
|
80
|
-
it to be in the website directory.
|
|
81
|
-
|
|
82
|
-
Each plugin can specify parameters which can be configured through the configuration file. You can
|
|
83
|
-
display a list of all available parameters by running
|
|
84
|
-
|
|
85
|
-
<pre>
|
|
86
|
-
$ webgen show config
|
|
87
|
-
</pre>
|
|
88
|
-
|
|
89
|
-
(This information is also provided on this website, have a look at the
|
|
90
|
-
<a href="{relocatable: plugins}">plugins section</a>!)
|
|
91
|
-
|
|
92
|
-
The list shows sorted by the plugin name the current values and the default values for each
|
|
93
|
-
parameter. Each parameter can be overridden in the configuration file by specifing the plugin name
|
|
94
|
-
as top level key and each parameter and value as a key/value pair. Therefore a configuration file
|
|
95
|
-
looks like this (this is the one for the webgen homepage):
|
|
96
|
-
|
|
97
|
-
<pre class="webgen-file">{includeFile: ../../config.yaml}</pre>
|
|
98
|
-
|
|
99
|
-
There is a special key for file handler plugins: @defaultMetaInfo@. It's value should be a hash with
|
|
100
|
-
the default meta information for nodes created by the plugin. The value is used to update the
|
|
101
|
-
correct part of the {param: Core/FileHandler:defaultMetaInfo} parameter *if and only if* no value
|
|
102
|
-
for the {param: Core/FileHandler:defaultMetaInfo} parameter has been set in the configuration file!
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
h1(#website-creation). Website Creation Tutorial
|
|
5
|
+
h1(#website-creation). Tutorial
|
|
106
6
|
|
|
107
7
|
|
|
108
8
|
This short tutorial shows you how to create a website with webgen.
|
|
@@ -135,7 +35,7 @@ example:
|
|
|
135
35
|
$ webgen use website_style default
|
|
136
36
|
</pre>
|
|
137
37
|
|
|
138
|
-
Existing files may be overwritten
|
|
38
|
+
Existing files may be overwritten by this command (after asking). However, this command is not able
|
|
139
39
|
to delete previously copied website style files, so you have to remove them yourself!
|
|
140
40
|
|
|
141
41
|
Have a look at the <a href="{relocatable: /examples}">examples</a> sections to see demonstrations
|
|
@@ -255,6 +155,9 @@ you can leave it there - it won't do any harm.
|
|
|
255
155
|
|
|
256
156
|
Again, just run webgen and view the output!
|
|
257
157
|
|
|
158
|
+
For more information on how to write plugins have a look at the
|
|
159
|
+
<a href="{relocatable: extending_webgen.page}">extending webgen section</a>!
|
|
160
|
+
|
|
258
161
|
|
|
259
162
|
h2(#website-conclusio). Conclusion
|
|
260
163
|
|
data/doc/src/news.page
CHANGED
|
@@ -5,6 +5,17 @@ inMenu: true
|
|
|
5
5
|
h2. News
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
h3(#news-2007-01-12). 12.01.2007 - webgen 0.4.1
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A minor release with bug fixes and some small enhancements:
|
|
12
|
+
|
|
13
|
+
* webgen Windows bug resolved: webgen now really runs on Windows - thanks for the fast feedback!
|
|
14
|
+
* Rake task for running webgen - thanks to Jeremy Hinegardner for providing it!
|
|
15
|
+
* Meta information @template@ can now be set to @nil@ to specify that no template should be used!
|
|
16
|
+
* Small documentation updates - thanks to John Gabriel for pointing out some flaws!
|
|
17
|
+
|
|
18
|
+
|
|
8
19
|
h3(#news-2007-01-05). 05.01.2007 - webgen 0.4.0
|
|
9
20
|
|
|
10
21
|
|
data/lib/webgen/config.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: config.rb
|
|
4
|
+
# $Id: config.rb 586 2007-01-10 16:46:05Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -24,7 +24,7 @@ require 'rbconfig'
|
|
|
24
24
|
|
|
25
25
|
module Webgen
|
|
26
26
|
|
|
27
|
-
VERSION = [0, 4,
|
|
27
|
+
VERSION = [0, 4, 1]
|
|
28
28
|
AUTHOR = 'Thomas Leitner <t_leitner@gmx.at>'
|
|
29
29
|
SUMMARY = "webgen is a templated based static Web site generator."
|
|
30
30
|
DESCRIPTION = "webgen is a Web site generator implemented in Ruby. " \
|
|
@@ -40,9 +40,9 @@ module Webgen
|
|
|
40
40
|
# Returns the data directory for webgen.
|
|
41
41
|
def self.data_dir
|
|
42
42
|
unless defined?( @@data_dir )
|
|
43
|
-
@@data_dir = File.join( Config::CONFIG["datadir"], "webgen" )
|
|
43
|
+
@@data_dir = File.expand_path( File.join( Config::CONFIG["datadir"], "webgen" ) )
|
|
44
44
|
|
|
45
|
-
@@data_dir = File.join( File.dirname( __FILE__ ), '..', '..', 'data', 'webgen') if !File.exists?( @@data_dir )
|
|
45
|
+
@@data_dir = File.expand_path( File.join( File.dirname( __FILE__ ), '..', '..', 'data', 'webgen') ) if !File.exists?( @@data_dir )
|
|
46
46
|
|
|
47
47
|
raise "Could not find webgen data directory! This is a bug, report it please!" unless File.directory?( @@data_dir )
|
|
48
48
|
end
|
data/lib/webgen/node.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: node.rb
|
|
4
|
+
# $Id: node.rb 585 2007-01-10 15:48:08Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -118,7 +118,9 @@ class Node
|
|
|
118
118
|
def absolute_path
|
|
119
119
|
return @precalc[:absolute_path] if @precalc
|
|
120
120
|
|
|
121
|
-
if @
|
|
121
|
+
if @parent.nil?
|
|
122
|
+
'/'
|
|
123
|
+
elsif @path =~ ABSOLUTE_URL
|
|
122
124
|
@path
|
|
123
125
|
else
|
|
124
126
|
full_path.sub( /^#{Node.root( self ).path}/, '/' )
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: template.rb
|
|
4
|
+
# $Id: template.rb 588 2007-01-12 09:55:32Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -77,6 +77,8 @@ module FileHandlers
|
|
|
77
77
|
node['template'] = template_node
|
|
78
78
|
elsif node['template'].kind_of?( Node )
|
|
79
79
|
template_node = node['template']
|
|
80
|
+
elsif node.meta_info.has_key?( 'template' ) && node['template'].nil?
|
|
81
|
+
template_node = nil
|
|
80
82
|
else
|
|
81
83
|
log(:info) { "Using default template for <#{node.node_info[:src]}>" }
|
|
82
84
|
template_node = get_default_template( node.parent, param( 'defaultTemplate' ) )
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# rendered_files.rb :
|
|
4
|
+
#
|
|
5
|
+
# webgen miscellaneous plugin to record the paths of all the files and
|
|
6
|
+
# directories written during rendering.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) 2007 Jeremy Hinegardner
|
|
9
|
+
#
|
|
10
|
+
# This program is free software; you can redistribute it and/or modify
|
|
11
|
+
# it under the terms of the GNU General Public License as published by
|
|
12
|
+
# the Free Software Foundation; either version 2 of the License, or (at
|
|
13
|
+
# your option) any later version.
|
|
14
|
+
#
|
|
15
|
+
# This program is distributed in the hope that it will be useful, but
|
|
16
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
18
|
+
# General Public License for more details.
|
|
19
|
+
#
|
|
20
|
+
# You should have received a copy of the GNU General Public License
|
|
21
|
+
# along with this program; if not, write to the Free Software
|
|
22
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
23
|
+
# USA
|
|
24
|
+
#
|
|
25
|
+
#++
|
|
26
|
+
#
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
load_plugin 'webgen/plugins/filehandlers/filehandler'
|
|
32
|
+
|
|
33
|
+
module MiscPlugins
|
|
34
|
+
|
|
35
|
+
# This plugin registers as a listener for message :after_node_written
|
|
36
|
+
# with the 'Core/FileHandler' plugin.
|
|
37
|
+
#
|
|
38
|
+
# When its callback is invoked, if the node in question is a file or
|
|
39
|
+
# directory it records the nodes fully expanded path in @files
|
|
40
|
+
#
|
|
41
|
+
# The list of files currently rendered can then be retrieved by
|
|
42
|
+
# getting a handle on this plugin and calling +files+.
|
|
43
|
+
#
|
|
44
|
+
# Example:
|
|
45
|
+
#
|
|
46
|
+
# @plugin_manager['Misc/RenderedFiles'].files
|
|
47
|
+
#
|
|
48
|
+
class RenderedFilesPlugin < Webgen::Plugin
|
|
49
|
+
infos( :name => 'Misc/RenderedFiles',
|
|
50
|
+
:author => 'Jeremy Hinegardner <jeremy@hinegardner.org>',
|
|
51
|
+
:summary => 'Keeps track of all the files and directories written during rendering.')
|
|
52
|
+
|
|
53
|
+
depends_on 'Core/FileHandler'
|
|
54
|
+
|
|
55
|
+
attr_reader :files
|
|
56
|
+
|
|
57
|
+
def initialize(plugin_manager)
|
|
58
|
+
super
|
|
59
|
+
@plugin_manager['Core/FileHandler'].add_msg_listener(:after_node_written, method(:record_file))
|
|
60
|
+
@files = []
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
#######
|
|
64
|
+
private
|
|
65
|
+
#######
|
|
66
|
+
|
|
67
|
+
# we use expand_path to remove possible environmental parameters
|
|
68
|
+
# or ../'s in the path
|
|
69
|
+
def record_file(node)
|
|
70
|
+
if node.is_file? or node.is_directory? then
|
|
71
|
+
@files << File.expand_path(node.full_path)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# -*- ruby -*-
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
#--
|
|
5
|
+
# webgentask.rb:
|
|
6
|
+
#
|
|
7
|
+
# Define a task library for running webgen
|
|
8
|
+
#
|
|
9
|
+
# Copyright (C) 2007 Jeremy Hinegardner
|
|
10
|
+
#
|
|
11
|
+
# This program is free software; you can redistribute it and/or modify
|
|
12
|
+
# it under the terms of the GNU General Public License as published by
|
|
13
|
+
# the Free Software Foundation; either version 2 of the License, or (at
|
|
14
|
+
# your option) any later version.
|
|
15
|
+
#
|
|
16
|
+
# This program is distributed in the hope that it will be useful, but
|
|
17
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19
|
+
# General Public License for more details.
|
|
20
|
+
#
|
|
21
|
+
# You should have received a copy of the GNU General Public License
|
|
22
|
+
# along with this program; if not, write to the Free Software
|
|
23
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
24
|
+
# USA
|
|
25
|
+
#
|
|
26
|
+
#++
|
|
27
|
+
#
|
|
28
|
+
|
|
29
|
+
require 'rake'
|
|
30
|
+
require 'rake/tasklib'
|
|
31
|
+
|
|
32
|
+
module Webgen
|
|
33
|
+
|
|
34
|
+
module Rake
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
# A Rake task that generates a webgen website.
|
|
38
|
+
#
|
|
39
|
+
# It is assumed that you have already used the 'webgen' command
|
|
40
|
+
# to create the base directory for the site. This task is here
|
|
41
|
+
# to make it easier to integrate the generation of the website
|
|
42
|
+
# within the broader scope of another project.
|
|
43
|
+
#
|
|
44
|
+
# === Basics
|
|
45
|
+
#
|
|
46
|
+
# require 'webgen/rake/webgentask'
|
|
47
|
+
#
|
|
48
|
+
# Webgen::Rake::WebgenTask.new do |t|
|
|
49
|
+
# t.directory = File.join(Dir.pwd, "webgen")
|
|
50
|
+
# end
|
|
51
|
+
#
|
|
52
|
+
# === Attributes
|
|
53
|
+
#
|
|
54
|
+
# The attributes available to the task in the new block are:A
|
|
55
|
+
#
|
|
56
|
+
# * name - the name of the task. This can also be set as
|
|
57
|
+
# a parameter to new (default :webgen)
|
|
58
|
+
# * directory - the root directory of the webgen site
|
|
59
|
+
# (default File.join(Dir.pwd, "webgen")
|
|
60
|
+
# * clobber_outdir - remove webgens output directory on clobber
|
|
61
|
+
# (default false)
|
|
62
|
+
#
|
|
63
|
+
# === Tasks Provided
|
|
64
|
+
#
|
|
65
|
+
# The tasks provided are :
|
|
66
|
+
#
|
|
67
|
+
# * webgen - create the website
|
|
68
|
+
# * clobber_webgen - remove all the files created during creation
|
|
69
|
+
#
|
|
70
|
+
# If the +name+ attribute is changed then the tasks are changed
|
|
71
|
+
# to reflect that. For Example:
|
|
72
|
+
#
|
|
73
|
+
# Webgen::Rake::WebgenTask.new(:my_webgen) do |t|
|
|
74
|
+
# t.clobber_outdir = true
|
|
75
|
+
# end
|
|
76
|
+
#
|
|
77
|
+
# This will create tasks:
|
|
78
|
+
#
|
|
79
|
+
# * my_webgen
|
|
80
|
+
# * clobber_my_webgen
|
|
81
|
+
#
|
|
82
|
+
class WebgenTask < ::Rake::TaskLib
|
|
83
|
+
|
|
84
|
+
# Name of webgen task. (default is :webgen)
|
|
85
|
+
attr_accessor :name
|
|
86
|
+
|
|
87
|
+
# The directory of the webgen site. This would be the
|
|
88
|
+
# directory of your config.yaml file. Or the parent
|
|
89
|
+
# directory of the src/ directory for webgen
|
|
90
|
+
#
|
|
91
|
+
# The default for this is assumed to be
|
|
92
|
+
# File.join(Dir.pwd,"webgen")
|
|
93
|
+
attr_accessor :directory
|
|
94
|
+
|
|
95
|
+
# During the clobber, should webgen's output directory be
|
|
96
|
+
# clobbered. The default is false
|
|
97
|
+
attr_accessor :clobber_outdir
|
|
98
|
+
|
|
99
|
+
# Create a webgen task
|
|
100
|
+
def initialize(name = :webgen)
|
|
101
|
+
@name = name
|
|
102
|
+
@directory = File.join(Dir.pwd, "webgen")
|
|
103
|
+
@clobber_outdir = false
|
|
104
|
+
|
|
105
|
+
yield self if block_given?
|
|
106
|
+
|
|
107
|
+
@rendered_files = FileList.new
|
|
108
|
+
|
|
109
|
+
define
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def define
|
|
113
|
+
desc "Run webgen"
|
|
114
|
+
task @name do |t|
|
|
115
|
+
Dir.chdir(@directory) do
|
|
116
|
+
begin
|
|
117
|
+
# some items from webgen may be sensitive to the
|
|
118
|
+
# current directory when it runs
|
|
119
|
+
|
|
120
|
+
require 'webgen/website'
|
|
121
|
+
@website = Webgen::WebSite.new @directory
|
|
122
|
+
@out_dir = File.expand_path(@website.param_for_plugin('Core/Configuration', 'outDir'))
|
|
123
|
+
@website.render
|
|
124
|
+
puts "Webgen rendered to : #{@out_dir}"
|
|
125
|
+
|
|
126
|
+
file_list = @website.manager['Misc/RenderedFiles'].files
|
|
127
|
+
|
|
128
|
+
# remove @out_dir from the list of rendered_files
|
|
129
|
+
file_list.delete @out_dir
|
|
130
|
+
|
|
131
|
+
@rendered_files << file_list
|
|
132
|
+
rescue => e
|
|
133
|
+
puts "Webgen task failed: #{e}"
|
|
134
|
+
raise e
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
clobber_task = paste("clobber_",@name)
|
|
140
|
+
|
|
141
|
+
# bit of conundrum here since we don't know what files
|
|
142
|
+
# to remove until they have been generated, so we have
|
|
143
|
+
# to generate all the files to remove them.
|
|
144
|
+
#
|
|
145
|
+
# I don't know of the right way to do this yet.
|
|
146
|
+
desc "Remove webgen products"
|
|
147
|
+
task clobber_task => [@name] do
|
|
148
|
+
rm_rf @rendered_files
|
|
149
|
+
if @clobber_outdir then
|
|
150
|
+
rm_r @out_dir rescue nil
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
task :clobber => [clobber_task]
|
|
155
|
+
self
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|