webgen 0.3.2 → 0.3.3
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 +224 -0
- data/Rakefile +2 -3
- data/TODO +18 -1
- data/VERSION +1 -1
- data/doc/plugin/clidesc.rb +35 -0
- data/doc/plugin/extension.rb +73 -0
- data/doc/src/about.page +2 -1
- data/doc/src/default.css +5 -1
- data/doc/src/default.template +9 -0
- data/doc/src/documentation/cli.page +12 -0
- data/doc/src/documentation/gettingstarted.page +150 -0
- data/doc/src/documentation/index.page +1 -19
- data/doc/src/documentation/{contenthandler → plugins/contenthandler}/html.page +0 -0
- data/doc/src/documentation/{contenthandler → plugins/contenthandler}/index.page +0 -0
- data/doc/src/documentation/{contenthandler → plugins/contenthandler}/markdown.page +0 -0
- data/doc/src/documentation/{contenthandler → plugins/contenthandler}/rdoc.page +0 -0
- data/doc/src/documentation/{contenthandler → plugins/contenthandler}/textile.page +0 -0
- data/doc/src/documentation/plugins/filehandler/backing.page +33 -0
- data/doc/src/documentation/{filehandler → plugins/filehandler}/copy.page +0 -0
- data/doc/src/documentation/{filehandler → plugins/filehandler}/directory.page +1 -2
- data/doc/src/documentation/{filehandler → plugins/filehandler}/galleryhandler.page +1 -1
- data/doc/src/documentation/{filehandler → plugins/filehandler}/index.page +0 -0
- data/doc/src/documentation/{filehandler → plugins/filehandler}/pagehandler.page +0 -0
- data/doc/src/documentation/{filehandler → plugins/filehandler}/template.page +0 -0
- data/doc/src/documentation/{gallerylayouter → plugins/gallerylayouter}/defaultlayouter.page +0 -0
- data/doc/src/documentation/{gallerylayouter → plugins/gallerylayouter}/index.page +0 -0
- data/doc/src/documentation/{htmlvalidator → plugins/htmlvalidator}/index.page +0 -0
- data/doc/src/documentation/{htmlvalidator → plugins/htmlvalidator}/xmllint.page +0 -0
- data/doc/src/documentation/plugins/index.page +20 -0
- data/doc/src/documentation/plugins/system/configuration.page +12 -0
- data/doc/src/documentation/plugins/system/index.page +7 -0
- data/doc/src/documentation/plugins/system/logging.page +13 -0
- data/doc/src/documentation/{tags → plugins/tags}/date.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/executecommand.page +0 -1
- data/doc/src/documentation/{tags → plugins/tags}/includefile.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/index.page +2 -2
- data/doc/src/documentation/{tags → plugins/tags}/langbar.de.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/langbar.page +1 -1
- data/doc/src/documentation/{tags → plugins/tags}/menu.de.page +1 -0
- data/doc/src/documentation/{tags → plugins/tags}/menu.page +1 -1
- data/doc/src/documentation/{tags → plugins/tags}/meta.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/multilang.de.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/multilang.fr.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/multilang.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/navbar.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/relocatable.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/sitemap.page +0 -0
- data/doc/src/documentation/{tags → plugins/tags}/wikilink.page +0 -0
- data/doc/src/download.page +1 -0
- data/doc/src/index.page +26 -8
- data/doc/src/meta.info +13 -18
- data/install.rb +1 -1
- data/lib/webgen/configuration.rb +6 -153
- data/lib/webgen/logging.rb +38 -10
- data/lib/webgen/node.rb +26 -6
- data/lib/webgen/plugin.rb +168 -0
- data/lib/webgen/plugins/filehandler/backing.rb +11 -56
- data/lib/webgen/plugins/filehandler/directory.rb +8 -8
- data/lib/webgen/plugins/filehandler/filecopy.rb +2 -2
- data/lib/webgen/plugins/filehandler/filehandler.rb +5 -9
- data/lib/webgen/plugins/filehandler/page.rb +40 -79
- data/lib/webgen/plugins/filehandler/picturegallery.rb +3 -3
- data/lib/webgen/plugins/filehandler/template.rb +2 -2
- data/lib/webgen/plugins/tags/langbar.rb +2 -2
- data/lib/webgen/plugins/tags/menu.rb +5 -13
- data/lib/webgen/plugins/tags/relocatable.rb +2 -2
- data/lib/webgen/plugins/tags/sitemap.rb +2 -2
- data/lib/webgen/plugins/tags/wikilink.rb +4 -3
- data/lib/webgen/webgen.rb +262 -57
- data/testsite/src/default.template +1 -1
- data/testsite/src/images/bghack.png +0 -0
- data/testsite/src/meta.info +7 -10
- metadata +65 -44
- data/doc/extension.config +0 -60
- data/doc/src/documentation/extloader.page +0 -20
- data/doc/src/documentation/filehandler/backing.page +0 -16
- data/lib/webgen/plugins/extloader.rb +0 -88
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: backing.rb
|
|
4
|
+
# $Id: backing.rb 256 2005-04-14 01:13:57Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -26,36 +26,7 @@ require 'webgen/plugins/filehandler/page'
|
|
|
26
26
|
|
|
27
27
|
module FileHandlers
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
# for other files. They are written in YAML and have a very easy structure:
|
|
31
|
-
#
|
|
32
|
-
# filename1.html:
|
|
33
|
-
# lang1:
|
|
34
|
-
# metainfo1: value1
|
|
35
|
-
# metainfo2: value2
|
|
36
|
-
# lang2:
|
|
37
|
-
# metainfo21: value21
|
|
38
|
-
#
|
|
39
|
-
# dir1/../dir1/filenam2.html:
|
|
40
|
-
# lang1:
|
|
41
|
-
# title: New titel by backing file
|
|
42
|
-
#
|
|
43
|
-
# /index.html:
|
|
44
|
-
# lang1:
|
|
45
|
-
# title: YES!!!
|
|
46
|
-
#
|
|
47
|
-
# As you can see, you can use relative and absoulte paths in the filenames. However, you cannot
|
|
48
|
-
# specify meta information for files which are in one of the parent directories of the backing
|
|
49
|
-
# file. These backing files are very useful if you are using page description files which do not
|
|
50
|
-
# support meta information, e.g. HTML fragment files.
|
|
51
|
-
#
|
|
52
|
-
# Using backing files you can add virtual files and directories. If the file specified in the
|
|
53
|
-
# entry does not exist, a virtual page node for that entry will be created. This will also create
|
|
54
|
-
# the whole directory tree this virtual node is in. This allows you, for example, to add external
|
|
55
|
-
# items to the menu. You need to specify the +dest+ meta information which points to the actual
|
|
56
|
-
# location of the referenced page. If the virtual page references an external page, you have to
|
|
57
|
-
# add the +external+ meta information (i.e. set +external+ to +true+).
|
|
58
|
-
class BackingFileHandler < DefaultHandler
|
|
29
|
+
class BackingFileHandler < DefaultFileHandler
|
|
59
30
|
|
|
60
31
|
summary "Handles backing files for page file"
|
|
61
32
|
extension 'info'
|
|
@@ -94,7 +65,7 @@ module FileHandlers
|
|
|
94
65
|
|
|
95
66
|
def valid_content( data )
|
|
96
67
|
data.kind_of?( Hash ) \
|
|
97
|
-
&& data.all? {|k,v| v.kind_of?( Hash )
|
|
68
|
+
&& data.all? {|k,v| v.kind_of?( Hash ) }
|
|
98
69
|
end
|
|
99
70
|
|
|
100
71
|
def process_backing_file( dirNode )
|
|
@@ -104,13 +75,8 @@ module FileHandlers
|
|
|
104
75
|
backingFile['content'].each do |filename, data|
|
|
105
76
|
if dirNode.node_for_string?( filename )
|
|
106
77
|
backedFile = dirNode.node_for_string( filename )
|
|
107
|
-
data.
|
|
108
|
-
|
|
109
|
-
next unless langFile['lang'] == language
|
|
110
|
-
|
|
111
|
-
self.logger.info { "Setting meta info data on file <#{langFile.recursive_value( 'dest' )}>" }
|
|
112
|
-
langFile.metainfo.update( fileData )
|
|
113
|
-
end
|
|
78
|
+
self.logger.info { "Setting meta info data on file <#{backedFile.recursive_value( 'dest' )}>" }
|
|
79
|
+
backedFile.metainfo.update( data )
|
|
114
80
|
else
|
|
115
81
|
add_virtual_node( dirNode, filename, data )
|
|
116
82
|
end
|
|
@@ -124,23 +90,12 @@ module FileHandlers
|
|
|
124
90
|
filename = File.basename( path )
|
|
125
91
|
dirNode = create_path( dirname, dirNode )
|
|
126
92
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
unless pageNode.nil?
|
|
134
|
-
pageNode['processor'] = Webgen::Plugin['VirtualPageHandler']
|
|
135
|
-
self.logger.debug { "Adding virtual page node <#{pageNode.recursive_value( 'src', false )}> to directory <#{dirNode.recursive_value( 'src' )}>" }
|
|
136
|
-
dirNode.add_child( pageNode )
|
|
137
|
-
end
|
|
138
|
-
pageNode ||= Webgen::Plugin['VirtualPageHandler'].get_page_node( filename, dirNode ) #TODO
|
|
139
|
-
node = Webgen::Plugin['VirtualPageHandler'].get_lang_node( pageNode, language )
|
|
140
|
-
node.metainfo.update( filedata )
|
|
141
|
-
self.logger.info { "Created virtual node <#{node.recursive_value( 'src' )}> (#{language}) in <#{dirNode.recursive_value( 'dest' )}> " \
|
|
142
|
-
"referencing '#{node['dest']}'" }
|
|
143
|
-
end
|
|
93
|
+
self.logger.debug { "Trying to create virtual node for '#{filename}'..." }
|
|
94
|
+
pageNode = Webgen::Plugin['VirtualPageHandler'].create_node_from_data( '', filename, dirNode )
|
|
95
|
+
dirNode.add_child( pageNode )
|
|
96
|
+
pageNode.metainfo.update( data )
|
|
97
|
+
self.logger.info { "Created virtual node <#{pageNode.recursive_value( 'src' )}> (#{pageNode['lang']}) in <#{dirNode.recursive_value( 'dest' )}> " \
|
|
98
|
+
"referencing '#{pageNode['dest']}'" }
|
|
144
99
|
end
|
|
145
100
|
|
|
146
101
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: directory.rb
|
|
4
|
+
# $Id: directory.rb 256 2005-04-14 01:13:57Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -25,7 +25,7 @@ require 'webgen/plugins/filehandler/filehandler'
|
|
|
25
25
|
module FileHandlers
|
|
26
26
|
|
|
27
27
|
# Handles directories.
|
|
28
|
-
class DirHandler <
|
|
28
|
+
class DirHandler < DefaultFileHandler
|
|
29
29
|
|
|
30
30
|
# Specialized node describing a directory.
|
|
31
31
|
class DirNode < Node
|
|
@@ -43,7 +43,7 @@ module FileHandlers
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def process_dir_index
|
|
46
|
-
node = Webgen::Plugin['PageHandler'].
|
|
46
|
+
node = Webgen::Plugin['PageHandler'].get_page_node_by_name( self, Webgen::Plugin['DirHandler']['indexFile'] )
|
|
47
47
|
if node
|
|
48
48
|
self.logger.info { "Directory index file for <#{self.recursive_value( 'src' )}> => <#{node.recursive_value( 'src', false )}>" }
|
|
49
49
|
self['indexFile'] = node
|
|
@@ -58,7 +58,7 @@ module FileHandlers
|
|
|
58
58
|
|
|
59
59
|
summary "Handles directories"
|
|
60
60
|
extension :dir
|
|
61
|
-
add_param 'indexFile', 'index.
|
|
61
|
+
add_param 'indexFile', 'index.html', 'The default file name for the directory index file.'
|
|
62
62
|
depends_on 'FileHandler'
|
|
63
63
|
|
|
64
64
|
|
|
@@ -76,12 +76,12 @@ module FileHandlers
|
|
|
76
76
|
FileUtils.makedirs( name ) unless File.exists?( name )
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
# Return the
|
|
79
|
+
# Return the page node for the directory +node+ using the specified language +lang+. If an
|
|
80
80
|
# index file is specified, then the its correct language node is returned, else +node+ is
|
|
81
81
|
# returned.
|
|
82
|
-
def
|
|
82
|
+
def get_page_node_for_lang( node, lang )
|
|
83
83
|
if node['indexFile']
|
|
84
|
-
node['indexFile']['processor'].
|
|
84
|
+
node['indexFile']['processor'].get_page_node_for_lang( node['indexFile'], lang )
|
|
85
85
|
else
|
|
86
86
|
node
|
|
87
87
|
end
|
|
@@ -89,7 +89,7 @@ module FileHandlers
|
|
|
89
89
|
|
|
90
90
|
# Get the HTML link for the directory +node+.
|
|
91
91
|
def get_html_link( node, refNode, title = nil )
|
|
92
|
-
lang_node =
|
|
92
|
+
lang_node = get_page_node_for_lang( node, refNode['lang'] )
|
|
93
93
|
title ||= lang_node['directoryName'] || node['directoryName']
|
|
94
94
|
super( lang_node, refNode, title )
|
|
95
95
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: filecopy.rb
|
|
4
|
+
# $Id: filecopy.rb 249 2005-04-13 19:23:51Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -27,7 +27,7 @@ module FileHandlers
|
|
|
27
27
|
|
|
28
28
|
# A simple file handler which copies files with a specific extension from the source to the output
|
|
29
29
|
# directory. The extensions of the files to copy are customizable.
|
|
30
|
-
class FileCopyHandler <
|
|
30
|
+
class FileCopyHandler < DefaultFileHandler
|
|
31
31
|
|
|
32
32
|
summary "Copies files from source to destination without modification"
|
|
33
33
|
add_param 'types', ['css', 'jpg', 'png', 'gif'], \
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: filehandler.rb
|
|
4
|
+
# $Id: filehandler.rb 256 2005-04-14 01:13:57Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -156,7 +156,7 @@ module FileHandlers
|
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
# The default handler which is the super class of all file handlers.
|
|
159
|
-
class
|
|
159
|
+
class DefaultFileHandler < Webgen::Plugin
|
|
160
160
|
|
|
161
161
|
VIRTUAL = true
|
|
162
162
|
|
|
@@ -166,6 +166,9 @@ module FileHandlers
|
|
|
166
166
|
extension( Webgen::Plugin.config[self.class].extension ) if Webgen::Plugin.config[self.class].extension
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
+
# Specify the extension which should be handled by the class.
|
|
170
|
+
def self.extension( ext ); @@config[self].extension = ext; end
|
|
171
|
+
|
|
169
172
|
# Register the file extension specified by a subclass.
|
|
170
173
|
def extension( ext )
|
|
171
174
|
self.logger.info { "Registering file handler #{self.class.name} (#{self.object_id}) with extension '#{ext}'" }
|
|
@@ -187,13 +190,6 @@ module FileHandlers
|
|
|
187
190
|
raise "Not implemented"
|
|
188
191
|
end
|
|
189
192
|
|
|
190
|
-
# Returns the language node for the given +node+. The default implementation returns the node
|
|
191
|
-
# itself. You can optionally specify the language of the node which should be returned. If not
|
|
192
|
-
# specified the language of the node is used.
|
|
193
|
-
def get_lang_node( node, lang = node['lang'] )
|
|
194
|
-
node
|
|
195
|
-
end
|
|
196
|
-
|
|
197
193
|
# Returns a HTML link for the given +node+ relative to +refNode+. You can optionally specify the
|
|
198
194
|
# title for the link. If not specified, the title of the node is used.
|
|
199
195
|
def get_html_link( node, refNode, title = node['title'] )
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: page.rb
|
|
4
|
+
# $Id: page.rb 256 2005-04-14 01:13:57Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -27,21 +27,9 @@ module FileHandlers
|
|
|
27
27
|
|
|
28
28
|
# Super class for all page description files. Provides helper methods so that writing new plugins
|
|
29
29
|
# for page description files is easy.
|
|
30
|
-
class PageHandler <
|
|
31
|
-
|
|
32
|
-
# Specialized node describing a page. A page node itself is virtual, it has sub nodes which
|
|
33
|
-
# describe the page files in all available languages.
|
|
34
|
-
class PageNode < Node
|
|
35
|
-
|
|
36
|
-
def initialize( parent, basename )
|
|
37
|
-
super( parent )
|
|
38
|
-
self['page:basename'] = self['title'] = basename
|
|
39
|
-
self['src'] = self['dest'] = basename
|
|
40
|
-
self['virtual'] = true
|
|
41
|
-
self['processor'] = Webgen::Plugin['PageHandler']
|
|
42
|
-
end
|
|
30
|
+
class PageHandler < DefaultFileHandler
|
|
43
31
|
|
|
44
|
-
end
|
|
32
|
+
class PageNode < Node; end;
|
|
45
33
|
|
|
46
34
|
summary "Class for processing page files"
|
|
47
35
|
extension 'page'
|
|
@@ -65,7 +53,6 @@ module FileHandlers
|
|
|
65
53
|
|
|
66
54
|
def write_node( node )
|
|
67
55
|
# do nothing if page base node
|
|
68
|
-
return unless node['virtual'].nil?
|
|
69
56
|
templateNode = Webgen::Plugin['TemplateFileHandler'].get_template_for_node( node )
|
|
70
57
|
|
|
71
58
|
outstring = templateNode['content'].dup
|
|
@@ -82,28 +69,26 @@ module FileHandlers
|
|
|
82
69
|
end
|
|
83
70
|
end
|
|
84
71
|
|
|
85
|
-
def
|
|
86
|
-
dirNode.find {|node| node['page:
|
|
72
|
+
def get_page_node_by_name( dirNode, name )
|
|
73
|
+
dirNode.find {|node| node['page:name'] == name}
|
|
87
74
|
end
|
|
88
|
-
alias :get_page_node :page_node_exists?
|
|
89
75
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"using first available input file for <#{node['title']}>"
|
|
76
|
+
# Returns the page node for the given language. +node+ has to be a page node!
|
|
77
|
+
def get_page_node_for_lang( node, lang )
|
|
78
|
+
dirNode = node.parent
|
|
79
|
+
pageNode = dirNode.find {|child| child['page:name'] == node['page:name'] && child['lang'] == lang}
|
|
80
|
+
if pageNode.nil?
|
|
81
|
+
self.logger.info { "No page node in language '#{lang}' for page '#{node['title']}' found, trying default language" }
|
|
82
|
+
pageNode = dirNode.find {|child| child['page:name'] == node['page:name'] && child['lang'] == Webgen::Plugin['Configuration']['lang']}
|
|
83
|
+
if pageNode.nil?
|
|
84
|
+
self.logger.warn do
|
|
85
|
+
"No page node in default language (#{Webgen::Plugin['Configuration']['lang']}) " + \
|
|
86
|
+
"for page '#{node['title']}' found, using supplied page node"
|
|
87
|
+
end
|
|
88
|
+
pageNode = node
|
|
104
89
|
end
|
|
105
90
|
end
|
|
106
|
-
|
|
91
|
+
pageNode
|
|
107
92
|
end
|
|
108
93
|
|
|
109
94
|
#######
|
|
@@ -111,32 +96,26 @@ module FileHandlers
|
|
|
111
96
|
#######
|
|
112
97
|
|
|
113
98
|
def create_node_internally( data, analysed, parent )
|
|
114
|
-
pageNodeExisted = get_page_node( analysed.baseName, parent )
|
|
115
|
-
pageNode = pageNodeExisted || PageNode.new( parent, analysed.baseName )
|
|
116
|
-
|
|
117
99
|
lang = data['lang'] || analysed.lang
|
|
118
100
|
|
|
119
|
-
if
|
|
120
|
-
pageNodeExisted = false
|
|
101
|
+
if node = parent.find {|node| node['page:commonName'] == analysed.name && node['lang'] == lang }
|
|
121
102
|
logger.warn do
|
|
122
103
|
"Two input files in the same language for one page, " + \
|
|
123
|
-
"using <#{
|
|
124
|
-
"instead of <#{analysed.srcName}>"
|
|
104
|
+
"using <#{node.recursive_value( 'src' )}> instead of <#{analysed.srcName}>"
|
|
125
105
|
end
|
|
126
106
|
else
|
|
127
|
-
node =
|
|
107
|
+
node = PageNode.new( parent )
|
|
128
108
|
node.metainfo = data
|
|
129
|
-
node['node:isLangNode'] = true
|
|
130
109
|
node['lang'] ||= analysed.lang
|
|
131
110
|
node['title'] ||= analysed.title
|
|
132
111
|
node['menuOrder'] ||= analysed.menuOrder
|
|
133
112
|
node['src'] = analysed.srcName
|
|
134
|
-
node['dest'] = create_output_name( analysed, node
|
|
113
|
+
node['dest'] = create_output_name( analysed, node['outputNameStyle'] || get_param( 'outputNameStyle' ) )
|
|
114
|
+
node['page:name'] = create_output_name( analysed, node['outputNameStyle'] || get_param( 'outputNameStyle' ), true )
|
|
135
115
|
node['processor'] = self
|
|
136
|
-
pageNode.add_child( node )
|
|
137
116
|
end
|
|
138
117
|
|
|
139
|
-
return
|
|
118
|
+
return node
|
|
140
119
|
end
|
|
141
120
|
|
|
142
121
|
def parse_data( data, srcName )
|
|
@@ -170,7 +149,6 @@ module FileHandlers
|
|
|
170
149
|
|
|
171
150
|
self.logger.info { "Using default language for file <#{srcName}>" } if matchData[3].nil?
|
|
172
151
|
analysed.lang = matchData[3] || Webgen::Plugin['Configuration']['lang']
|
|
173
|
-
analysed.baseName = matchData[2] + '.page'
|
|
174
152
|
analysed.srcName = srcName
|
|
175
153
|
analysed.useLangPart = ( !get_param( 'defaultLangInFilename' ) && Webgen::Plugin['Configuration']['lang'] == analysed.lang ? false : true )
|
|
176
154
|
analysed.name = matchData[2]
|
|
@@ -182,38 +160,21 @@ module FileHandlers
|
|
|
182
160
|
analysed
|
|
183
161
|
end
|
|
184
162
|
|
|
185
|
-
def create_output_name( analysed, data )
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
end.join( '' )
|
|
201
|
-
end
|
|
202
|
-
process_array( data['outputNameStyle'] || get_param( 'outputNameStyle' ), analysed )
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
module HTMLValidators
|
|
210
|
-
|
|
211
|
-
class HTMLValidator < Webgen::Plugin
|
|
212
|
-
|
|
213
|
-
summary "Base class for all HTML validators"
|
|
214
|
-
|
|
215
|
-
# Should be overridden in subclass!
|
|
216
|
-
def validate_file( filename )
|
|
163
|
+
def create_output_name( analysed, data, omitLangPart = false )
|
|
164
|
+
data.collect do |part|
|
|
165
|
+
case part
|
|
166
|
+
when String
|
|
167
|
+
part
|
|
168
|
+
when :name
|
|
169
|
+
analysed.name
|
|
170
|
+
when :lang
|
|
171
|
+
analysed.useLangPart && !omitLangPart ? analysed.lang : ''
|
|
172
|
+
when Array
|
|
173
|
+
part.include?( :lang ) && (!analysed.useLangPart || omitLangPart) ? '' : create_output_name( analysed, part, omitLangPart )
|
|
174
|
+
else
|
|
175
|
+
''
|
|
176
|
+
end
|
|
177
|
+
end.join( '' )
|
|
217
178
|
end
|
|
218
179
|
|
|
219
180
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: picturegallery.rb
|
|
4
|
+
# $Id: picturegallery.rb 249 2005-04-13 19:23:51Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -26,7 +26,7 @@ require 'webgen/plugins/filehandler/page'
|
|
|
26
26
|
|
|
27
27
|
module FileHandlers
|
|
28
28
|
|
|
29
|
-
class PictureGalleryFileHandler <
|
|
29
|
+
class PictureGalleryFileHandler < DefaultFileHandler
|
|
30
30
|
|
|
31
31
|
summary "Handles picture gallery files for page file"
|
|
32
32
|
extension 'gallery'
|
|
@@ -182,7 +182,7 @@ module FileHandlers
|
|
|
182
182
|
|
|
183
183
|
end
|
|
184
184
|
|
|
185
|
-
class ThumbnailWriter <
|
|
185
|
+
class ThumbnailWriter < DefaultFileHandler
|
|
186
186
|
|
|
187
187
|
summary "Writes out thumbnails with RMagick"
|
|
188
188
|
add_param "thumbnailSize", "100x100", "The size of the thumbnails"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: template.rb
|
|
4
|
+
# $Id: template.rb 249 2005-04-13 19:23:51Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -25,7 +25,7 @@ require 'webgen/plugins/filehandler/filehandler'
|
|
|
25
25
|
module FileHandlers
|
|
26
26
|
|
|
27
27
|
# Handles template files. Template files are generic files which specify the layout.
|
|
28
|
-
class TemplateFileHandler <
|
|
28
|
+
class TemplateFileHandler < DefaultFileHandler
|
|
29
29
|
|
|
30
30
|
summary "Represents the template files for the page generation in the tree"
|
|
31
31
|
extension 'template'
|