webgen 0.3.0

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.
Files changed (105) hide show
  1. data/COPYING +340 -0
  2. data/ChangeLog +2172 -0
  3. data/README +16 -0
  4. data/Rakefile +283 -0
  5. data/TODO +133 -0
  6. data/VERSION +1 -0
  7. data/bin/webgen +5 -0
  8. data/doc/extension.config +55 -0
  9. data/doc/src/default.css +129 -0
  10. data/doc/src/default.template +45 -0
  11. data/doc/src/design.gallery +18 -0
  12. data/doc/src/designs/default.png +0 -0
  13. data/doc/src/designs/nostyle.png +0 -0
  14. data/doc/src/designs/old.png +0 -0
  15. data/doc/src/documentation/extloader.page +20 -0
  16. data/doc/src/documentation/filehandler/backing.page +16 -0
  17. data/doc/src/documentation/filehandler/copy.page +12 -0
  18. data/doc/src/documentation/filehandler/directory.page +15 -0
  19. data/doc/src/documentation/filehandler/index.page +13 -0
  20. data/doc/src/documentation/filehandler/page.page +122 -0
  21. data/doc/src/documentation/filehandler/picturegallery.page +25 -0
  22. data/doc/src/documentation/filehandler/template.page +21 -0
  23. data/doc/src/documentation/index.page +47 -0
  24. data/doc/src/documentation/tags/date.page +19 -0
  25. data/doc/src/documentation/tags/executecommand.page +19 -0
  26. data/doc/src/documentation/tags/includefile.page +15 -0
  27. data/doc/src/documentation/tags/index.page +39 -0
  28. data/doc/src/documentation/tags/lang.de.page +6 -0
  29. data/doc/src/documentation/tags/lang.page +27 -0
  30. data/doc/src/documentation/tags/menu.de.page +11 -0
  31. data/doc/src/documentation/tags/menu.page +30 -0
  32. data/doc/src/documentation/tags/meta.page +20 -0
  33. data/doc/src/documentation/tags/multilang.de.page +4 -0
  34. data/doc/src/documentation/tags/multilang.fr.page +4 -0
  35. data/doc/src/documentation/tags/multilang.page +4 -0
  36. data/doc/src/documentation/tags/navbar.page +19 -0
  37. data/doc/src/documentation/tags/relocatable.page +16 -0
  38. data/doc/src/documentation/tags/wikilink.page +18 -0
  39. data/doc/src/download.page +42 -0
  40. data/doc/src/features.page +14 -0
  41. data/doc/src/index.page +48 -0
  42. data/doc/src/logo.png +0 -0
  43. data/doc/src/meta.info +22 -0
  44. data/install.rb +19 -0
  45. data/lib/util/composite.rb +101 -0
  46. data/lib/util/listener.rb +105 -0
  47. data/lib/webgen/configuration.rb +216 -0
  48. data/lib/webgen/logging.rb +73 -0
  49. data/lib/webgen/node.rb +147 -0
  50. data/lib/webgen/plugins/extloader.rb +88 -0
  51. data/lib/webgen/plugins/filehandler/backing.rb +200 -0
  52. data/lib/webgen/plugins/filehandler/directory.rb +96 -0
  53. data/lib/webgen/plugins/filehandler/filecopy.rb +59 -0
  54. data/lib/webgen/plugins/filehandler/filehandler.rb +209 -0
  55. data/lib/webgen/plugins/filehandler/pagehandler/html.rb +43 -0
  56. data/lib/webgen/plugins/filehandler/pagehandler/markdown.rb +53 -0
  57. data/lib/webgen/plugins/filehandler/pagehandler/page.rb +205 -0
  58. data/lib/webgen/plugins/filehandler/pagehandler/rdoc.rb +50 -0
  59. data/lib/webgen/plugins/filehandler/pagehandler/textile.rb +52 -0
  60. data/lib/webgen/plugins/filehandler/picturegallery.rb +194 -0
  61. data/lib/webgen/plugins/filehandler/template.rb +98 -0
  62. data/lib/webgen/plugins/tags/date.rb +46 -0
  63. data/lib/webgen/plugins/tags/executecommand.rb +53 -0
  64. data/lib/webgen/plugins/tags/includefile.rb +60 -0
  65. data/lib/webgen/plugins/tags/lang.rb +50 -0
  66. data/lib/webgen/plugins/tags/menu.rb +198 -0
  67. data/lib/webgen/plugins/tags/meta.rb +54 -0
  68. data/lib/webgen/plugins/tags/navbar.rb +62 -0
  69. data/lib/webgen/plugins/tags/relocatable.rb +58 -0
  70. data/lib/webgen/plugins/tags/tags.rb +247 -0
  71. data/lib/webgen/plugins/tags/wikilink.rb +58 -0
  72. data/lib/webgen/plugins/treewalker.rb +81 -0
  73. data/lib/webgen/webgen.rb +155 -0
  74. data/setup.rb +1331 -0
  75. data/testsite/config.yaml +7 -0
  76. data/testsite/src/bluecloth.page +102 -0
  77. data/testsite/src/default.css +146 -0
  78. data/testsite/src/default.template +33 -0
  79. data/testsite/src/home.en.page +22 -0
  80. data/testsite/src/home.page +22 -0
  81. data/testsite/src/images/bghack.png +0 -0
  82. data/testsite/src/images/o.png +0 -0
  83. data/testsite/src/images/smagacor.png +0 -0
  84. data/testsite/src/images/tictactoe.png +0 -0
  85. data/testsite/src/images/x.png +0 -0
  86. data/testsite/src/index.page +21 -0
  87. data/testsite/src/meta.info +15 -0
  88. data/testsite/src/news.page +20 -0
  89. data/testsite/src/news_are_so-cool.de.page +19 -0
  90. data/testsite/src/noindex/noindex.page +20 -0
  91. data/testsite/src/pictures/index.page +20 -0
  92. data/testsite/src/projects.de.page +11 -0
  93. data/testsite/src/projects.es.page +11 -0
  94. data/testsite/src/projects.page +17 -0
  95. data/testsite/src/projects/00.index.de.page +10 -0
  96. data/testsite/src/projects/01.project2.page +20 -0
  97. data/testsite/src/projects/02.project1.page +20 -0
  98. data/testsite/src/projects/05.project3.page +22 -0
  99. data/testsite/src/projects/index.page +20 -0
  100. data/testsite/src/projects/subproj/index.page +22 -0
  101. data/testsite/src/projects/subproj/project3.page +21 -0
  102. data/testsite/src/rdoc.page +12 -0
  103. data/testsite/src/redcloth.page +106 -0
  104. data/testsite/src/test.gallery +5 -0
  105. metadata +155 -0
