webgen 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/ChangeLog +224 -0
  2. data/Rakefile +2 -3
  3. data/TODO +18 -1
  4. data/VERSION +1 -1
  5. data/doc/plugin/clidesc.rb +35 -0
  6. data/doc/plugin/extension.rb +73 -0
  7. data/doc/src/about.page +2 -1
  8. data/doc/src/default.css +5 -1
  9. data/doc/src/default.template +9 -0
  10. data/doc/src/documentation/cli.page +12 -0
  11. data/doc/src/documentation/gettingstarted.page +150 -0
  12. data/doc/src/documentation/index.page +1 -19
  13. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/html.page +0 -0
  14. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/index.page +0 -0
  15. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/markdown.page +0 -0
  16. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/rdoc.page +0 -0
  17. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/textile.page +0 -0
  18. data/doc/src/documentation/plugins/filehandler/backing.page +33 -0
  19. data/doc/src/documentation/{filehandler → plugins/filehandler}/copy.page +0 -0
  20. data/doc/src/documentation/{filehandler → plugins/filehandler}/directory.page +1 -2
  21. data/doc/src/documentation/{filehandler → plugins/filehandler}/galleryhandler.page +1 -1
  22. data/doc/src/documentation/{filehandler → plugins/filehandler}/index.page +0 -0
  23. data/doc/src/documentation/{filehandler → plugins/filehandler}/pagehandler.page +0 -0
  24. data/doc/src/documentation/{filehandler → plugins/filehandler}/template.page +0 -0
  25. data/doc/src/documentation/{gallerylayouter → plugins/gallerylayouter}/defaultlayouter.page +0 -0
  26. data/doc/src/documentation/{gallerylayouter → plugins/gallerylayouter}/index.page +0 -0
  27. data/doc/src/documentation/{htmlvalidator → plugins/htmlvalidator}/index.page +0 -0
  28. data/doc/src/documentation/{htmlvalidator → plugins/htmlvalidator}/xmllint.page +0 -0
  29. data/doc/src/documentation/plugins/index.page +20 -0
  30. data/doc/src/documentation/plugins/system/configuration.page +12 -0
  31. data/doc/src/documentation/plugins/system/index.page +7 -0
  32. data/doc/src/documentation/plugins/system/logging.page +13 -0
  33. data/doc/src/documentation/{tags → plugins/tags}/date.page +0 -0
  34. data/doc/src/documentation/{tags → plugins/tags}/executecommand.page +0 -1
  35. data/doc/src/documentation/{tags → plugins/tags}/includefile.page +0 -0
  36. data/doc/src/documentation/{tags → plugins/tags}/index.page +2 -2
  37. data/doc/src/documentation/{tags → plugins/tags}/langbar.de.page +0 -0
  38. data/doc/src/documentation/{tags → plugins/tags}/langbar.page +1 -1
  39. data/doc/src/documentation/{tags → plugins/tags}/menu.de.page +1 -0
  40. data/doc/src/documentation/{tags → plugins/tags}/menu.page +1 -1
  41. data/doc/src/documentation/{tags → plugins/tags}/meta.page +0 -0
  42. data/doc/src/documentation/{tags → plugins/tags}/multilang.de.page +0 -0
  43. data/doc/src/documentation/{tags → plugins/tags}/multilang.fr.page +0 -0
  44. data/doc/src/documentation/{tags → plugins/tags}/multilang.page +0 -0
  45. data/doc/src/documentation/{tags → plugins/tags}/navbar.page +0 -0
  46. data/doc/src/documentation/{tags → plugins/tags}/relocatable.page +0 -0
  47. data/doc/src/documentation/{tags → plugins/tags}/sitemap.page +0 -0
  48. data/doc/src/documentation/{tags → plugins/tags}/wikilink.page +0 -0
  49. data/doc/src/download.page +1 -0
  50. data/doc/src/index.page +26 -8
  51. data/doc/src/meta.info +13 -18
  52. data/install.rb +1 -1
  53. data/lib/webgen/configuration.rb +6 -153
  54. data/lib/webgen/logging.rb +38 -10
  55. data/lib/webgen/node.rb +26 -6
  56. data/lib/webgen/plugin.rb +168 -0
  57. data/lib/webgen/plugins/filehandler/backing.rb +11 -56
  58. data/lib/webgen/plugins/filehandler/directory.rb +8 -8
  59. data/lib/webgen/plugins/filehandler/filecopy.rb +2 -2
  60. data/lib/webgen/plugins/filehandler/filehandler.rb +5 -9
  61. data/lib/webgen/plugins/filehandler/page.rb +40 -79
  62. data/lib/webgen/plugins/filehandler/picturegallery.rb +3 -3
  63. data/lib/webgen/plugins/filehandler/template.rb +2 -2
  64. data/lib/webgen/plugins/tags/langbar.rb +2 -2
  65. data/lib/webgen/plugins/tags/menu.rb +5 -13
  66. data/lib/webgen/plugins/tags/relocatable.rb +2 -2
  67. data/lib/webgen/plugins/tags/sitemap.rb +2 -2
  68. data/lib/webgen/plugins/tags/wikilink.rb +4 -3
  69. data/lib/webgen/webgen.rb +262 -57
  70. data/testsite/src/default.template +1 -1
  71. data/testsite/src/images/bghack.png +0 -0
  72. data/testsite/src/meta.info +7 -10
  73. metadata +65 -44
  74. data/doc/extension.config +0 -60
  75. data/doc/src/documentation/extloader.page +0 -20
  76. data/doc/src/documentation/filehandler/backing.page +0 -16
  77. data/lib/webgen/plugins/extloader.rb +0 -88
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Command Line Interface
3
+ inMenu: true
4
+ menuOrder: 20
5
+ ---
6
+ h2. Command Line Interface
7
+
8
+ The command line interface (CLI) has a command style syntax like Subversion's @svn@ or Rubygems'
9
+ @gem@. Following are the available commands and their parameters. Have a look at the usage
10
+ description to see how to use each command.
11
+
12
+ <notextile>{clidesc: }</notextile>
@@ -0,0 +1,150 @@
1
+ ---
2
+ title: Getting Started
3
+ inMenu: true
4
+ menuOrder: 10
5
+ ---
6
+ h1. Getting Started with webgen
7
+
8
+ h2. The Needed Directories
9
+
10
+ Webgen utilizes the following directories. These directories are in the direcctory in which the
11
+ webgen command is issued.
12
+
13
+ * @src@: The source directory in which all the source files for the website are.
14
+
15
+ * @output@: This directory is created, if it does not exist, when webgen is run. All the output
16
+ files are put into this directory
17
+
18
+ * @log@: If the logging mechanism is configured to write the log messages to files, this is the
19
+ directory where the log files will be. It will be created if it does not exist.
20
+
21
+ * @plugin@: The extension directory. You can put self-written plugins into this directory so that
22
+ they can be used by webgen. All <tt>*.rb</tt> files in this directory and its
23
+ subdirectories are loaded as plugins.
24
+
25
+ h2. Create basic website structure
26
+
27
+ And now, let's make a website!
28
+
29
+ First, you need to create the basic directories. You can let webgen do this:
30
+
31
+ <pre>
32
+ ~ > webgen create sample_site
33
+ </pre>
34
+
35
+ Webgen created the @sample_site@ directory which holds all directories necessary for running webgen.
36
+ So you can run webgen to create your website. Just change into the @sample_site@ directory and run
37
+ webgen
38
+
39
+ <pre>
40
+ ~ > cd sample_site
41
+ ~/sample_site > webgen
42
+ </pre>
43
+
44
+ Easy! Webgen has parsed the @src@ directory and has created the HTML output. However, as we did not
45
+ write any content yet, there is not much to see (only the default page). So let's do that now!
46
+
47
+ h2. Add Content to the Website
48
+
49
+ When using the @create@ command, webgen does not only create the needed directories but it also
50
+ provides you with some default files:
51
+
52
+ * @src/default.template@: The default template for the new website.
53
+ * @src/default.css@: The default css file for the new website.
54
+ * @src/index.page@: The index page for the root directory of the website.
55
+
56
+ The basic scaffolding is already in place, we only have to change @index.page@ and add other page
57
+ files. Just open the file @index.page@ in your favorite text editor and change its content. After
58
+ that we create a new file, @hello.page@, with the following content:
59
+
60
+ <pre>
61
+ \---
62
+ title: Sample hello page
63
+ inMenu: true
64
+ \---
65
+ This is a sample page with the title "{title:}" and it is in the menu!!!
66
+ </pre>
67
+
68
+ After that, run webgen in the @sample_site@ directory and then open @output/index.html@ to view your
69
+ website.
70
+
71
+ Just add page files and other content to your website and let it grow!
72
+
73
+ h2. Using Meta Information in Pages
74
+
75
+ Meta information is specified at the beginning of a page file. Have a look at the
76
+ <a href="{relocatable: plugins/filehandler/pagehandler.html}">documentation</a> to see how that is done
77
+ in detail!
78
+
79
+ We are now going to use meta information to customize our website! Open the file @default.template@
80
+ and add this before the &lt;/body&gt; tag:
81
+
82
+ <pre>
83
+ <div class="bar">
84
+ File last changed on \{filemdate: }!
85
+ </div>
86
+ </pre>
87
+
88
+ The part @\{filemdate: }@ is called a tag. Tags are implemented using plugins and they can be used to
89
+ insert dynamic content when webgen is run. For example, the menu on the page is generated with the
90
+ @\{menu: }@ tag! If webgen sees a tag during the processing of a page for which no tag plugin
91
+ exists, it looks at the meta information of the page. If there is a meta information entry with the
92
+ tag name, it uses that content instead. We will use that now!
93
+
94
+ Open the file @hello.page@ and add the following meta information:
95
+
96
+ <pre>
97
+ filemdate: 10.4.2005
98
+ </pre>
99
+
100
+ so that @hello.page@ looks like this:
101
+
102
+ <pre>
103
+ \---
104
+ title: Sample hello page
105
+ inMenu: true
106
+ filemdate: 10.4.2005
107
+ \---
108
+ This is a sample page with the title "{title:}" and it is in the menu!!!
109
+ </pre>
110
+
111
+ Run webgen and view the output! The tag @\{filemdate: }@ got substituted by the value specified in
112
+ the meta information. As we have not put any meta information in the @index.page@ file, a warning is
113
+ issued when webgen is run and no date is shown on the page!
114
+
115
+ h2. Write a Simple Plugin
116
+
117
+ Because we are not quite happy with our basic file modification time tag, we are going to write a
118
+ simple tag plugin.
119
+
120
+ Create the file @plugin/filemdate.rb@ with the following content:
121
+
122
+ <pre>
123
+ require 'webgen/plugins/tags/tags'
124
+
125
+ module Tags
126
+
127
+ class FileMDateTag < DefaultTag
128
+
129
+ summary "Puts the modification time of the file on the page"
130
+ depends_on 'Tags'
131
+
132
+ def initialize
133
+ super
134
+ register_tag( 'filemdate' )
135
+ end
136
+
137
+ def process_tag( tag, node, refNode )
138
+ return File.mtime( node.recursive_value( 'src' ) ).to_s
139
+ end
140
+
141
+ end
142
+
143
+ end
144
+ </pre>
145
+
146
+ That's all! The new plugin gets loaded when webgen starts and it is used when the tag @filemdate@ is
147
+ encountered. We can now safely remove the @filemdate@ meta info from the file @hello.page@ although
148
+ you can leave it there - it won't do any harm.
149
+
150
+ Again, just run webgen and view the output!
@@ -36,18 +36,6 @@ works and what you can expect when you start webgen.
36
36
  important. Developers who extend webgen by writing a new plugin can use the informational and
