webgen 0.5.9 → 0.5.10

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 CHANGED
@@ -1,3 +1,151 @@
1
+ commit d69d12ea3a034a33c2d176d315fed2bb1340319d
2
+ Author: Thomas Leitner <t_leitner@gmx.at>
3
+ Date: Mon Aug 10 08:54:33 2009 +0200
4
+
5
+ Updated github gemspec
6
+
7
+ webgen.gemspec
8
+
9
+ commit 72d67580c5f06c24ceb0802865b792868f7266ed
10
+ Author: Thomas Leitner <t_leitner@gmx.at>
11
+ Date: Mon Aug 10 08:52:48 2009 +0200
12
+
13
+ Updated website for release
14
+
15
+ website/src/index.page
16
+ website/src/news/index.page
17
+ website/src/news/release_0_5_10.page
18
+
19
+ commit aeb18e6cd648a5c16aff26bc2b75f04dc3430d4c
20
+ Author: Thomas Leitner <t_leitner@gmx.at>
21
+ Date: Mon Aug 10 08:28:03 2009 +0200
22
+
23
+ Fixed docu problem
24
+
25
+ doc/manual.page
26
+
27
+ commit 98907d04b5283ca50fe7b761338d3d132bcf2436
28
+ Author: Thomas Leitner <t_leitner@gmx.at>
29
+ Date: Mon Aug 10 08:27:35 2009 +0200
30
+
31
+ Fixed a small issue introduced with one of the latest commits
32
+
33
+ lib/webgen/sourcehandler.rb
34
+
35
+ commit 340cef9a1ea50cb2fe19d0ae86e926b71dd5aad6
36
+ Author: Thomas Leitner <t_leitner@gmx.at>
37
+ Date: Mon Aug 10 08:26:50 2009 +0200
38
+
39
+ Fixed two issues regarding paths
40
+
41
+ * Path.make_absolute now retains the trailing slash of the given path
42
+ * Path.match now works when the given path is either a String or a Path object
43
+
44
+ lib/webgen/path.rb
45
+ test/test_path.rb
46
+ test/test_sourcehandler_metainfo.rb
47
+
48
+ commit f36ecb333e015fe2c773f7b5bf40665d3c965e23
49
+ Author: Thomas Leitner <t_leitner@gmx.at>
50
+ Date: Sat Aug 8 08:23:05 2009 +0200
51
+
52
+ Fixed problem with handling paths of the form NUMBER.REST
53
+
54
+ doc/manual.page
55
+ lib/webgen/path.rb
56
+ test/test_path.rb
57
+ website/src/news/release_0_5_10.page
58
+
59
+ commit 58fdc5fc6657a0be95e6d102a32954a55987e8a8
60
+ Author: Thomas Leitner <t_leitner@gmx.at>
61
+ Date: Sat Aug 8 07:59:12 2009 +0200
62
+
63
+ Fixed bug RF#26890: detecting unused paths did not always work correctly
64
+
65
+ lib/webgen/sourcehandler.rb
66
+ website/src/news/release_0_5_10.page
67
+
68
+ commit f86b07c252a366a46b443f3ef43a8c9d30ae8e5f
69
+ Author: Thomas Leitner <t_leitner@gmx.at>
70
+ Date: Fri Aug 7 08:00:20 2009 +0200
71
+
72
+ Fixed bug in Path: path with dot in extension and without language part were not handled correctly
73
+
74
+ lib/webgen/path.rb
75
+ test/test_path.rb
76
+ website/src/news/release_0_5_10.page
77
+
78
+ commit 95bdc3ca532f5ac8f64f6fb868b9f3a0b8dd7a7b
79
+ Author: Thomas Leitner <t_leitner@gmx.at>
80
+ Date: Thu Aug 6 10:50:25 2009 +0200
81
+
82
+ Fixed bug: matching of directory nodes did not work correctly
83
+
84
+ Matching of paths and nodes now work the same
85
+
86
+ lib/webgen/node.rb
87
+ lib/webgen/path.rb
88
+ test/test_path.rb
89
+ website/src/news/release_0_5_10.page
90
+
91
+ commit b7a12a504a798d8451192eb9b5d4be0112145e73
92
+ Author: Thomas Leitner <t_leitner@gmx.at>
93
+ Date: Wed Aug 5 08:04:10 2009 +0200
94
+
95
+ Fixed problem with webgui that was introduced with 0.5.9
96
+
97
+ data/webgen/webgui/controller/main.rb
98
+ website/src/news/release_0_5_10.page
99
+
100
+ commit 3689ad96270efcd4999e78469c62399f5657b3ea
101
+ Author: Thomas Leitner <t_leitner@gmx.at>
102
+ Date: Wed Aug 5 07:57:49 2009 +0200
103
+
104
+ Adjusting templates to use xmllint
105
+
106
+ misc/default.template
107
+ website/src/default.template
108
+
109
+ commit d6eac08d6283dfe5c93ec216dbc89bc523d79b1a
110
+ Author: Thomas Leitner <t_leitner@gmx.at>
111
+ Date: Wed Aug 5 07:57:27 2009 +0200
112
+
113
+ Implemented content processor xmllint for checking validness of XHTML files
114
+
115
+ doc/contentprocessor/xmllint.page
116
+ doc/reference_configuration.page
117
+ lib/webgen/contentprocessor.rb
118
+ lib/webgen/contentprocessor/xmllint.rb
119
+ lib/webgen/default_config.rb
120
+ test/test_contentprocessor_xmllint.rb
121
+ website/src/news/release_0_5_10.page
122
+
123
+ commit bcc62991c0adee88f8aa81a95585614eb83bae32
124
+ Author: Thomas Leitner <t_leitner@gmx.at>
125
+ Date: Wed Aug 5 07:19:55 2009 +0200
126
+
127
+ Fixed problem with invalid HTML
128
+
129
+ doc/sourcehandler.template
130
+ website/src/news/default.template
131
+
132
+ commit b25befaa084c40ca26ba7763fc2d6ceeb985c517
133
+ Author: Thomas Leitner <t_leitner@gmx.at>
134
+ Date: Wed Aug 5 07:19:20 2009 +0200
135
+
136
+ Fixed bug in Tag::TikZ: attribute alt was no set on image
137
+
138
+ lib/webgen/tag/tikz.rb
139
+ test/test_tag_tikz.rb
140
+
141
+ commit 05edaf062020b425c8bccb530df01f44a7d84dda
142
+ Author: Thomas Leitner <t_leitner@gmx.at>
143
+ Date: Tue Aug 4 16:24:32 2009 +0200
144
+
145
+ Bumped version to 0.5.10
146
+
147
+ lib/webgen/version.rb
148
+
1
149
  commit 098b647dc9c6e4d534b98c6f3d12b319365bded9