@@ -0,0 +1,47 @@
1
+ ---
2
+ directoryName: Documentation
3
+ ---
4
+ h2. Information
5
+
6
+ p={font-size: 150%; color: red}. *!!! This documentation is for Webgen {version: } !!!*
7
+
8
+ h2. Usage
9
+
10
+ Webgen uses two directories: one to read the source files from and an other to write the output
11
+ files to. The default source directory is @src@ and the default output directory is @output@. The
12
+ source directory can be structured in any way you like, there is no restriction in respect of the
13
+ number of directories or files.
14
+
15
+ To build the website you simple need to change to the parent directoy of the source directory and
16
+ type @webgen@. If everything is okay, no output will appear and you can point your browser to the
17
+ output directory and view your website. If not, webgen tries to give detailed information about what
18
+ happened and why something could not be done correctly.
19
+
20
+ Webgen tries to compensate for errors and warnings and _should_ not abort with an error. Instead, it
21
+ uses default values in error or warning cases and only issues messages to the log device (normally
22
+ the screen). This also means that if a library is not found (e.g. RedCloth for Textile support),
23
+ the plugin which uses the library is disabled.
24
+
25
+ h2. Configuration
26
+
27
+ Webgen provides a default configuration out of the box. If you can live with that, you do not need
28
+ to write any configuration files. Because most people cannot, you can use your own configuration
29
+ file. The configuration file has to be written in YAML and is called @config.yaml@. Webgen searches
30
+ in the current directory for the configuration file.
31
+
32
+ If you want to get the configuration values you can run webgen like this
33
+ <pre>
34
+ $ webgen -c
35
+ </pre>
36
+
37
+ The list shows sorted by the plugin name the current values and the default values for each
38
+ configuration option. Each option can be overridden in the configuration file by specifing the
39
+ plugin name as top level key and each configuration option as a key/value pair. A configuration file
40
+ looks like this:
41
+
42
+ <pre class="webgen-file">{includeFile: /../../../testsite/config.yaml}</pre>
43
+
44
+ h2. Plugins
45
+
46
+ Webgen is written with extensibility in mind; therefore most of its features are implemented with
47
+ plugins, only the core functions are not plugins.
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: Date
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: DateTag}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The date tag is used to display the current time in a specific format. You can see how the default
12
+ output looks like in the footer.
13
+
14
+ h2. Examples
15
+
16
+ table{border:1px solid black}.
17
+ |_.Command|_.Output|
18
+ |\{date: {format: %Y-%m-%d %H:%M:%S}}|{date: {format: %Y-%m-%d %H:%M:%S}}|
19
+ |\{date: {format: %x - %X}}|{date: {format: %y - %X}}|
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: Execute Command
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: ExecuteCommandTag}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The execute command tag is used to include the output from a shell command.
12
+
13
+ h2. Examples
14
+
15
+ table{border:1px solid black}.
16
+ |_.Command|_.Output|
17
+ |\{execute: date}|<pre class="webgen-file">{execute: date}</pre>|
18
+ |\{execute: ls}|<pre class="webgen-file">{execute: ls}</pre>|
19
+ |\{execute: uname -p}|<pre class="webgen-file">{execute: uname -p}</pre>|
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Include File
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: IncludeFileTag}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The include file tag is used to include the contents of a file.
12
+
13
+ h2. Examples
14
+
15
+ <pre class="webgen-file">{includeFile: {filename: includefile.page, processOutput: false}}</pre>
@@ -0,0 +1,39 @@
1
+ ---
2
+ directoryName: Tags
3
+ ---
4
+ h2. About
5
+
6
+ Tags are used to generate content. During processing of the page description files so called 'tags'
7
+ are substituted. For example, the menu you see to left was generated. This makes it easier to add or
8
+ remove menu items. If the menu was not generated, you would have to change every file which uses the
9
+ menu.
10
+
11
+ Webgen comes bundled with some default tag plugins. All currently available tags are exercised in
12
+ this online demo. Choose a tag from the menu to get a detailed description of the tag.
13
+
14
+ h2. Usage
15
+
16
+ Tags are defined by a special markup code. A tag has the following structure:
17
+
18
+ <pre class="webgen-file">\{tagname: {parameters}}</pre>
19
+
20
+ Every time a tag is found in a source file, the registered plugin for the tag is called. The plugin
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.html}">
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.html}">
25
+ Menu Tag</a> plugin generates a whole menu tree.
26
+
27
+ h2. Tag Parameters
28
+
29
+ A tag can have zero or more parameters some of which are mandatory. You can see the supported
30
+ parameters (and if they are mandatory) for each tag on the tag's page. The default mandatory
31
+ parameter can be specified in a special way, see the examples below. The format used for parsing the
32
+ parameters is YAML.
33
+
34
+ h2. Examples
35
+
36
+ table{border: 1px solid black}.
37
+ |^. @\{tagname: }@|^. No parameter specified|
38
+ |^. @\{tagname: test.html}@|^. The default mandatory parameter is set to @test.html@. This form can only be used if there is only one mandatory parameter|
39
+ |^. @\{tagname: {param1: value1, param2: value2}}@|^. Two parameters (param1 and param2) specified|
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: Tag für Sprache
3
+ ---
4
+ h2. Information
5
+
6
+ Die deutsche Seite... enthält nicht viel Information :-)
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: Language
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: LanguageTag}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The language tag is used to display a list of languages for a page. Take a look at the lower right
12
+ corner of the header. There you will find a link titled 'en'. This is the link to the english (=en)
13
+ version of this page. As this page is not translated into any other language, there is only this one
14
+ item.
15
+
16
+ h2. Examples
17
+
18
+ Here is a <a href="{relocatable: multilang.html}">link</a> to a page which is translated to several
19
+ languages (more or less ;-). Have a look at it and don't forget to view the page in the other
20
+ languages!
21
+
22
+ table{border:1px solid black}.
23
+ |_.Command|_.Output|
24
+ |<notextile>\{lang: }</notextile>|<notextile>{lang: }</notextile>|
25
+ |\{lang: {separator: Hallo}}|{lang: {separator: Hallo}}|
26
+ |\{lang: {showSingleLang: false}}|{lang: {showSingleLang: false}}|
27
+
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Menütag
3
+ ---
4
+ <div class="section">
5
+
6
+ h2. Information
7
+
8
+ Auf der linken Seite sehen sie jetzt die deutschen Menüeinträge (now you can see the german menu
9
+ entries on the left).
10
+
11
+ </div>
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: Menu
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: MenuTag}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The menu tag is used to generate a menu for the website. You can see such a menu on the left of this
12
+ page. To get a list of all supported parameters for the menu tag, have a look at its API
13
+ documentation.
14
+
15
+ This page is available in <a href="{relocatable: menu.html/menu.de.html}">German</a>. Try and go to
16
+ the german version of this page. You will see that the menu items for which translations exist
17
+ change their names.
18
+
19
+ The menu to the left is generated with the default settings:
20
+
21
+ * level = 1
22
+ * subtreeLevel = 3
23
+ * showCurrentSubtreeOnly = true
24
+
25
+ h2. Examples
26
+
27
+ Below are some other menus generated from the same source but with different settings:
28
+
29
+ table{border: 1px solid black}.
30
+ |^. \{menu: {subtreeLevel: 1}}{menu: {subtreeLevel: 1}}|^. \{menu: {showCurrentSubtreeOnly: false}} {menu: {showCurrentSubtreeOnly: false}}|
@@ -0,0 +1,20 @@
1
+ ---
2
+ title: Meta
3
+ inMenu: true
4
+ dummyForMeta: This is content specified in the meta information section.
5
+ ---
6
+ h2. Information
7
+
8
+ <notextile>{describe: MetaTag}</notextile>
9
+
10
+ h2. Description
11
+
12
+ The meta tag is used to copy meta information verbatim to the output file. For example, if you
13
+ define a meta information with the key <code>revision</code>, you could put the tag
14
+ <code>\{revision: }</code> into the content part of the file and the value gets substituted
15
+ automatically.
16
+
17
+ h2. Examples
18
+
19
+ There is a meta information called 'dummyForMeta' defined for this page, so when this tag
20
+ is used @\{dummyForMeta:}@, you get this '@{dummyForMeta:}@'.
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: Seite in verschiedenen Sprachen
3
+ ---
4
+ Das ist jetzt die deutsche Version der Seite.
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: Francais
3
+ ---
4
+ Parle vouz francais?
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: Multi language page
3
+ ---
4
+ This is the english version of this page.
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: Navigation Bar
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: NavbarTag}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The navigation bar tag is used to display the hierarchy for the current page. You can see it in
12
+ action in the lower left corner of the header.
13
+
14
+ h2. Examples
15
+
16
+ table{border:1px solid black}.
17
+ |_.Command|_.Output|
18
+ |<notextile>\{navbar: {separator: " HALLO "}}</notextile>|<notextile>{navbar: {separator: " HALLO "}}</notextile>|
19
+ |\{navbar:}|{navbar:}|
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: Relocatable
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: RelocatableTag}</notextile>
8
+
9
+ h2. Description
10
+
11
+ The relocatable tag is used to change the path of the supplied file and is most often used in
12
+ template files. A relocatable tag looks like this: @\{relocatable: default.css}@. If this
13
+ was put into a template and the template was used by a file in a subdirectory, then the
14
+ @relocatable@ tag would put @../default.css@ into the output file.
15
+
16
+ This ensures that the relative path to the referenced file is always correct.
@@ -0,0 +1,18 @@
1
+ ---
2
+ title: WikiLink
3
+ inMenu: true
4
+ ---
5
+ h2. Information
6
+
7
+ <notextile>{describe: WikiLinkTag}</notextile>
8
+
9
+ h2. Description
10
+
11
+ This tag can be used to add a link to a wiki page. It is used on this website to automatically
12
+ provide a "Feedback" link for each page.
13
+
14
+ table{border:1px solid black}.
15
+ |_.Command|_.Output|
16
+ |\{wikilink: }|{wikilink: }|
17
+ |\{wikilink: {relURL: hallo}}|{wikilink: {relURL: hallo}}|
18
+ |\{wikilink: {relURL: hallo, title: MoinMoin}}|{wikilink: {relURL: hallo, title: MoinMoin}}|
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: Download &amp; Installation
3
+ inMenu: true
4
+ ---
5
+ h2. Download
6
+
7
+ The newest version of webgen can be downloaded from Rubyforge.
8
+
9
+ Homepage: "webgen.rubyforge.org":http://webgen.rubyforge.org
10
+
11
+ Download: "http://rubyforge.org/frs/?group_id=296":http://rubyforge.org/frs/?group_id=296
12
+
13
+ h2. Dependencies
14
+
15
+ * "RedCloth":http://redcloth.rubyforge.org version 2.0.10 or higher if you want Textile support
16
+ * "BlueCloth":http://www.deveiate.org version 1.0.0 or higher if you want Markdown support
17
+
18
+ h2. Installation
19
+
20
+ There are many ways to install webgen. Choose the one you like best:
21
+
22
+ * Via RPA
23
+ <pre>
24
+ $ rpa install webgen
25
+ </pre>
26
+
27
+ * Via RubyGems
28
+ <pre>
29
+ $ gem install webgen
30
+ </pre>
31
+
32
+ * The do-it-yourself way
33
+ <pre>
34
+ $ ruby setup.rb config
35
+ $ ruby setup.rb setup
36
+ $ ruby setup.rb install
37
+ </pre>
38
+
39
+ * The simplified do-it-yourself way
40
+ <pre>
41
+ $ rake install
42
+ </pre>
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Features
3
+ inMenu: true
4
+ ---
5
+ h2. Feature list
6
+
7
+ * Easily extendable through plugins
8
+ * Uses templates for separating layout from content
9
+ * Supports several different page description languages (YAML, XML, plain HTML), new ones are easy to add
10
+ * Uses 'tags' to add generated content to the web pages
11
+ * Standard distribution provides often used tags
12
+ * Supports 'virtual files' via meta information backing files
13
+ * Easy to configure if one needs to
14
+ * Relatively fast: process ~1000 files in ~25 seconds on an {execute: uname -p}
@@ -0,0 +1,48 @@
1
+ ---
2
+ title: Home
3
+ inMenu: true
4
+ directoryName: Webgen
5
+ ---
6
+ h2. Welcome
7
+
8
+ ... to the homepage of _*webgen*_, a template based web page generator.
9
+
10
+ This whole site was generated with webgen and provides an online demonstration of its features.
11
+ Choose from the menu what you want to see from or know about webgen!
12
+
13
+ h2. News
14
+
15
+ *Webgen 0.3.0 was released!!!*
16
+
17
+ Major changes:
18
+
19
+ * Textile, Markdown, RDOC and HTML as content format supported!!!
20
+ * New tags: <a href="{relocatable: documentation/tags/wikilink.html}">wikilink</a>
21
+ * Improved plugin system
22
+ * On-the-fly creation of new tags
23
+ * Fixed bugs
24
+ * Improved online documentation: pages on file handlers and tags now show parameters and other
25
+ additional info
26
+ * Added comprehensive test suite --> TODO
27
+ * and more...
28
+
29
+ h2. Description
30
+
31
+ Webgen can be used to generate web pages from page description and template files. You create one
32
+ template file in which you define the layout of your page and where the content should go. After
33
+ that you can create page description files in which you only define the content.
34
+
35
+ When webgen is run it combines the template with each of the page description files and generates
36
+ the HTML output files. During this process special tags are substituted so that, for example, a menu
37
+ is generated.
38
+
39
+ h2. Author
40
+
41
+ * *Thomas Leitner*
42
+ * Web: "http://webgen.rubyforge.org":http://webgen.rubyforge.org
43
+ * e-Mail: "t_leitner@gmx.at":mailto:t_leitner@gmx.at
44
+ * GPG Key-Id: 0xD942E7F6
45
+
46
+ h2. And so ...
47
+
48
+ ... have fun!
data/doc/src/logo.png ADDED
Binary file
data/doc/src/meta.info ADDED
@@ -0,0 +1,22 @@
1
+ index.html:
2
+ en:
3
+ menuOrder: 1
4
+
5
+ download.html:
6
+ en:
7
+ menuOrder: 3
8
+
9
+ features.html:
10
+ en:
11
+ menuOrder: 5
12
+
13
+ api.html:
14
+ en:
15
+ dest: rdoc/index.html
16
+ title: API Reference
17
+ menuOrder: 7
18
+ inMenu: true
19
+
20
+ documentation/index.html:
21
+ en:
22
+ menuOrder: 9