37
37
  debug messages to see what is going on and to help them develop the plugin.
38
38
 
39
- h2. Usage
40
-
41
- Webgen uses two directories: one to read the source files from and an other to write the output
42
- files to. The default source directory is @src@ and the default output directory is @output@. The
43
- source directory can be structured in any way you like, there is no restriction in respect of the
44
- number of directories or files.
45
-
46
- To build the website you simple need to change to the parent directoy of the source directory and
47
- type @webgen@. If everything is okay, no output will appear and you can point your browser to the
48
- output directory and view your website. If not, webgen tries to give detailed information about what
49
- happened and why something could not be done correctly.
50
-
51
39
  h2. Configuration
52
40
 
53
41
  Webgen provides a default configuration out of the box. If you can live with that, you do not need
@@ -57,7 +45,7 @@ in the current directory for the configuration file.
57
45
 
58
46
  If you want to get the configuration values you can run webgen like this
59
47
  <pre>
60
- $ webgen -c
48
+ $ webgen show config
61
49
  </pre>
62
50
 
63
51
  The list shows sorted by the plugin name the current values and the default values for each
@@ -66,9 +54,3 @@ plugin name as top level key and each configuration option as a key/value pair.
66
54
  looks like this:
67
55
 
68
56
  <pre class="webgen-file">{includeFile: /../../../testsite/config.yaml}</pre>
