webgen 0.3.4 → 0.3.5
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 +201 -0
- data/Rakefile +3 -2
- data/TODO +31 -4
- data/VERSION +1 -1
- data/data/webgen/example/config.yaml +2 -0
- data/data/webgen/example/src/default.css +84 -0
- data/data/webgen/example/src/default.template +32 -0
- data/data/webgen/example/src/index.page +8 -0
- data/{doc/src → data/webgen/images}/generated_by_webgen.png +0 -0
- data/data/webgen/images/valid-css.gif +0 -0
- data/data/webgen/images/valid-xhtml11.png +0 -0
- data/data/webgen/images/webgen_logo.png +0 -0
- data/doc/config.yaml +2 -0
- data/doc/plugin/extension.rb +8 -4
- data/doc/plugin/resources.rb +30 -0
- data/doc/src/default.css +251 -149
- data/doc/src/default.template +8 -8
- data/doc/src/documentation/gettingstarted.page +1 -1
- data/doc/src/documentation/index.page +6 -2
- data/doc/src/documentation/plugins/filehandler/backing.page +22 -9
- data/doc/src/documentation/plugins/filehandler/galleryhandler.page +1 -1
- data/doc/src/documentation/plugins/filehandler/index.page +9 -4
- data/doc/src/documentation/plugins/filehandler/pagehandler.page +33 -10
- data/doc/src/documentation/plugins/index.page +9 -1
- data/doc/src/documentation/plugins/menustyles/horizontal-dropdown.page +42 -0
- data/doc/src/documentation/plugins/menustyles/horizontal.page +21 -0
- data/doc/src/documentation/plugins/menustyles/index.page +12 -0
- data/doc/src/documentation/plugins/menustyles/partial.page +27 -0
- data/doc/src/documentation/plugins/menustyles/vertical-dropdown.page +23 -0
- data/doc/src/documentation/plugins/menustyles/vertical.page +32 -0
- data/doc/src/documentation/plugins/resourcemanager.page +30 -0
- data/doc/src/documentation/plugins/tags/index.page +2 -2
- data/doc/src/documentation/plugins/tags/langbar.page +4 -4
- data/doc/src/documentation/plugins/tags/menu.page +6 -17
- data/doc/src/documentation/plugins/tags/navbar.page +2 -1
- data/doc/src/documentation/plugins/tags/resource.page +22 -0
- data/doc/src/download.page +1 -1
- data/doc/src/features.page +32 -9
- data/doc/src/index.page +24 -10
- data/doc/src/meta.info +16 -6
- data/install.rb +1 -1
- data/lib/webgen/configuration.rb +24 -2
- data/lib/webgen/node.rb +29 -5
- data/lib/webgen/plugin.rb +1 -5
- data/lib/webgen/plugins/contenthandler/textile.rb +3 -3
- data/lib/webgen/plugins/filehandler/backing.rb +5 -4
- data/lib/webgen/plugins/filehandler/directory.rb +3 -3
- data/lib/webgen/plugins/filehandler/filehandler.rb +8 -4
- data/lib/webgen/plugins/filehandler/page.rb +33 -18
- data/lib/webgen/plugins/filehandler/picturegallery.rb +10 -8
- data/lib/webgen/plugins/menustyles/defaultmenustyle.rb +73 -0
- data/lib/webgen/plugins/menustyles/horizontal.rb +93 -0
- data/lib/webgen/plugins/menustyles/horizontal_dropdown.rb +113 -0
- data/lib/webgen/plugins/menustyles/partial.rb +95 -0
- data/lib/webgen/plugins/menustyles/vertical.rb +107 -0
- data/lib/webgen/plugins/menustyles/vertical_dropdown.rb +107 -0
- data/lib/webgen/plugins/resourcemanager.rb +264 -0
- data/lib/webgen/plugins/tags/langbar.rb +9 -5
- data/lib/webgen/plugins/tags/menu.rb +4 -66
- data/lib/webgen/plugins/treewalker.rb +7 -6
- data/lib/webgen/webgen.rb +72 -161
- metadata +37 -6
- data/doc/src/logo.png +0 -0
@@ -15,5 +15,6 @@ h2. Examples
|
|
15
15
|
|
16
16
|
table{border:1px solid black}.
|
17
17
|
|_.Command|_.Output|
|
18
|
-
|<notextile>\{navbar: {separator: " HALLO "}}</notextile>|<notextile>{navbar: {separator: " HALLO "}}</notextile>|
|
19
18
|
|\{navbar:}|{navbar:}|
|
19
|
+
|<notextile>\{navbar: {separator: " HALLO "}}</notextile>|<notextile>{navbar: {separator: " HALLO "}}</notextile>|
|
20
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
title: Resource
|
3
|
+
inMenu: true
|
4
|
+
---
|
5
|
+
h2. Information
|
6
|
+
|
7
|
+
<notextile>{describe: ResourceTag}</notextile>
|
8
|
+
|
9
|
+
h2. Description
|
10
|
+
|
11
|
+
The resource tag is used to include a resource either verbatim (i.e. its content is copied) or by
|
12
|
+
path. For more information about resources have a look at the
|
13
|
+
<a href="{relocatable: ../resourcemanager.page}">Resource Manager</a>.
|
14
|
+
|
15
|
+
h2. Examples
|
16
|
+
|
17
|
+
table{border:1px solid black}.
|
18
|
+
|_{width: 30%}.Command|_.Output|
|
19
|
+
|\{resource: webgen-logo}|{resource: webgen-logo}|
|
20
|
+
|\{resource: w3c-valid-xhtml11}|{resource: w3c-valid-xhtml11}|
|
21
|
+
|\{resource: {name: webgen-css, insert: data}}|{resource: {name: webgen-css, insert: data}}|
|
22
|
+
|
data/doc/src/download.page
CHANGED
@@ -12,7 +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.
|
15
|
+
* "cmdparse":http://cmdparse.rubyforge.org version 1.0.3 or higher
|
16
16
|
* "RedCloth":http://redcloth.rubyforge.org version 2.0.10 or higher if you want Textile support
|
17
17
|
* "BlueCloth":http://www.deveiate.org version 1.0.0 or higher if you want Markdown support
|
18
18
|
* "RMagick":http://rmagick.rubyforge.org/ version 1.7.1 or higher if you want automatic thumbnail
|
data/doc/src/features.page
CHANGED
@@ -4,12 +4,35 @@ inMenu: true
|
|
4
4
|
---
|
5
5
|
h2. Feature list
|
6
6
|
|
7
|
-
*
|
8
|
-
|
9
|
-
*
|
10
|
-
*
|
11
|
-
* Uses
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
|
7
|
+
* <h3>webgen core</h3>
|
8
|
+
|
9
|
+
* Easily extendable through plugins
|
10
|
+
* Easy to install and use
|
11
|
+
* Uses templates for separating layout from content
|
12
|
+
* Easy to configure if one needs to (no need if you are happy with the default values)
|
13
|
+
* Command line interface uses command style syntax (like Subversion's @svn@ command)
|
14
|
+
* Fast
|
15
|
+
|
16
|
+
* <h3>File Handler (for handling the files in the source directory)</h3>
|
17
|
+
|
18
|
+
* Powerful file copy handler for copying single files or entire directories to the output directory
|
19
|
+
* Support for gallery definition files -> generates entire picture gallery, automatic thumbnail creation
|
20
|
+
|
21
|
+
* <h3>Page Description Files (for define web pages)</h3>
|
22
|
+
|
23
|
+
* Support for ERB (embedded Ruby) in page description files and in templates
|
24
|
+
* Supports several different content formats (Textile, Markdown, RDOC, plain HTML), new ones are easy to add
|
25
|
+
* Support for specifying meta information (e.g. title, menu ordering information, ...)
|
26
|
+
|
27
|
+
* <h3>Tags (used for easily adding dynamic content to web pages)</h3>
|
28
|
+
|
29
|
+
* Standard distribution provides often used tags
|
30
|
+
* Menu tag can generate different types of menus (simple menus and ones with CSS drop downs)
|
31
|
+
* Navbar tag generates a navigation bar so that one always knows where he is in the hierarchy
|
32
|
+
* Relocatable tag for automatically generating correct relative paths to files
|
33
|
+
* ... and much more!
|
34
|
+
|
35
|
+
* <h3>Other Features</h3>
|
36
|
+
|
37
|
+
* Automatically checks generated files if they are standard conform
|
38
|
+
* Supports 'virtual files' via meta information backing files
|
data/doc/src/index.page
CHANGED
@@ -5,7 +5,7 @@ directoryName: webgen
|
|
5
5
|
---
|
6
6
|
h2. Welcome
|
7
7
|
|
8
|
-
... to the homepage of _*webgen*_, a template based
|
8
|
+
... to the homepage of _*webgen*_, a template based static website generator.
|
9
9
|
|
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!
|
@@ -18,16 +18,30 @@ list":http://rubyforge.org/mail/?group_id=296 available if you have any question
|
|
18
18
|
|
19
19
|
h2. News
|
20
20
|
|
21
|
+
<b>??.??.2005 - webgen 0.3.5 released!!!</b>
|
22
|
+
|
23
|
+
Major changes:
|
24
|
+
|
25
|
+
* Now using cmdparse version 1.0.3!
|
26
|
+
* New CLI command "clean" for deleting the generated or all files from the output directory
|
27
|
+
* Restructured menu tag -> five different menu styles now available (see <a href="{relocatable: documentation/plugins/menustyles}">Menu Styles</a>)
|
28
|
+
* New plugin <a href="{relocatable: documentation/plugins/resourcemanager.page}">ResourceManager</a> for defining resources
|
29
|
+
* New plugin <a href="{relocatable: documentation/plugins/tags/resource.page}">Resource Tag</a> for accessing resources
|
30
|
+
* Pages files can now be referenced in @relocatable@ tag and backing files with a standardified name (see <a href="{relocatable: documentation/plugins/filehandler/pagehandler.page#naming}">here</a>), despite an eventually self defined naming scheme
|
31
|
+
* New parameters: <a href="{relocatable: documentation/plugins/tags/langbar.page}">LangbarTag:showOwnLang</a>
|
32
|
+
* Changed paramters: <a href="{relocatable: documentation/plugins/filehandler/pagehandler.page}">PageHandler:validator</a> (now deactivated by default)
|
33
|
+
* Fixed bugs
|
34
|
+
|
21
35
|
<b>12.05.2005 - webgen 0.3.4 released!!!</b>
|
22
36
|
|
23
37
|
Major changes:
|
24
38
|
|
25
39
|
* FileHandler now uses path patterns and/or extensions for determining which files to process !
|
26
|
-
* ERB (embedded ruby) can now be used in templates and page files (see <a href="{relocatable: documentation/plugins/filehandler/pagehandler.
|
40
|
+
* ERB (embedded ruby) can now be used in templates and page files (see <a href="{relocatable: documentation/plugins/filehandler/pagehandler.page}">PageHandler</a>)!
|
27
41
|
* Relocatable tag now accepts complex URIs (URIs with query and fragment part, absolute URIs)
|
28
42
|
* Changed meta info name *menuOrder* to *orderInfo* (e.g. used for specifying order information for menus) -- you have to adapt your page and backing files!!!
|
29
|
-
* New parameters: <a href="{relocatable: documentation/plugins/filehandler/pagehandler.
|
30
|
-
* Changed parameters: <a href="{relocatable: documentation/plugins/filehandler}">FileHandler:ignorePaths</a>, <a href="{relocatable: documentation/plugins/filehandler/copy.
|
43
|
+
* New parameters: <a href="{relocatable: documentation/plugins/filehandler/pagehandler.page}">PageHandler:useERB</a>
|
44
|
+
* Changed parameters: <a href="{relocatable: documentation/plugins/filehandler}">FileHandler:ignorePaths</a>, <a href="{relocatable: documentation/plugins/filehandler/copy.page}">FileCopyHandler:paths</a>
|
31
45
|
* New page describing meta information items used by plugins
|
32
46
|
* Fixed bugs
|
33
47
|
|
@@ -39,8 +53,8 @@ Major changes:
|
|
39
53
|
* Now you can let webgen create the basic directories and files by executing @webgen create my_site@
|
40
54
|
* New logging plugin lets you have more control over logging and log files
|
41
55
|
* Now each website can have a plugin directory
|
42
|
-
* New parameters for: <a href="{relocatable: documentation/plugins/tags/wikilink.
|
43
|
-
* Changed format of backing files -> have a look at the <a href="{relocatable: documentation/plugins/filehandler/backing.
|
56
|
+
* New parameters for: <a href="{relocatable: documentation/plugins/tags/wikilink.page}">wikilink</a>
|
57
|
+
* Changed format of backing files -> have a look at the <a href="{relocatable: documentation/plugins/filehandler/backing.page}">documentation</a>!
|
44
58
|
* Removed obsolete Extension Loader plugin
|
45
59
|
* Fixed bugs
|
46
60
|
|
@@ -54,10 +68,10 @@ Bug fix release for bug #1637 and other bugs
|
|
54
68
|
|
55
69
|
Major changes:
|
56
70
|
|
57
|
-
* Better DefaultLayouter for picture galleries (<a href="{relocatable: Design_Gallery_1.
|
58
|
-
* Output names for page files now customizable (see <a href="{relocatable: documentation/plugins/filehandler/pagehandler.
|
71
|
+
* Better DefaultLayouter for picture galleries (<a href="{relocatable: Design_Gallery_1.page}">online demo</a>)
|
72
|
+
* Output names for page files now customizable (see <a href="{relocatable: documentation/plugins/filehandler/pagehandler.page}">PageHandler</a>)
|
59
73
|
* On-the-fly creation of thumbnails for pictures with RMagick
|
60
|
-
* New tags: <a href="{relocatable: documentation/plugins/tags/sitemap.
|
74
|
+
* New tags: <a href="{relocatable: documentation/plugins/tags/sitemap.page}">sitemap</a>
|
61
75
|
* Tag @lang@ renamed, new name @langbar@!
|
62
76
|
* New parameters for @menu@ tag
|
63
77
|
* Automatic checking of HTML files on their validness
|
@@ -69,7 +83,7 @@ Major changes:
|
|
69
83
|
Major changes:
|
70
84
|
|
71
85
|
* Textile, Markdown, RDOC and HTML as content format supported!!!
|
72
|
-
* New tags: <a href="{relocatable: documentation/plugins/tags/wikilink.
|
86
|
+
* New tags: <a href="{relocatable: documentation/plugins/tags/wikilink.page}">wikilink</a>
|
73
87
|
* Improved plugin system
|
74
88
|
* On-the-fly creation of new tags
|
75
89
|
* Fixed bugs
|
data/doc/src/meta.info
CHANGED
@@ -1,19 +1,29 @@
|
|
1
|
-
index.
|
1
|
+
index.page:
|
2
2
|
orderInfo: 1
|
3
3
|
|
4
|
-
download.
|
5
|
-
orderInfo:
|
4
|
+
download.page:
|
5
|
+
orderInfo: 11
|
6
6
|
|
7
|
-
features.
|
7
|
+
features.page:
|
8
8
|
orderInfo: 5
|
9
9
|
|
10
10
|
api.html:
|
11
11
|
dest: rdoc/index.html
|
12
12
|
title: API Reference
|
13
|
-
|
13
|
+
|
14
|
+
documentation/api.html:
|
15
|
+
dest: ../rdoc/index.html
|
16
|
+
title: API Reference
|
17
|
+
inMenu: true
|
18
|
+
orderInfo: 60
|
19
|
+
|
20
|
+
documentation/wiki.html:
|
21
|
+
dest: http://webgen.rubyforge.org/wiki/wiki.pl
|
22
|
+
title: Wiki Web
|
14
23
|
inMenu: true
|
24
|
+
orderInfo: 50
|
15
25
|
|
16
|
-
documentation/index.
|
26
|
+
documentation/index.page:
|
17
27
|
orderInfo: 9
|
18
28
|
|
19
29
|
designs:
|
data/install.rb
CHANGED
data/lib/webgen/configuration.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
3
|
#
|
4
|
-
# $Id: configuration.rb
|
4
|
+
# $Id: configuration.rb 303 2005-06-24 13:44:14Z thomas $
|
5
5
|
#
|
6
6
|
# webgen: template based static website generator
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
@@ -37,7 +37,7 @@ end
|
|
37
37
|
|
38
38
|
module Webgen
|
39
39
|
|
40
|
-
VERSION = [0, 3,
|
40
|
+
VERSION = [0, 3, 5]
|
41
41
|
SUMMARY = "Webgen is a templated based static website generator."
|
42
42
|
DESCRIPTION = "Webgen is a web page generator implemented in Ruby. " \
|
43
43
|
"It is used to generate static web pages from templates and page " \
|
@@ -52,6 +52,28 @@ module Webgen
|
|
52
52
|
add_param 'outDirectory', 'output', 'The directory to which the output files are written.'
|
53
53
|
add_param 'lang', 'en', 'The default language.'
|
54
54
|
|
55
|
+
# Returns the data directory of webgen.
|
56
|
+
def self.data_dir
|
57
|
+
unless defined?( @@data_dir )
|
58
|
+
@@data_dir = File.join( Config::CONFIG["datadir"], "webgen" )
|
59
|
+
|
60
|
+
if defined?( Gem::Cache )
|
61
|
+
gem = Gem::Cache.from_installed_gems.search( "webgen", "=#{Webgen::VERSION.join('.')}" ).last
|
62
|
+
@@data_dir = File.join( gem.full_gem_path, "data", "webgen" ) if gem
|
63
|
+
end
|
64
|
+
|
65
|
+
@@data_dir = File.dirname( $0 ) + '/../data/webgen' if !File.exists?( @@data_dir )
|
66
|
+
|
67
|
+
if File.exists?( @@data_dir )
|
68
|
+
logger.info { "Webgen data directory found at #{@@data_dir}" }
|
69
|
+
else
|
70
|
+
logger.error { "Could not locate webgen data directory!!!" }
|
71
|
+
@@data_dir = ''
|
72
|
+
end
|
73
|
+
end
|
74
|
+
@@data_dir
|
75
|
+
end
|
76
|
+
|
55
77
|
# Does all the initialisation stuff
|
56
78
|
def init_all
|
57
79
|
load_plugins( File.dirname( __FILE__) + '/plugins', File.dirname( __FILE__).sub(/webgen$/, '') )
|
data/lib/webgen/node.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
3
|
#
|
4
|
-
# $Id: node.rb
|
4
|
+
# $Id: node.rb 294 2005-06-14 06:37:56Z thomas $
|
5
5
|
#
|
6
6
|
# webgen: template based static website generator
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
@@ -20,6 +20,7 @@
|
|
20
20
|
#++
|
21
21
|
#
|
22
22
|
|
23
|
+
require 'uri'
|
23
24
|
require 'webgen/composite'
|
24
25
|
|
25
26
|
class Node
|
@@ -56,13 +57,25 @@ class Node
|
|
56
57
|
end
|
57
58
|
|
58
59
|
|
60
|
+
# Returns the relative path from this node to +dest+.
|
61
|
+
def relpath_to_string( dest )
|
62
|
+
if dest[0] == ?/
|
63
|
+
from = recursive_value( 'dest' ).sub( /#{self['dest']}$/, '' ).split( '/' )[1..-1] || []
|
64
|
+
from.fill( '..' )
|
65
|
+
from.concat( dest.split( '/' )[1..-1] ).join( '/' )
|
66
|
+
else
|
67
|
+
from = recursive_value( 'dest' ).sub( /#{self['dest']}$/, '' ).split( '/' )[1..-1] || []
|
68
|
+
from.concat( dest.split( '/' ) ).join( '/' )
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
59
72
|
# Return the relative path from this node to the destNode, virtual nodes are not used in the
|
60
73
|
# calculation. The destNode can be any non virtual node. If +destNode+ starts with http://, the
|
61
74
|
# relative path to it is the empty string. If +includeDestNode+ is true, then the path of the
|
62
75
|
# destination node is appended to the calculated path.
|
63
76
|
def relpath_to_node( destNode, includeDestNode = true)
|
64
|
-
if destNode['dest']
|
65
|
-
path = ''
|
77
|
+
if URI::parse( destNode['dest'] ).absolute?
|
78
|
+
path = destNode['dest']
|
66
79
|
else
|
67
80
|
from = recursive_value( 'dest' ).sub( /#{self['dest']}$/, '' ).split( '/' )[1..-1] || []
|
68
81
|
to = destNode.recursive_value( 'dest' ).sub( /#{destNode['dest']}$/, '' ).split( '/' )[1..-1] || []
|
@@ -126,6 +139,11 @@ class Node
|
|
126
139
|
node
|
127
140
|
end
|
128
141
|
|
142
|
+
# Returns an informative representation of the node.
|
143
|
+
def to_s
|
144
|
+
"<##{self.class.name}: src=#{@metainfo['src']}, dest=#{@metainfo['dest']}, title=#{@metainfo['title']}>"
|
145
|
+
end
|
146
|
+
|
129
147
|
#######
|
130
148
|
private
|
131
149
|
#######
|
@@ -135,17 +153,23 @@ class Node
|
|
135
153
|
node = Node.root( self )
|
136
154
|
destString = destString[1..-1]
|
137
155
|
else
|
138
|
-
node = self.parent_dir || self
|
156
|
+
node = @metainfo['int:directory?'] ? self : self.parent_dir || self
|
139
157
|
end
|
140
158
|
|
141
159
|
startElement = node
|
142
160
|
elements = destString.split( '/' )
|
161
|
+
pagelang = (/\.(\w\w)\.page$/ =~ destString ? $1 : Webgen::Plugin['Configuration']['lang'])
|
143
162
|
|
144
163
|
elements.each do |element|
|
145
164
|
break if node.nil?
|
146
165
|
case element
|
147
166
|
when '..' then node = node.parent
|
148
|
-
else
|
167
|
+
else
|
168
|
+
node = node.find do |child|
|
169
|
+
/^#{element}\/?$/ =~ child[metainfo] || \
|
170
|
+
(metainfo == 'dest' && (child['int:pagename'] == element || child['int:local-pagename'] == element) && \
|
171
|
+
child['lang'] == pagelang)
|
172
|
+
end
|
149
173
|
end
|
150
174
|
end
|
151
175
|
|
data/lib/webgen/plugin.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
3
|
#
|
4
|
-
# $Id: plugin.rb
|
4
|
+
# $Id: plugin.rb 293 2005-06-11 08:37:51Z thomas $
|
5
5
|
#
|
6
6
|
# webgen: template based static website generator
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
@@ -156,10 +156,6 @@ module Webgen
|
|
156
156
|
module_eval s
|
157
157
|
end
|
158
158
|
|
159
|
-
#######
|
160
|
-
private
|
161
|
-
#######
|
162
|
-
|
163
159
|
# Return the ancestor classes for the object's class which are sub classes from Plugin.
|
164
160
|
def self.ancestor_classes
|
165
161
|
self.ancestors.delete_if {|c| c.instance_of?( Module ) }[0..-3]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
3
|
#
|
4
|
-
# $Id: textile.rb
|
4
|
+
# $Id: textile.rb 288 2005-05-29 12:25:47Z thomas $
|
5
5
|
#
|
6
6
|
# webgen: template based static website generator
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
@@ -35,8 +35,8 @@ begin
|
|
35
35
|
|
36
36
|
def format_content( txt )
|
37
37
|
RedCloth.new( txt ).to_html
|
38
|
-
rescue
|
39
|
-
self.logger.error { "Error converting Textile text to HTML" }
|
38
|
+
rescue Exception => e
|
39
|
+
self.logger.error { "Error converting Textile text to HTML: #{e.message}" }
|
40
40
|
''
|
41
41
|
end
|
42
42
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
3
|
#
|
4
|
-
# $Id: backing.rb
|
4
|
+
# $Id: backing.rb 294 2005-06-14 06:37:56Z thomas $
|
5
5
|
#
|
6
6
|
# webgen: template based static website generator
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
@@ -74,8 +74,8 @@ module FileHandlers
|
|
74
74
|
|
75
75
|
backingFiles.each do |backingFile|
|
76
76
|
backingFile['content'].each do |filename, data|
|
77
|
-
|
78
|
-
|
77
|
+
backedFile = dirNode.node_for_string?( filename )
|
78
|
+
if backedFile
|
79
79
|
self.logger.info { "Setting meta info data on file <#{backedFile.recursive_value( 'dest' )}>" }
|
80
80
|
backedFile.metainfo.update( data )
|
81
81
|
else
|
@@ -84,7 +84,7 @@ module FileHandlers
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
dirNode.each {|child| process_backing_files( child ) if child['directory']}
|
87
|
+
dirNode.each {|child| process_backing_files( child ) if child['int:directory?']}
|
88
88
|
end
|
89
89
|
|
90
90
|
|
@@ -97,6 +97,7 @@ module FileHandlers
|
|
97
97
|
pageNode = Webgen::Plugin['VirtualPageHandler'].create_node_from_data( '', filename, dirNode )
|
98
98
|
dirNode.add_child( pageNode )
|
99
99
|
pageNode.metainfo.update( data )
|
100
|
+
pageNode['int:virtualNode'] = true
|
100
101
|
self.logger.info { "Created virtual node <#{pageNode.recursive_value( 'src' )}> (#{pageNode['lang']}) in <#{dirNode.recursive_value( 'dest' )}> " \
|
101
102
|
"referencing '#{pageNode['dest']}'" }
|
102
103
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
3
|
#
|
4
|
-
# $Id: directory.rb
|
4
|
+
# $Id: directory.rb 288 2005-05-29 12:25:47Z thomas $
|
5
5
|
#
|
6
6
|
# webgen: template based static website generator
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
@@ -44,7 +44,7 @@ module FileHandlers
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def process_dir_index
|
47
|
-
node =
|
47
|
+
node = node_for_string( Webgen::Plugin['DirHandler']['indexFile'] )
|
48
48
|
if node
|
49
49
|
self.logger.info { "Directory index file for <#{self.recursive_value( 'src' )}> => <#{node.recursive_value( 'src', false )}>" }
|
50
50
|
self['indexFile'] = node
|
@@ -59,7 +59,7 @@ module FileHandlers
|
|
59
59
|
|
60
60
|
summary "Handles directories"
|
61
61
|
handle_path '**/'
|
62
|
-
add_param 'indexFile', 'index.
|
62
|
+
add_param 'indexFile', 'index.page', 'The default file name for the directory index page file.'
|
63
63
|
depends_on 'FileHandler'
|
64
64
|
used_meta_info 'indexFile', 'directoryName'
|
65
65
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
3
|
#
|
4
|
-
# $Id: filehandler.rb
|
4
|
+
# $Id: filehandler.rb 293 2005-06-11 08:37:51Z thomas $
|
5
5
|
#
|
6
6
|
# webgen: template based static website generator
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
@@ -40,6 +40,7 @@ module FileHandlers
|
|
40
40
|
|
41
41
|
def initialize
|
42
42
|
add_msg_name( :AFTER_ALL_READ )
|
43
|
+
add_msg_name( :AFTER_ALL_WRITTEN )
|
43
44
|
end
|
44
45
|
|
45
46
|
# Builds the tree with all the nodes and returns it.
|
@@ -56,7 +57,7 @@ module FileHandlers
|
|
56
57
|
rootPath = Webgen::Plugin['Configuration']['srcDirectory'] + File::SEPARATOR
|
57
58
|
rootHandler = handler_for_path( rootPath, handlerFiles )
|
58
59
|
if rootHandler.nil? || allFiles.empty?
|
59
|
-
logger.error { "No file handler for root directory <#{rootPath}> found" } if rootHandler.nil?
|
60
|
+
logger.error { "No file handler for root directory <#{rootPath}> found" } if rootHandler.nil? && !allFiles.empty?
|
60
61
|
logger.error { "No files found in directory <#{rootPath}>" } if allFiles.empty?
|
61
62
|
return nil
|
62
63
|
end
|
@@ -90,6 +91,8 @@ module FileHandlers
|
|
90
91
|
node.each do |child|
|
91
92
|
write_tree( child )
|
92
93
|
end
|
94
|
+
|
95
|
+
dispatch_msg( :AFTER_ALL_WRITTEN ) if node.parent.nil?
|
93
96
|
end
|
94
97
|
|
95
98
|
|
@@ -153,7 +156,8 @@ module FileHandlers
|
|
153
156
|
end
|
154
157
|
|
155
158
|
def handler_for_path( path, handlerFiles )
|
156
|
-
handlerFiles.find {|p, handler| p.include?( path )}
|
159
|
+
temp, handler = handlerFiles.find {|p, handler| p.include?( path )}
|
160
|
+
handler
|
157
161
|
end
|
158
162
|
|
159
163
|
def sort_file_handlers( handlers )
|
@@ -209,7 +213,7 @@ module FileHandlers
|
|
209
213
|
# Returns a HTML link for the given +node+ relative to +refNode+. You can optionally specify the
|
210
214
|
# title for the link. If not specified, the title of the node is used.
|
211
215
|
def get_html_link( node, refNode, title = node['title'] )
|
212
|
-
"<a href=\"#{refNode.relpath_to_node( node )}\">#{title}</a>"
|
216
|
+
"<a href=\"#{refNode.relpath_to_node( node )}\" title=\"#{title}\">#{title}</a>"
|
213
217
|
end
|
214
218
|
|
215
219
|
end
|