2
150
  Author: Thomas Leitner <t_leitner@gmx.at>
3
151
  Date: Sat Jul 25 07:45:26 2009 +0200
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.9
1
+ 0.5.10
@@ -104,8 +104,8 @@ class MainController < Ramaze::Controller
104
104
  if !@cur_bundle.nil?
105
105
  ws = Webgen::Website.new('unknown', nil) do |config|
106
106
  config['sources'] = [
107
- ['/', 'Webgen::Source::Resource', 'webgen-website-bundle-default', '/src/**', '/src'],
108
- ['/', 'Webgen::Source::Resource', 'webgen-website-bundle-' + @cur_bundle, '/src/**', '/src']
107
+ ['/', 'Webgen::Source::Resource', 'webgen-website-bundle-default', '/src/**', '/src/'],
108
+ ['/', 'Webgen::Source::Resource', 'webgen-website-bundle-' + @cur_bundle, '/src/**', '/src/']
109
109
  ]
110
110
  config['output'] = ['MemoryOutput']
111
111
  config['website.cache'] = [:memory, '']
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Webgen::ContentProcessor::Xmllint
3
+ ---
4
+ ## Description
5
+
6
+ This content processor uses the `xmllint` program from the ["libxml2" package][1] to check the input
7
+ for well-formedness and/or validness. `xmllint` can validate an XML (and therefore an XHTML) file
8
+ against a DTD, a RelaxNG schema or a WXS schema. For more information about where to put the DTD or
9
+ schema files, have a look at the `libxml2` documentation.
10
+
11
+ The configuration option `contentprocessor.xmllint.options` can be used to change the default
12
+ command line options that are used for the `xmllint` program.
13
+
14
+ [1]: http://www.xmlsoft.org
@@ -267,6 +267,10 @@ depending on the type of path (the individual parts of a path are explained belo
267
267
 
268
268
  /parent_path/[sort_info.]basename[.lang][.extension]
269
269
 
270
+ There is one special case: if the file path has only one dot and only numbers are before the
271
+ dot, then the first part is considered to be the basename and the second part the extension (eg.
272
+ `53.png`)!
273
+
270
274
  * The path specifies a fragment (e.g. part of a file). It must contain exactly one hash character
271
275
  and it has to follow the scheme (where `/parent_path` needs to be a file path):
272
276
 
@@ -329,6 +333,7 @@ Following are some examples of source path names (the acn and alcn parts are exp
329
333
  | `/image.png` | image | -none- | Image | 0 | `/image.png` | `/image.png` |
330
334
  | `/image.de.png` | image | de | Image | 0 | `/image.png` | `/image.de.png` |
331
335
  | `/01.name_of-file.eo.page` | name_of-file | eo | Name of file | 1 | `/name_of-file.page` | `/name_of-file.eo.page` |
336
+ | `/53.png` | 53 | -none- | 53 | 0 | `/53.png` | `/53.png` |
332
337
  | `/archive.tar.bz2` | archive | -none- | Archive | 0 | `/archive.tar.bz2` | `/archive.tar.bz2` |
333
338
  | `/archive.de.tar.bz2` | archive | de | Archive | 0 | `/archive.tar.bz2` | `/archive.de.tar.bz2` |
334
339
  | `/manual.html#sources` | manual | -none- | Manual | -none- | `/manual.html#sources` | `/manual.html#sources` |
@@ -459,6 +459,21 @@ configuration options) and/or how to use it in a webgen tag (for tag configurati
459
459
  contentprocessor.tidy.options: "-utf8"
460
460
 
461
461
 
462
+ * ### contentprocessor.xmllint.options
463
+
464
+ This configuration option can be used to set the command line options for the `xmllint` program
465
+ which is used by the [content processor `xmllint`]({relocatable: contentprocessor/xmllint.html}).
466
+
467
+ * Syntax: `STRING` where `STRING` is the string holding the command line options.
468
+
469
+ <%= show_default['contentprocessor.xmllint.options'] %>
470
+
471
+ * Example for setting the option in the configuration file:
472
+
473
+ contentprocessor.xmllint.options: "--catalogs --noout"
474
+
475
+
476
+
462
477
  ## Tag Specific Options
463
478
 
464
479
  These options are not normally set in the configuration file but given directly as options to the
@@ -13,9 +13,11 @@ meta_info = context.website.config['sourcehandler.default_meta_info'][context.co
13
13
  if meta_info
14
14
  %>
15
15
  Following is the default meta information set on any node created by this source handler:
16
+
16
17
  <pre>
17
18
  <%= meta_info.to_yaml.gsub(/^---/, '').strip %>
18
19
  </pre>
19
20
  <% end %>
21
+
20
22
  --- name:content
21
23
  <webgen:block name='content' />
@@ -76,6 +76,7 @@ module Webgen
76
76
  autoload :Fragments, 'webgen/contentprocessor/fragments'
77
77
  autoload :Head, 'webgen/contentprocessor/head'
78
78
  autoload :Tidy, 'webgen/contentprocessor/tidy'
79
+ autoload :Xmllint, 'webgen/contentprocessor/xmllint'
79
80
 
80
81
  # Return the list of all available content processors.
81
82
  def self.list
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'tempfile'
3
+
4
+ module Webgen::ContentProcessor
5
+
6
+ # Uses the external +xmllint+ program to check if the content is valid (X)HTML.
7
+ class Xmllint
8
+
9
+ include Webgen::Loggable
10
+
11
+ # Checks the content of +context+ with the +xmllint+ program for validness.
12
+ def call(context)
13
+ error_file = Tempfile.new('webgen-xmllint')
14
+ error_file.close
15
+
16
+ `xmllint --version 2>&1`
17
+ if $?.exitstatus != 0
18
+ raise Webgen::CommandNotFoundError.new('xmllint', self.class.name, context.dest_node.alcn)
19
+ end
20
+
21
+ cmd = "xmllint #{context.website.config['contentprocessor.xmllint.options']} - 2>'#{error_file.path}'"
22
+ result = IO.popen(cmd, 'r+') do |io|
23
+ io.write(context.content)
24
+ io.close_write
25
+ io.read
26
+ end
27
+ if $?.exitstatus != 0
28
+ File.read(error_file.path).scan(/^-:(\d+):(.*?\n)(.*?\n)/).each do |line, error_msg, line_context|
29
+ log(:warn) { "xmllint reported problems for <#{context.dest_node.alcn}:~#{line}>: #{error_msg.strip} (context: #{line_context.strip})" }
30
+ end
31
+ end
32
+ context
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -140,7 +140,8 @@ config.contentprocessor.map({
140
140
  'rdiscount' => 'Webgen::ContentProcessor::RDiscount',
141
141
  'fragments' => 'Webgen::ContentProcessor::Fragments',
142
142
  'head' => 'Webgen::ContentProcessor::Head',
143
- 'tidy' => 'Webgen::ContentProcessor::Tidy'
143
+ 'tidy' => 'Webgen::ContentProcessor::Tidy',
144
+ 'xmllint' => 'Webgen::ContentProcessor::Xmllint'
144
145
  }, :doc => 'Content processor name to class map')
145
146
 
146
147
  Webgen::WebsiteAccess.website.blackboard.add_service(:content_processor_names, Webgen::ContentProcessor.method(:list))
@@ -171,6 +172,8 @@ config.contentprocessor.redcloth.hard_breaks(false, :doc => 'Specifies whether n
171
172
 
172
173
  config.contentprocessor.tidy.options("-raw", :doc => "The options passed to the tidy command")
173
174
 
175
+ config.contentprocessor.xmllint.options("--catalogs --noout --valid", :doc => 'Options passed to the xmllint command')
176
+
174
177
  config.tag.relocatable.path(nil, :doc => 'The path which should be made relocatable', :mandatory => 'default')
175
178
 
176
179
  config.tag.menu.start_level(1, :doc => 'The level at which the menu starts.')
@@ -196,9 +196,9 @@ module Webgen
196
196
  "<##{self.class.name}: alcn=#{@alcn}>"
197
197
  end
198
198
 
199
- # Return +true+ if the alcn matches the pattern. See File.fnmatch for useable patterns.
199
+ # Return +true+ if the alcn matches the pattern. See Webgen::Path.match for more information.
200
200
  def =~(pattern)
201
- File.fnmatch(pattern, @alcn, File::FNM_DOTMATCH|File::FNM_CASEFOLD|File::FNM_PATHNAME)
201
+ Webgen::Path.match(@alcn, pattern)
202
202
  end
203
203
 
204
204
  # Sort nodes by using the meta info +sort_info+ (or +title+ if +sort_info+ is not set) of both
@@ -73,17 +73,15 @@ module Webgen
73
73
  # Make the given +path+ absolute by prepending the absolute directory path +base+ if necessary.
74
74
  # Also resolves all '..' and '.' references in +path+.
75
75
  def self.make_absolute(base, path)
76
- raise(ArgumentError, 'base has to be an absolute path, ie. needs to start with a slash') unless base =~ /\//
77
- Pathname.new(path =~ /^\// ? path : File.join(base, path)).cleanpath.to_s
76
+ raise(ArgumentError, 'base has to be an absolute path, ie. needs to start with a slash') unless base =~ /^\//
77
+ Pathname.new(path =~ /^\// ? path : File.join(base, path)).cleanpath.to_s + (path =~ /.\/$/ ? '/' : '')
78
78
  end
79
79
 
80
- # Return +true+ if the given +path+ matches the given +pattern+ (trailing slashes of directories
81
- # are not respected). For information on which patterns are supported, have a look at the
82
- # documentation of File.fnmatch.
80
+ # Return +true+ if the given +path+ matches the given +pattern+. For information on which
81
+ # patterns are supported, have a look at the documentation of File.fnmatch.
83
82
  def self.match(path, pattern)
84
- path = path.to_s.chomp('/') unless path == '/'
85
- pattern = pattern.to_s.chomp('/') unless pattern == '/'
86
- File.fnmatch(pattern, path, File::FNM_DOTMATCH|File::FNM_CASEFOLD|File::FNM_PATHNAME)
83
+ pattern += '/' if path.to_s =~ /\/$/ && pattern !~ /\/$|^$/
84
+ File.fnmatch(pattern, path.to_s, File::FNM_DOTMATCH|File::FNM_CASEFOLD|File::FNM_PATHNAME)
87
85
  end
88
86
 
89
87
 
@@ -279,10 +277,15 @@ module Webgen
279
277
  @parent_path = File.join(File.dirname(@path), '/')
280
278
  match_data = FILENAME_RE.match(File.basename(@path))
281
279
 
282
- @meta_info['sort_info'] = (match_data[1].nil? ? nil : match_data[1].to_i)
283
- @basename = match_data[2]
284
- @meta_info['lang'] = Webgen::LanguageManager.language_for_code(match_data[3])
285
- @ext = (@meta_info['lang'].nil? && !match_data[3].nil? ? match_data[3].to_s : '') + match_data[4].to_s
280
+ if !match_data[1].nil? && match_data[3].nil? && match_data[4].nil? # handle special case of sort_info.basename as basename.ext
281
+ @basename = match_data[1]
282
+ @ext = match_data[2]
283
+ else
284
+ @meta_info['sort_info'] = (match_data[1].nil? ? nil : match_data[1].to_i)
285
+ @basename = match_data[2]
286
+ @meta_info['lang'] = Webgen::LanguageManager.language_for_code(match_data[3])
287
+ @ext = (@meta_info['lang'].nil? && !match_data[3].nil? ? match_data[3].to_s + '.' : '') + match_data[4].to_s
288
+ end
286
289
  end
287
290
 
288
291
  # Analyse the path assuming it is a fragment.
@@ -130,7 +130,7 @@ module Webgen
130
130
 
131
131
  nodes_to_delete.each {|node| website.tree.delete_node(node)}
132
132
  used_paths.merge(paths_to_use)
133
- paths = create_nodes_from_paths(used_paths.to_a.sort)
133
+ paths = create_nodes_from_paths(used_paths).collect {|n| n.node_info[:src]}
134
134
  unused_paths.merge(used_paths - paths)
135
135
  website.tree.node_access[:alcn].each {|name, node| website.tree.delete_node(node) if node.flagged?(:reinit)}
136
136
  website.cache.reset_volatile_cache
@@ -203,23 +203,23 @@ module Webgen
203
203
  end
204
204
  end
205
205
 
206
- # Use the source handlers to create nodes for the +paths+ in the <tt>website.tree</tt>.
206
+ # Use the source handlers to create nodes for the +paths+ in the <tt>website.tree</tt> and
207
+ # return the nodes that have been created.
207
208
  def create_nodes_from_paths(paths)
208
- used_paths = Set.new
209
+ nodes = Set.new
209
210
  website.config['sourcehandler.invoke'].sort.each do |priority, shns|
210
211
  shns.each do |shn|
211
212
  sh = website.cache.instance(shn)
212
213
  handler_paths = paths_for_handler(shn, paths)
213
- used_paths.merge(handler_paths)
214
214
  handler_paths.sort {|a,b| a.path.length <=> b.path.length}.each do |path|
215
215
  if !website.tree[path.parent_path]
216
- used_paths.merge(create_nodes_from_paths([path.parent_path]))
216
+ nodes.merge(create_nodes_from_paths([path.parent_path]))
217
217
  end
218
- create_nodes(path, sh)
218
+ nodes += create_nodes(path, sh)
219
219
  end
220
220
  end
221
221
  end
222
- used_paths
222
+ nodes
223
223
  end
224
224
 
225
225
  # Prepare everything to create from the +path+ using the +source_handler+. If a block is
@@ -236,9 +236,8 @@ module Webgen
236
236
  else
237
237
  source_handler.create_node(path)
238
238
  end
239
- nodes.flatten.compact.each do |node|
240
- website.blackboard.dispatch_msg(:after_node_created, node)
241
- end
239
+ nodes = nodes.flatten.compact
240
+ nodes.each {|node| website.blackboard.dispatch_msg(:after_node_created, node)}
242
241
  nodes
243
242
  rescue Webgen::Error => e
244
243
  e.alcn = path unless e.alcn
@@ -53,7 +53,7 @@ EOF
53
53
  end
54
54
  end
55
55
  end.first
56
- attrs = param('tag.tikz.img_attr').collect {|name,value| "#{name.to_s}=\"#{value}\"" }.sort.unshift('').join(' ')
56
+ attrs = {'alt' => ''}.merge(param('tag.tikz.img_attr')).collect {|name,value| "#{name.to_s}=\"#{value}\"" }.sort.unshift('').join(' ')
57
57
  "<img src=\"#{context.dest_node.route_to(node)}\"#{attrs} />"
58
58
  end
59
59
 
@@ -3,6 +3,6 @@
3
3
  module Webgen
4
4
 
5
5
  # The version of webgen.
6
- VERSION = '0.5.9'
6
+ VERSION = '0.5.10'
7
7
 
8
8
  end
@@ -1,3 +1,4 @@
1
+ --- pipeline:erb,tags,blocks,head,xmllint
1
2
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{lang:}" lang="{lang:}">
3
4
 
@@ -0,0 +1,38 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'test/unit'
4
+ require 'helper'
5
+ require 'webgen/contentprocessor'
6
+
7
+ class TestContentProcessorXmllint < Test::Unit::TestCase
8
+
9
+ include Test::WebsiteHelper
10
+
11
+ def test_call
12
+ obj = Webgen::ContentProcessor::Xmllint.new
13
+ root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
14
+ node = Webgen::Node.new(root, '/test', 'test')
15
+ context = Webgen::Context.new(:content => "", :chain => [node])
16
+
17
+ tmp, ENV['PATH'] = ENV['PATH'], '/sbin'
18
+ assert_raise(Webgen::CommandNotFoundError) { obj.call(context) }
19
+ ENV['PATH'] = tmp
20
+
21
+ output = StringIO.new('')
22
+ @website.logger = ::Logger.new(output)
23
+ @website.logger.level = Logger::WARN
24
+
25
+ context.content = data = 'test'
26
+ obj.call(context)
27
+ assert_equal(data, context.content)
28
+ output.rewind; assert_match(/<\/test:~1>/, output.read)
29
+
30
+ output.string = ''
31
+ context.content = data = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' +
32
+ '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>title</title></head><body></body></html>'
33
+ obj.call(context)
34
+ assert_equal(data, context.content)
35
+ assert_equal(0, output.string.length)
36
+ end
37
+
38
+ end
@@ -38,6 +38,8 @@ class TestPath < Test::Unit::TestCase
38
38
  '/dir/', 'default', nil, 'png', 'default.png', 'default.png', '/dir/default.png', '/dir/default.png', nil, 'Default')
39
39
  check_proc.call(Webgen::Path.new('/default.deu.png'),
40
40
  '/', 'default', 'de', 'png', 'default.png', 'default.de.png', '/default.png', '/default.de.png', nil, 'Default')
41
+ check_proc.call(Webgen::Path.new('/default.tar.bz2'),
42
+ '/', 'default', nil, 'tar.bz2', 'default.tar.bz2', 'default.tar.bz2', '/default.tar.bz2', '/default.tar.bz2', nil, 'Default')
41
43
  check_proc.call(Webgen::Path.new('/default.en.tar.bz2'),
42
44
  '/', 'default', 'en', 'tar.bz2', 'default.tar.bz2', 'default.en.tar.bz2', '/default.tar.bz2', '/default.en.tar.bz2', nil, 'Default')
43
45
  check_proc.call(Webgen::Path.new('/default.deu.'),
@@ -52,6 +54,13 @@ class TestPath < Test::Unit::TestCase
52
54
  '/', '.htaccess', 'en', '', '.htaccess', '.htaccess.en', '/.htaccess', '/.htaccess.en', nil, '.htaccess')
53
55
  check_proc.call(Webgen::Path.new('/.htaccess.en.page'),
54
56
  '/', '.htaccess', 'en', 'page', '.htaccess.page', '.htaccess.en.page', '/.htaccess.page', '/.htaccess.en.page', nil, '.htaccess')
57
+ check_proc.call(Webgen::Path.new('/5.png'),
58
+ '/', '5', nil, 'png', '5.png', '5.png', '/5.png', '/5.png', nil, '5')
59
+ check_proc.call(Webgen::Path.new('/5.de.png'),
60
+ '/', 'de', nil, 'png', 'de.png', 'de.png', '/de.png', '/de.png', 5, 'De')
61
+ check_proc.call(Webgen::Path.new('/5.66.png'),
62
+ '/', '66', nil, 'png', '66.png', '66.png', '/66.png', '/66.png', 5, '66')
63
+
55
64
 
56
65
  # Check fragment paths
57
66
  assert_raises(RuntimeError) { Webgen::Path.new("/#hallo")}
@@ -183,10 +192,13 @@ class TestPath < Test::Unit::TestCase
183
192
  assert(Webgen::Path.match(path, '/dir/'))
184
193
  assert(Webgen::Path.match(path, '/dir'))
185
194
  assert(Webgen::Path.match(path, '/*/'))
195
+ assert(Webgen::Path.match(path, '/*'))
186
196
 
187
- path = '/dir'
188
- assert(Webgen::Path.match(path, '/dir/'))
189
- assert(Webgen::Path.match(path, '/dir'))
197
+ path = '/file'
198
+ assert(!Webgen::Path.match(path, '/file/'))
199
+ assert(Webgen::Path.match(path, '/file'))
200
+ assert(!Webgen::Path.match(path, '/*/'))
201
+ assert(Webgen::Path.match(path, '/*'))
190
202
 
191
203
  path = '/'
192
204
  assert(Webgen::Path.match(path, '/'))
@@ -194,12 +206,20 @@ class TestPath < Test::Unit::TestCase
194
206
 
195
207
  path = ''
196
208
  assert(!Webgen::Path.match(path, '/'))
209
+
210
+ path = Webgen::Path.new('/dir/')
211
+ assert(Webgen::Path.match(path, '/dir/'))
212
+ assert(Webgen::Path.match(path, '/dir'))
213
+ assert(Webgen::Path.match(path, '/*/'))
214
+ assert(Webgen::Path.match(path, '/*'))
197
215
  end
198
216
 
199
217
  def test_apath
200
218
  assert_raise(ArgumentError) { Webgen::Path.make_absolute('test', 'test') }
219
+ assert_raise(ArgumentError) { Webgen::Path.make_absolute('test/', 'test') }
201
220
  assert_equal('/', Webgen::Path.make_absolute('/', '/'))
202
221
  assert_equal('/dir', Webgen::Path.make_absolute('/other', '/dir'))
222
+ assert_equal('/dir/', Webgen::Path.make_absolute('/other', '/dir/'))
203
223
  assert_equal('/other/dir', Webgen::Path.make_absolute('/other', 'dir'))
204
224
  assert_equal('/test/dir', Webgen::Path.make_absolute('/other', '../test/dir'))
205
225
  assert_equal('/', Webgen::Path.make_absolute('/', '/..'))
@@ -42,7 +42,7 @@ EOF
42
42
 
43
43
  def test_create_node
44
44
  assert_equal({'/default.*' => {'title' => 'new title', 'before' => 'valbef'},
45
- '/*' => {'title' => 'test'}}, @node.node_info[:mi_paths])
45
+ '/*/' => {'title' => 'test'}}, @node.node_info[:mi_paths])
46
46
  assert_equal({'/default.css' => {'after' => 'valaft'},
47
47
  '/other.page' => {'title' => 'Not Other'}}, @node.node_info[:mi_alcn])
48
48
  end
@@ -30,13 +30,13 @@ class TestTagTikZ < Test::Unit::TestCase
30
30
  context = Webgen::Context.new(:chain => [node])
31
31
 
32
32
  output = call(context, '\tikz \draw (0,0) -- (0,1);', 'test.png', [], '', '72 72', false, {})
33
- assert_equal('<img src="test.png" />', output)
33
+ assert_equal('<img src="test.png" alt="" />', output)
34
34
  assert(root.tree['/test.png'])
35
35
  assert_not_nil(root.tree['/test.png'].content)
36
36
  root.tree.delete_node('/test.png')
37
37
 
38
38
  output = call(context, '\tikz \asdfasdfasf', 'test.png', [], '', '72 72', false, {})
39
- assert_equal('<img src="test.png" />', output)
39
+ assert_equal('<img src="test.png" alt="" />', output)
40
40
  assert(root.tree['/test.png'])
41
41
  assert_raise(Webgen::RenderError) { root.tree['/test.png'].content }
42
42
  root.tree.delete_node('/test.png')
@@ -48,7 +48,7 @@ class TestTagTikZ < Test::Unit::TestCase
48
48
  root.tree.delete_node('/images/test.gif')
49
49
 
50
50
  output = call(context, '\tikz \draw (0,0) -- (0,1);', 'images/../img/test.png', [], '', '300 72', true, {})
51
- assert_equal('<img src="img/test.png" />', output)
51
+ assert_equal('<img src="img/test.png" alt="" />', output)
52
52
  assert(root.tree['/img/test.png'])
53
53
  assert_not_nil(root.tree['/img/test.png'].content)
54
54
  root.tree.delete_node('/img/test.png')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Leitner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-25 00:00:00 +02:00
12
+ date: 2009-08-10 00:00:00 +02:00
13
13
  default_executable: webgen
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -319,6 +319,7 @@ files:
319
319
  - doc/contentprocessor/sass.page
320
320
  - doc/contentprocessor/tags.page
321
321
  - doc/contentprocessor/tidy.page
322
+ - doc/contentprocessor/xmllint.page
322
323
  - doc/contentprocessor.template
323
324
  - doc/extensions.metainfo
324
325
  - doc/extensions.page
@@ -382,6 +383,7 @@ files:
382
383
  - lib/webgen/contentprocessor/sass.rb
383
384
  - lib/webgen/contentprocessor/tags.rb
384
385
  - lib/webgen/contentprocessor/tidy.rb
386
+ - lib/webgen/contentprocessor/xmllint.rb
385
387
  - lib/webgen/contentprocessor.rb
386
388
  - lib/webgen/context/nodes.rb
387
389
  - lib/webgen/context/render.rb
@@ -470,6 +472,7 @@ files:
470
472
  - test/test_contentprocessor_sass.rb
471
473
  - test/test_contentprocessor_tags.rb
472
474
  - test/test_contentprocessor_tidy.rb
475
+ - test/test_contentprocessor_xmllint.rb
473
476
  - test/test_context.rb
474
477
  - test/test_error.rb
475
478
  - test/test_languages.rb