69
-
70
- h2. Plugins
71
-
72
- Webgen is written with extensibility in mind; therefore most of its features are implemented with
73
- plugins, only the core functions are not plugins. Use the menu to view the documentation for
74
- individual plugins.
@@ -0,0 +1,33 @@
1
+ ---
2
+ title: Backing File Handler
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: BackingFileHandler}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The backing file handler is used to set meta information for other files. It can be used to set
12
+ additional meta information for page description files. However, its main purpose is to add virtual
13
+ pages and directories.
14
+
15
+ h2. File Format
16
+
17
+ The files are written in YAML and have a very easy structure:
18
+ <pre>
19
+ filename1.en.html:
20
+ metainfo1: value1
21
+ metainfo2: value2
22
+ filename1.de.html:
23
+ metainfo21: value21
24
+ </pre>
25
+
26
+ Your can use relative and absoulte paths in the filenames. However, you cannot specify meta
27
+ information for files which are in one of the parent directories of the backing file.
28
+
29
+ Using backing files you can add virtual files and directories. If the file specified in the entry
30
+ does not exist, a node for that file will be created. This will also create the whole directory tree
31
+ this virtual node is in. It allows you, for example, to add external items to the menu. You need
32
+ to specify the +dest+ meta information which points to the actual location of the referenced page.
33
+
@@ -11,5 +11,4 @@ h2. Description
11
11
  The directory handler is used for processing directories. It creates the target directories and
