webgen 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
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
data/README ADDED
@@ -0,0 +1,16 @@
1
+ webgen - a template based static website generator
2
+
3
+ Copyright (C) 2004 Thomas Leitner
4
+
5
+ >>> The documentation for webgen is in the doc/src subdirectory. <<<
6
+
7
+ You can build the documentation by
8
+ invoking
9
+ $ rake doc
10
+
11
+ in the root of the package or by running webgen manually in the +doc+ directory:
12
+ $ ruby -I../lib ../bin/webgen
13
+
14
+ This documentation is actually the same as the one on webgen.rubyforge.org. When releasing a new
15
+ version of webgen, I run one of the above commands to create the pages and then only copy it to the
16
+ website! :-)
data/Rakefile ADDED
@@ -0,0 +1,283 @@
1
+ # -*- ruby -*-
2
+ #
3
+ # $Id$
4
+ #
5
+ # webgen: template based static website generator
6
+ # Copyright (C) 2004 Thomas Leitner
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify it under the terms of the GNU
9
+ # General Public License as published by the Free Software Foundation; either version 2 of the
10
+ # License, or (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
13
+ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License along with this program; if not,
17
+ # write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ #
19
+
20
+
21
+ begin
22
+ require 'rubygems'
23
+ require 'rake/gempackagetask'
24
+ rescue Exception
25
+ end
26
+
27
+ require 'rake/clean'
28
+ require 'rake/packagetask'
29
+ require 'rake/rdoctask'
30
+ require 'rake/testtask'
31
+
32
+ # General actions ##############################################################
33
+
34
+ $:.push 'lib'
35
+ require 'webgen/configuration'
36
+
37
+ PKG_NAME = "webgen"
38
+ PKG_VERSION = Webgen::VERSION.join( '.' )
39
+ PKG_FULLNAME = PKG_NAME + "-" + PKG_VERSION
40
+ PKG_SUMMARY = Webgen::SUMMARY
41
+ PKG_DESCRIPTION = Webgen::DESCRIPTION
42
+
43
+ SRC_RB = FileList['lib/**/*.rb']
44
+
45
+ # The default task is run if rake is given no explicit arguments.
46
+
47
+ desc "Default Task"
48
+ task :default => :test
49
+
50
+
51
+ # End user tasks ################################################################
52
+
53
+ desc "Prepares for installation"
54
+ task :prepare do
55
+ ruby "setup.rb config"
56
+ ruby "setup.rb setup"
57
+ end
58
+
59
+
60
+ desc "Installs the package #{PKG_NAME}"
61
+ task :install => [:prepare] do
62
+ ruby "setup.rb install"
63
+ end
64
+
65
+
66
+ task :clean do
67
+ ruby "setup.rb clean"
68
+ end
69
+
70
+
71
+ CLOBBER << "doc/output"
72
+ desc "Builds the documentation"
73
+ task :doc => [:rdoc] do
74
+ chdir 'doc' do
75
+ puts "\nGenerating online documentation..."
76
+ ruby %{-I../lib ../bin/webgen -V 3 }
77
+ puts "\nValidating all generated documentation..."
78
+ sh 'find output/ -name "*.html" -exec xmllint --valid {} --catalogs --noout \;'
79
+ end
80
+ end
81
+
82
+ rd = Rake::RDocTask.new do |rdoc|
83
+ rdoc.rdoc_dir = 'doc/output/rdoc'
84
+ rdoc.title = PKG_NAME
85
+ rdoc.options << '--line-numbers' << '--inline-source' << '-m README'
86
+ rdoc.rdoc_files.include( 'README' )
87
+ rdoc.rdoc_files.include( 'lib/**/*.rb' )
88
+ end
89
+
90
+
91
+ task :test do |t|
92
+ ruby "-Ilib -Itest test/runtests.rb"
93
+ end
94
+
95
+ # Developer tasks ##############################################################
96
+
97
+
98
+ PKG_FILES = FileList.new( [
99
+ 'setup.rb',
100
+ 'TODO',
101
+ 'COPYING',
102
+ 'README',
103
+ 'Rakefile',
104
+ 'ChangeLog',
105
+ 'VERSION',
106
+ 'install.rb',
107
+ 'bin/**/*',
108
+ 'lib/**/*.rb',
109
+ 'testsite/**/*',
110
+ 'tests/**/*',
111
+ 'doc/**/*'
112
+ ]) do |fl|
113
+ fl.exclude( /\bsvn\b/ )
114
+ fl.exclude( 'testsite/output' )
115
+ fl.exclude( 'testsite/coverage' )
116
+ fl.exclude( 'doc/output' )
117
+ end
118
+
119
+ task :package => [:gen_files] do
120
+ chdir 'pkg' do
121
+ sh "rpaadmin packport #{PKG_NAME}-#{PKG_VERSION}"
122
+ end
123
+ end
124
+
125
+ task :gen_changelog do
126
+ sh "svn log -r HEAD:1 -v > ChangeLog"
127
+ end
128
+
129
+ task :gen_version do
130
+ puts "Generating VERSION file"
131
+ File.open( 'VERSION', 'w+' ) do |file| file.write( PKG_VERSION + "\n" ) end
132
+ end
133
+
134
+ task :gen_installrb do
135
+ puts "Generating install.rb file"
136
+ File.open( 'install.rb', 'w+' ) do |file|
137
+ file.write "
138
+ require 'rpa/install'
139
+
140
+ class Install_#{PKG_NAME} < RPA::Install::FullInstaller
141
+ name '#{PKG_NAME}'
142
+ version '#{PKG_VERSION}-1'
143
+ classification Application
144
+ build do
145
+ installdocs %w[COPYING ChangeLog TODO]
146
+ installdocs 'docs'
147
+ installrdoc %w[README] + Dir['lib/**/*.rb']
148
+ installdata
149
+ end
150
+ description <<-EOF
151
+ #{PKG_SUMMARY}
152
+
153
+ #{PKG_DESCRIPTION}
154
+ EOF
155
+ end
156
+ "
157
+ end
158
+ end
159
+
160
+ task :gen_files => [:gen_changelog, :gen_version, :gen_installrb]
161
+ CLOBBER << "ChangeLog" << "VERSION" << "install.rb"
162
+
163
+ Rake::PackageTask.new( PKG_NAME, PKG_VERSION ) do |p|
164
+ p.need_tar = true
165
+ p.need_zip = true
166
+ p.package_files = PKG_FILES
167
+ end
168
+
169
+ if !defined? Gem
170
+ puts "Package Target requires RubyGEMs"
171
+ else
172
+ spec = Gem::Specification.new do |s|
173
+
174
+ #### Basic information
175
+
176
+ s.name = PKG_NAME
177
+ s.version = PKG_VERSION
178
+ s.summary = PKG_SUMMARY
179
+ s.description = PKG_DESCRIPTION
180
+
181
+ #### Dependencies, requirements and files
182
+
183
+ s.files = PKG_FILES.to_a
184
+
185
+ s.require_path = 'lib'
186
+ s.autorequire = nil
187
+
188
+ s.executables = ['webgen']
189
+ s.default_executable = 'webgen'
190
+
191
+ #### Documentation
192
+
193
+ s.has_rdoc = true
194
+ s.extra_rdoc_files = rd.rdoc_files.reject do |fn| fn =~ /\.rb$/ end.to_a
195
+ s.rdoc_options = ['--line-numbers', '-m README']
196
+
197
+ #### Author and project details
198
+
199
+ s.author = "Thomas Leitner"
200
+ s.email = "t_leitner@gmx.at"
201
+ s.homepage = "webgen.rubyforge.org"
202
+ s.rubyforge_project = "webgen"
203
+ end
204
+
205
+ Rake::GemPackageTask.new( spec ) do |pkg|
206
+ pkg.need_zip = true
207
+ pkg.need_tar = true
208
+ end
209
+
210
+ end
211
+
212
+ =begin
213
+ desc "Creates a tag in the repository"
214
+ task :tag do
215
+ repositoryPath = File.dirname( $1 ) if `svn info` =~ /^URL: (.*)$/
216
+ fail "Tag already created in repository " if /#{PKG_NAME}/ =~ `svn ls #{repositoryPath}/versions`
217
+ sh "svn cp -m 'Created version #{PKG_NAME}' #{repositoryPath}/trunk #{repositoryPath}/versions/#{PKG_NAME}"
218
+ end
219
+ =end
220
+
221
+ desc "Upload documentation to homepage"
222
+ task :uploaddoc => [:doc] do
223
+ Dir.chdir('doc/output')
224
+ sh "scp -r * gettalong@rubyforge.org:/var/www/gforge-projects/#{PKG_NAME}/"
225
+ end
226
+
227
+
228
+ # Misc tasks ###################################################################
229
+
230
+
231
+ def count_lines( filename )
232
+ lines = 0
233
+ codelines = 0
234
+ open( filename ) do |f|
235
+ f.each do |line|
236
+ lines += 1
237
+ next if line =~ /^\s*$/
238
+ next if line =~ /^\s*#/
239
+ codelines += 1
240
+ end
241
+ end
242
+ [lines, codelines]
243
+ end
244
+
245
+
246
+ def show_line( msg, lines, loc )
247
+ printf "%6s %6s %s\n", lines.to_s, loc.to_s, msg
248
+ end
249
+
250
+
251
+ desc "Show statistics"
252
+ task :statistics do
253
+ total_lines = 0
254
+ total_code = 0
255
+ show_line( "File Name", "Lines", "LOC" )
256
+ SRC_RB.each do |fn|
257
+ lines, codelines = count_lines fn
258
+ show_line( fn, lines, codelines )
259
+ total_lines += lines
260
+ total_code += codelines
261
+ end
262
+ show_line( "Total", total_lines, total_code )
263
+ end
264
+
265
+
266
+ def run_testsite( arguments = '' )
267
+ Dir.chdir("testsite")
268
+ ruby %{-I../lib #{arguments} ../bin/webgen -V 3 }
269
+ end
270
+
271
+
272
+ CLOBBER << "testsite/output" << "testsite/webgen.log"
273
+ desc "Build the test site"
274
+ task :testsite do
275
+ run_testsite
276
+ end
277
+
278
+
279
+ CLOBBER << "testsite/coverage"
280
+ desc "Run the code coverage tool on the testsite"
281
+ task :coverage do
282
+ run_testsite '-rcoverage'
283
+ end
data/TODO ADDED
@@ -0,0 +1,133 @@
1
+ ---- CURRENT ----
2
+
3
+ * allow specification of metadata for gallery and picture pages
4
+ * allow a template to use another template (templates as page description files?) (template2 uses template1)
5
+ * ev. create a GalleryNode and put gallery/pictures pages beneath it???
6
+ * ordering of picture/gallery files for menu
7
+ * create webgen 0.2.0 to 0.3.0 converter
8
+ * security concerns (setting different $SAFE level???)
9
+ * register with Freshmeat.net
10
+ * use code generator to create test file with all tags and all tag parameter configurations
11
+ * check out http://jigsaw.w3.org/css-validator/check/referer
12
+
13
+ ---- DOCU ----
14
+
15
+ * pictureGallery: document layout methods (how to extend), main things...
16
+ * extend plugins section on main documentation page
17
+ * add design gallery
18
+ * DEV: self.logger.warn/error/info/debug can be used for messages
19
+
20
+ ---- FUTURE ----
21
+
22
+ * tag 'resume', uses xmlresume2x to provide HTML version of xml resume
23
+ * tag 'mrplot' -> generate a plot with mrplot
24
+ * tag 'sitemap' -> generate site map
25
+ * multi-lingual picture/gallery files
26
+ * create thumbnails of pictures on the fly with rmagick
27
+ * create logo "Created with webgen"
28
+ * refactor menu: abstract menu generator+parser, concrete impls (vert. menu, horz. menu, ...)
29
+
30
+ ---- DONE ----
31
+
32
+ W check if an xml validator is available in ruby* option for includeFile tag: escapeHTML (should special html tags be escaped?)
33
+ W think about sequence of actions when program is executed
34
+ W think about how the data is stored in tree/which data is stored in tree
35
+ W set up directory structure and build system
36
+ W write ideas and design considerations
37
+ W create sample files to work on
38
+ W change exception mechanism to use IDs for exceptions
39
+ W update all exceptions to new exception format
40
+ W implement hooks mechanism
41
+ W enable writing of tree again after hooks mechanism installed
42
+ W implement page templates using hooks (after dir read store reference to template file in hash)
43
+ W review Node class, remove all plugin dependent things
44
+ W review configuration class, remove all plugin dependent things
45
+ W check if ansi color output is better (for warnings, debug, etc), should be able to turn off
46
+ W restructure current files, make more readable
47
+ W pagePlugin.buildNode: srcName = File.basename(srcName) in front of urlName = ...
48
+ W pagePlugin.get_template_for_node: raise ... if node.nil?
49
+ W change the classes which use the listener/composite module because of the refactorization
50
+ W refactor current classes
51
+ W implement tag <relocatable> for references that should be relocatable
52
+ W FileCopyPlugin: check if file has changed and only then copy
53
+ W think about how to print out warnings uniformly --> log4r
54
+ W define format of config.yaml
55
+ W redo configuration file as yaml file
56
+ W meta tag replacer - replaces tag with contents of equally named node.metainfo entry
57
+ W add yaml page files
58
+ W add default values for configuration in configuration.rb
59
+ W create super class for page plugins
60
+ W implement "creation of files only when necessary" (i.e. if dependencies have changed)
61
+ use modification of source and target to check if source is newer -> changed
62
+ change the behaviour in file copy plugin
63
+ W think about configureable list of files patterns which should always be ignored when reading src dir
64
+ W replace current logging mechanism with Log4r
65
+ W implement <template> meta-info tag (see template based)
66
+ W redo tree transformer
67
+ W refacture menu tag plugin
68
+ W update default.css so that the page display correctly
69
+ N convert everything to utf8 before writing -> the file need to have the correct encoding
70
+ W better loggers for plugins (substitute real plugin name for "plugin")
71
+ N think about logging levels and when to use which level
72
+ W add multiple language support
73
+ W speed up menu creation by caching the created menu and only substituting the relative paths
74
+ W if a page in one language is in the menu, all other languages for this page should also be in the menu (-> de yaml project page, no selection in menu)
75
+ W link creation for nodes should be done only in one place (now in menu and navbar tags)
76
+ W navbar should be configurable (start tag, separator, end tag)
77
+ W command line parameter for listing all available configuration options with default values
78
+ W add check so that all needed metainfo tags are in read files
79
+ W eventually put TreeUtils methods into Node
80
+ W get_node_for_string should also work for absolute paths (ie. '/images' or '/projects/index.html')
81
+ W relocatable tag fails for "{relocatable: /images/bghack.png}" in index.xpage
82
+ W make get_relpath_to_node work for all nodes, not only page nodes
83
+ W implement meta info backing file for page file types without metainfo (e.g. html fragments)
84
+ W file name syntax: [0-9].name-with_blanks.[de].[EXTENSION] -> title: Name with blanks, Order: [0-9], Language: de
85
+ W implement order tag for setting menu order
86
+ W use rake, gem and setup.rb for installing and packaging
87
+ W prevent creation of log file if nothing is done (on -p, -e, --help...)
88
+ W put main and configuration class into the Webgen module
89
+ W use code coverage tool (-rcoverage) for checking the coverage on the testSite (use with rake)
90
+ W document existing files (RDOC)
91
+ W check out http://validator.w3.org/check/referer -> use xmllint from libxml2 package
92
+ W make file plugins case-insensitiv (convert all uppercase letters to lowercase)
93
+ W generate VERSION file when packaging
94
+ W list plugins by category instead of name (file handlers and tags should be grouped together)
95
+ W make get_node_for_string work with page files as parameters (reference in home.xpage to projects page)
96
+ W make get_node_for_string work with localized page names, i.e. /index.html/index.de.html to get the german version of the page
97
+ W add option to lang tag: showAlways -> display lang menu when only one item would appear?
98
+ W handle configuration options for tags uniformly (default configuration and per tag configuration)
99
+ W add option to menu tag: showOnlyThisSubtree -> displays only one tree to a deeper level
100
+ W redo TreeWalker -> tree should be walked separately for each registered plugin
101
+ W add virtual menu nodes for external html files
102
+ W add mechanism to document configuration parameters
103
+ W modify tag configuration so that mandatory/optional arguments for tags are supported
104
+ W add RedCloth and BlueCloth and RDOC page description files
105
+ W use File.basename(filename, '.*) to strip ext, File.extname(filename) to get ext
106
+ W add debug statements to method_added in configuration.rb
107
+ W do not allow two or more page files in the same language, print warn
108
+ * remove log4r support, add STDLIB logger support
109
+ * one file format, many content formats
110
+ * allow line breaks in tags (substitute: \n -> ' ', \n\n -> \n)
111
+ * configuration should be ruby file with special syntax, to allow the specification of additional tags --> additional config file
112
+ * create tags in config file which produce informational output about filehandlers and tags (param listing,...)
113
+ * include version number in documentation
114
+ * get_relpath_to_node: if destNode['external'] --> check for URL pattern
115
+ * add mandatory param info to output of 'describe'
116
+ * option for includeFile tag: escapeHTML (should special html tags be escaped?)
117
+ * more tags (in docu: how to use them, parameters, ..., structure should be the same everywhere)
118
+ * add facility to check output files on conformity to a HTML standard
119
+ * tag 'wikilink'
120
+ * file handler for 'picture gallery' files
121
+ * add optional extension method to Plugin class
122
+ * rename tag loader -> extension loader
123
+ * document extension loader and its config file
124
+ * document in file handler that :dir extension is used for directory handler
125
+ * options for PageHandler: default file format if none given
126
+ * state that if a dependency is not found (e.g. redcloth) the plugin is disabled and a warning issued
127
+ * add example section for each plugin
128
+ * add tests for all parameters with which webgen can be called
129
+ * Bug in analyse_filename if langpart.length != 2 (write test!) -> was already handled gracefully ;-)
130
+ * remove Plugin.plugin method -> use class name! (short class name, without modules, Test::Hallo.name.split(/::/).last )
131
+ * remove extension(...) call from file handlers -> DefaultHandler#initialize
132
+ * pagehandler + converter into own subdir
133
+ * think about filename conflicts for picture pages
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
data/bin/webgen ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'webgen/webgen'
4
+
5
+ Webgen::WebgenMain.new.main( ARGV )
@@ -0,0 +1,55 @@
1
+ # -*- ruby -*-
2
+
3
+ simple_tag( 'version' ) do |tag, node, refNode|
4
+ Webgen::VERSION.join( '.' )
5
+ end
6
+
7
+ class DescribeTag < Tags::DefaultTag
8
+
9
+ summary "Shows options for the specified file handler"
10
+ add_param 'plugin', nil, 'The plugin which should be described'
11
+ set_mandatory 'plugin', true
12
+
13
+ def initialize
14
+ super
15
+ @processOutput = false
16
+ end
17
+
18
+ def process_tag( tag, node, refNode )
19
+ filehandler = get_param( 'plugin' )
20
+ self.logger.debug { "Describing tag #{filehandler}" }
21
+ plugin = Webgen::Plugin.config.find {|k,v| v.plugin == filehandler }
22
+ self.logger.warn { "Could not describe plugin '#{filehandler}' as it does not exist" } if plugin.nil?
23
+ ( plugin.nil? ? '' : format_data( plugin[1] ) )
24
+ end
25
+
26
+ def format_data( data )
27
+ s = "<table>"
28
+ row = lambda {|desc, value| "<tr style='vertical-align: top'><td style='font-weight:bold'>#{desc}:</td><td>#{value}</td></tr>" }
29
+
30
+ [['Plugin Name', 'plugin'], ['Summary', 'summary'], ['Description', 'description']].each do |desc, name|
31
+ s += row[desc, data.send( name )] if eval( "data.#{name}" )
32
+ end
33
+
34
+ s += row['Dependencies', data.dependencies.join( ', ')] if data.dependencies
35
+
36
+ unless data.params.nil?
37
+ params = data.params.collect do |k,v|
38
+ "<span style='color: red'>#{v.name}</span>" + \
39
+ ( v.mandatory.nil? \
40
+ ? "&nbsp;=&nbsp;<span style='color: blue'>#{v.default.inspect}</span>" \
41
+ : " (=" + ( v.mandatoryDefault ? "default " : "" ) + "mandatory parameter)" ) + \
42
+ ": #{v.description}"
43
+ end
44
+ s += row['Parameters', params.join( "<br />\n" )]
45
+ end
46
+ s += row['Name of tag', (data.tag == :default ? "Default tag" : data.tag)] if data.tag
47
+ s += row['Extension', data.extension.inspect.gsub(/"/, '')] if data.extension
48
+
49
+ s += "</table>"
50
+ end
51
+
52
+ end
53
+
54
+ register_tag( 'describe', DescribeTag.new )
55
+