12
12
  additionally an index file for each directory can be specified. If specified, this file is used
13
13
  instead of the plain directory index for displaying purposes. For example, the menu item for the
14
- file handlers page is generated by the index file for the directory @documentation/filehandler@ on
15
- this website.
14
+ file handlers page is generated by the index file of the @filehandler@ directory.
@@ -76,4 +76,4 @@ DefaultGalleryLayouter and define the layout methods.
76
76
 
77
77
  h2. Examples
78
78
 
79
- You can view an example gallery <a href="{relocatable: /Design_Gallery_1.page}">here</a>!
79
+ You can view an example gallery <a href="{relocatable: /Design_Gallery_1.html}">here</a>!
@@ -0,0 +1,20 @@
1
+ ---
2
+ title: Plugins
3
+ menuOrder: 30
4
+ directoryName: Plugins
5
+ ---
6
+ h2. About
7
+
8
+ All available plugins in the distribution are described in this section. Choose a plugin category
9
+ to get more information!
10
+
11
+ h2. Plugins
12
+
13
+ Webgen is written with extensibility in mind; therefore most of its features are implemented with
14
+ plugins, only the core functions are not plugins.
15
+
16
+ Writing your own plugins is not difficult, too! If you need a specific functionality, implement a
17
+ plugin and put it under the site specific @plugin@ directory - then the plugin gets loaded with the
18
+ others. It's so easy!
19
+
20
+ For more information have a look at the <a href="{relocatable: /rdoc/index.html}">API documentation</a>!
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Configuration
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: Configuration}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The configuration plugin provides a place for all the parameters which have global influence, like
12
+ the global language setting.
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: System Plugins
3
+ directoryName: System Plugins
4
+ ---
5
+ h2. About
6
+
7
+ The system plugins provide core functionality for webgen.
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: Logging
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: Logging}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The logging plugin provides a logging mechanism which can be used to analyse errors of the website.
12
+ If the parameter @logToFile@ is true, then the log messags will not appear on the error console but
13
+ they are written to log files which reside in the @log@ directory.
@@ -14,6 +14,5 @@ h2. Examples
14
14
 
15
15
  table{border:1px solid black}.
16
16
  |_.Command|_.Output|
17
- |\{execute: date}|<pre class="webgen-file">{execute: date}</pre>|
18
17
  |\{execute: ls}|<pre class="webgen-file">{execute: ls}</pre>|
19
18
  |\{execute: uname -p}|<pre class="webgen-file">{execute: uname -p}</pre>|
@@ -19,9 +19,9 @@ Tags are defined by a special markup code. A tag has the following structure:
19
19
 
20
20
  Every time a tag is found in a source file, the registered plugin for the tag is called. The plugin
21
21
  returns a string which is put into the output file instead of the tag. The output a tag plugin can
22
- produce ranges from something simple to something complex. For example, the <a href="{relocatable: meta.page}">
22
+ produce ranges from something simple to something complex. For example, the <a href="{relocatable: meta.html}">
23
23
  Meta Tag</a> plugin copies any additional info specified in the source file verbatim
24
- into the correct place in the output file. And in contrast, the <a href="{relocatable: menu.page}">
24
+ into the correct place in the output file. And in contrast, the <a href="{relocatable: menu.html}">
25
25
  Menu Tag</a> plugin generates a whole menu tree.
26
26
 
27
27
  h2. Tag Parameters
@@ -15,7 +15,7 @@ item.
15
15
 
16
16
  h2. Examples
17
17
 
18
- Here is a <a href="{relocatable: multilang.page}">link</a> to a page which is translated to several
18
+ Here is a <a href="{relocatable: multilang.html}">link</a> to a page which is translated to several
19
19
  languages (more or less ;-). Have a look at it and don't forget to view the page in the other
20
20
  languages!
21
21
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: Menütag
3
+ inMenu: true
3
4
  ---
4
5
  <div class="section">
5
6
 
@@ -12,7 +12,7 @@ The menu tag is used to generate a menu for the website. You can see such a menu
12
12
  page. To get a list of all supported parameters for the menu tag, have a look at its API
13
13
  documentation.
14
14
 
15
- This page is available in <a href="{relocatable: menu.page/menu.de.html}">German</a>. Try and go to
15
+ This page is available in <a href="menu.de.html">German</a>. Try and go to
16
16
  the german version of this page. You will see that the menu items for which translations exist
17
17
  change their names.
18
18
 
@@ -12,6 +12,7 @@ Download: "http://rubyforge.org/frs/?group_id=296":http://rubyforge.org/frs/?gro
12
12
 
13
13
  h2. Dependencies
14
14
 
15
+ * "cmdparse":http://cmdparse.rubyforge.org version 1.0.1 or higher
15
16
  * "RedCloth":http://redcloth.rubyforge.org version 2.0.10 or higher if you want Textile support
16
17
  * "BlueCloth":http://www.deveiate.org version 1.0.0 or higher if you want Markdown support
17
18
  * "RMagick":http://rmagick.rubyforge.org/ version 1.7.1 or higher if you want automatic thumbnail
data/doc/src/index.page CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: Home
2
+ title: HomePage
3
3
  inMenu: true
4
4
  directoryName: Webgen
5
5
  ---
@@ -10,35 +10,53 @@ h2. Welcome
10
10
  This whole site was generated with webgen and provides an online demonstration of its features.
11
11
  Choose from the menu what you want to see from or know about webgen!
12
12
 
13
+ If you have an idea for a new feature, "request
14
+ it!":http://rubyforge.org/tracker/?atid=1210&group_id=296&func=browse. If you have found a bug, you
15
+ can "report it here!":http://rubyforge.org/tracker/?atid=1207&group_id=296&func=browse Also, there
16
+ are "forums":http://rubyforge.org/forum/?group_id=296 and a "mailing
17
+ list":http://rubyforge.org/mail/?group_id=296 available if you have any questions!
18
+
13
19
  h2. News
14
20
 
15
- *Webgen 0.3.2 released!!!*
21
+ *Webgen 0.3.3 released!!!*
22
+
23
+ Major changes:
24
+
25
+ * New command line interface based on "CommandParser":http://cmdparse.rubyforge.org
26
+ * Now you can let webgen create the basic directories and files by executing @webgen create my_site@
27
+ * New logging plugin lets you have more control over logging and log files
28
+ * Now each website can have a plugin directory
29
+ * New parameters for: <a href="{relocatable: documentation/plugins/tags/wikilink.html}">wikilink</a>
30
+ * Changed format of backing files -> have a look at the <a href="{relocatable: documentation/plugins/filehandler/backing.html}">documentation</a>!
31
+ * Removed obsolete Extension Loader plugin
32
+ * Fixed bugs
33
+
34
+
35
+ <b>Webgen 0.3.2 released!!!</b>
16
36
 
17
37
  Bug fix release for bug #1637 and other bugs
18
38
 
19
- h2. News
20
39
 
21
40
  *Webgen 0.3.1 released!!!*
22
41
 
23
42
  Major changes:
24
43
 
25
- * Better DefaultLayouter for picture galleries (<a href="{relocatable: Design_Gallery_1.page}">online demo</a>)
26
- * Output names for page files now customizable (see <a href="{relocatable: documentation/filehandler/pagehandler.page}">PageHandler</a>)
44
+ * Better DefaultLayouter for picture galleries (<a href="{relocatable: Design_Gallery_1.html}">online demo</a>)
45
+ * Output names for page files now customizable (see <a href="{relocatable: documentation/plugins/filehandler/pagehandler.html}">PageHandler</a>)
27
46
  * On-the-fly creation of thumbnails for pictures with RMagick
28
- * New tags: <a href="{relocatable: documentation/tags/sitemap.page}">sitemap</a>
47
+ * New tags: <a href="{relocatable: documentation/plugins/tags/sitemap.html}">sitemap</a>
29
48
  * Tag @lang@ renamed, new name @langbar@!
30
49
  * New parameters for @menu@ tag
31
50
  * Automatic checking of HTML files on their validness
32
51
  * Fixed bugs
33
52
 
34
- h2. News
35
53
 
36
54
  *Webgen 0.3.0 released!!!*
37
55
 
38
56
  Major changes:
39
57
 
40
58
  * Textile, Markdown, RDOC and HTML as content format supported!!!
41
- * New tags: <a href="{relocatable: documentation/tags/wikilink.page}">wikilink</a>
59
+ * New tags: <a href="{relocatable: documentation/plugins/tags/wikilink.html}">wikilink</a>
42
60
  * Improved plugin system
43
61
  * On-the-fly creation of new tags
44
62
  * Fixed bugs