webgen 0.5.10 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +487 -0
- data/Rakefile +13 -28
- data/VERSION +1 -1
- data/bin/webgen +1 -2
- data/data/webgen/passive_sources/templates/atom_feed.template +1 -0
- data/data/webgen/website_bundles/style/andreas07/src/default.css +2 -2
- data/data/webgen/website_skeleton/config.yaml +22 -5
- data/doc/contentprocessor.template +2 -2
- data/doc/contentprocessor/blocks.page +4 -4
- data/doc/contentprocessor/builder.page +2 -3
- data/doc/contentprocessor/erb.page +1 -1
- data/doc/contentprocessor/erubis.page +5 -5
- data/doc/contentprocessor/fragments.page +5 -4
- data/doc/contentprocessor/haml.page +2 -3
- data/doc/contentprocessor/head.page +16 -6
- data/doc/contentprocessor/kramdown.page +49 -0
- data/doc/contentprocessor/less.page +34 -0
- data/doc/contentprocessor/maruku.page +6 -3
- data/doc/contentprocessor/rdiscount.page +3 -3
- data/doc/contentprocessor/rdoc.page +1 -1
- data/doc/contentprocessor/redcloth.page +1 -1
- data/doc/contentprocessor/sass.page +1 -1
- data/doc/contentprocessor/tags.page +2 -2
- data/doc/contentprocessor/tidy.page +2 -2
- data/doc/extensions.page +1 -2
- data/doc/extensions.template +5 -5
- data/doc/getting_started.page +16 -12
- data/doc/index.page +21 -21
- data/doc/manual.page +109 -61
- data/doc/reference_configuration.page +63 -38
- data/doc/reference_metainfo.page +68 -45
- data/doc/reference_website_styles.page +5 -1
- data/doc/source/filesystem.page +4 -4
- data/doc/source/tararchive.page +4 -4
- data/doc/sourcehandler.template +2 -2
- data/doc/sourcehandler/feed.page +3 -4
- data/doc/sourcehandler/metainfo.page +1 -1
- data/doc/sourcehandler/page.page +3 -3
- data/doc/sourcehandler/sitemap.page +2 -3
- data/doc/sourcehandler/template.page +2 -2
- data/doc/sourcehandler/virtual.page +5 -5
- data/doc/tag.template +1 -1
- data/doc/tag/coderay.page +2 -2
- data/doc/tag/includefile.page +1 -1
- data/doc/tag/langbar.page +4 -1
- data/doc/tag/menu.page +3 -3
- data/doc/tag/relocatable.page +1 -1
- data/doc/upgrading.page +30 -31
- data/doc/webgen_page_format.page +6 -6
- data/lib/webgen/cache.rb +4 -5
- data/lib/webgen/cli/utils.rb +18 -7
- data/lib/webgen/cli/webgui_command.rb +4 -2
- data/lib/webgen/common.rb +10 -0
- data/lib/webgen/configuration.rb +1 -3
- data/lib/webgen/contentprocessor.rb +4 -2
- data/lib/webgen/contentprocessor/blocks.rb +1 -0
- data/lib/webgen/contentprocessor/builder.rb +3 -9
- data/lib/webgen/contentprocessor/erb.rb +3 -9
- data/lib/webgen/contentprocessor/erubis.rb +3 -9
- data/lib/webgen/contentprocessor/haml.rb +10 -11
- data/lib/webgen/contentprocessor/head.rb +64 -0
- data/lib/webgen/contentprocessor/kramdown.rb +26 -0
- data/lib/webgen/contentprocessor/kramdown/html.rb +32 -0
- data/lib/webgen/contentprocessor/less.rb +35 -0
- data/lib/webgen/contentprocessor/maruku.rb +14 -0
- data/lib/webgen/contentprocessor/tags.rb +25 -7
- data/lib/webgen/default_config.rb +9 -3
- data/lib/webgen/node.rb +92 -0
- data/lib/webgen/output.rb +3 -1
- data/lib/webgen/source/resource.rb +2 -1
- data/lib/webgen/source/tararchive.rb +3 -2
- data/lib/webgen/sourcehandler.rb +8 -4
- data/lib/webgen/sourcehandler/base.rb +1 -2
- data/lib/webgen/sourcehandler/feed.rb +1 -1
- data/lib/webgen/sourcehandler/virtual.rb +1 -0
- data/lib/webgen/tag/base.rb +1 -1
- data/lib/webgen/tag/langbar.rb +5 -2
- data/lib/webgen/version.rb +1 -1
- data/lib/webgen/website.rb +7 -8
- data/misc/default.template +1 -1
- data/misc/htmldoc.virtual +13 -1
- data/test/test_contentprocessor.rb +1 -1
- data/test/test_contentprocessor_blocks.rb +16 -1
- data/test/test_contentprocessor_erb.rb +1 -1
- data/test/test_contentprocessor_fragments.rb +1 -1
- data/test/test_contentprocessor_haml.rb +2 -2
- data/test/test_contentprocessor_head.rb +54 -8
- data/test/test_contentprocessor_kramdown.rb +50 -0
- data/test/test_contentprocessor_less.rb +40 -0
- data/test/test_contentprocessor_tags.rb +8 -0
- data/test/test_node.rb +102 -41
- data/test/test_source_tararchive.rb +5 -1
- data/test/test_sourcehandler_feed.rb +5 -2
- data/test/test_sourcehandler_virtual.rb +5 -0
- data/test/test_tag_langbar.rb +2 -3
- metadata +22 -16
- data/lib/webgen/deprecated.rb +0 -87
@@ -1,5 +1,19 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
+
require 'rexml/parsers/baseparser'
|
4
|
+
|
5
|
+
class REXML::Parsers::BaseParser
|
6
|
+
|
7
|
+
alias :"old_stream=" :"stream="
|
8
|
+
|
9
|
+
def stream=(source)
|
10
|
+
self.old_stream=(source)
|
11
|
+
@nsstack << Set.new(['webgen'])
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
|
3
17
|
module Webgen::ContentProcessor
|
4
18
|
|
5
19
|
# Processes content in Markdown format using the +maruku+ library.
|
@@ -94,14 +94,32 @@ module Webgen::ContentProcessor
|
|
94
94
|
end
|
95
95
|
|
96
96
|
when :process
|
97
|
-
if
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
97
|
+
if RUBY_VERSION >= '1.9'
|
98
|
+
begin
|
99
|
+
enc = scanner.string.encoding
|
100
|
+
scanner.string.force_encoding('ASCII-8BIT')
|
101
|
+
if data.backslashes % 2 == 0
|
102
|
+
result = yield(data.tag, scanner.string[data.params_start_pos...data.params_end_pos].force_encoding(enc),
|
103
|
+
scanner.string[(data.params_end_pos+1)...data.body_end_pos].to_s.force_encoding(enc)).to_s
|
104
|
+
scanner.string[data.start_pos..data.end_pos] = "\\" * (data.backslashes / 2) + result.force_encoding('ASCII-8BIT')
|
105
|
+
scanner.pos = data.start_pos + result.length
|
106
|
+
else
|
107
|
+
scanner.string[data.start_pos, 1 + data.backslashes / 2] = ''
|
108
|
+
scanner.pos -= 1 + data.backslashes / 2
|
109
|
+
end
|
110
|
+
ensure
|
111
|
+
scanner.string.force_encoding(enc) if RUBY_VERSION >= '1.9'
|
112
|
+
end
|
102
113
|
else
|
103
|
-
|
104
|
-
|
114
|
+
if data.backslashes % 2 == 0
|
115
|
+
result = yield(data.tag, scanner.string[data.params_start_pos...data.params_end_pos],
|
116
|
+
scanner.string[(data.params_end_pos+1)...data.body_end_pos]).to_s
|
117
|
+
scanner.string[data.start_pos..data.end_pos] = "\\" * (data.backslashes / 2) + result
|
118
|
+
scanner.pos = data.start_pos + result.length
|
119
|
+
else
|
120
|
+
scanner.string[data.start_pos, 1 + data.backslashes / 2] = ''
|
121
|
+
scanner.pos -= 1 + data.backslashes / 2
|
122
|
+
end
|
105
123
|
end
|
106
124
|
data.state = :before_tag
|
107
125
|
|
@@ -83,7 +83,7 @@ config.sourcehandler.default_meta_info({
|
|
83
83
|
'Webgen::SourceHandler::Page' => {
|
84
84
|
'kind' => 'page',
|
85
85
|
'fragments_in_menu' => true,
|
86
|
-
'blocks' => {'default' => {'pipeline' => 'erb,tags,
|
86
|
+
'blocks' => {'default' => {'pipeline' => 'erb,tags,markdown,blocks,fragments'}}
|
87
87
|
},
|
88
88
|
'Webgen::SourceHandler::Fragment' => {
|
89
89
|
'kind' => 'fragment'
|
@@ -125,7 +125,7 @@ Webgen::WebsiteAccess.website.blackboard.add_service(:output_instance, Webgen::O
|
|
125
125
|
|
126
126
|
# All things regarding content processors
|
127
127
|
config.contentprocessor.map({
|
128
|
-
'markdown' => 'Webgen::ContentProcessor::
|
128
|
+
'markdown' => 'Webgen::ContentProcessor::Kramdown',
|
129
129
|
'maruku' => 'Webgen::ContentProcessor::Maruku',
|
130
130
|
'textile' => 'Webgen::ContentProcessor::RedCloth',
|
131
131
|
'redcloth' => 'Webgen::ContentProcessor::RedCloth',
|
@@ -141,7 +141,9 @@ config.contentprocessor.map({
|
|
141
141
|
'fragments' => 'Webgen::ContentProcessor::Fragments',
|
142
142
|
'head' => 'Webgen::ContentProcessor::Head',
|
143
143
|
'tidy' => 'Webgen::ContentProcessor::Tidy',
|
144
|
-
'xmllint' => 'Webgen::ContentProcessor::Xmllint'
|
144
|
+
'xmllint' => 'Webgen::ContentProcessor::Xmllint',
|
145
|
+
'kramdown' => 'Webgen::ContentProcessor::Kramdown',
|
146
|
+
'less' => 'Webgen::ContentProcessor::Less'
|
145
147
|
}, :doc => 'Content processor name to class map')
|
146
148
|
|
147
149
|
Webgen::WebsiteAccess.website.blackboard.add_service(:content_processor_names, Webgen::ContentProcessor.method(:list))
|
@@ -174,6 +176,10 @@ config.contentprocessor.tidy.options("-raw", :doc => "The options passed to the
|
|
174
176
|
|
175
177
|
config.contentprocessor.xmllint.options("--catalogs --noout --valid", :doc => 'Options passed to the xmllint command')
|
176
178
|
|
179
|
+
config.contentprocessor.kramdown.options({:auto_ids => true}, :doc => 'The options hash for the kramdown processor')
|
180
|
+
config.contentprocessor.kramdown.handle_links(true, :doc => 'Whether all links in a kramdown document should be handled by webgen')
|
181
|
+
|
182
|
+
|
177
183
|
config.tag.relocatable.path(nil, :doc => 'The path which should be made relocatable', :mandatory => 'default')
|
178
184
|
|
179
185
|
config.tag.menu.start_level(1, :doc => 'The level at which the menu starts.')
|
data/lib/webgen/node.rb
CHANGED
@@ -352,6 +352,36 @@ module Webgen
|
|
352
352
|
(use_link ? "<a#{attrs}>#{link_text}</a>" : "<span#{attrs}>#{link_text}</span>")
|
353
353
|
end
|
354
354
|
|
355
|
+
def find(opts = {})
|
356
|
+
if opts[:alcn]
|
357
|
+
opts[:alcn] = Path.make_absolute(is_directory? ? alcn : parent.alcn.sub(/#.*$/, ''), opts[:alcn].to_s)
|
358
|
+
end
|
359
|
+
opts[:levels] = 100000 unless opts.has_key?(:levels)
|
360
|
+
|
361
|
+
result = find_nodes(opts, nil, 1)
|
362
|
+
result.flatten! if result && (opts[:limit] || opts[:offset])
|
363
|
+
result.sort!(opts[:sort]) if result
|
364
|
+
result.children = result.children[(opts[:offset].to_s.to_i)..(opts[:limit] ? opts[:offset].to_s.to_i + opts[:limit].to_s.to_i - 1 : -1)]
|
365
|
+
result
|
366
|
+
end
|
367
|
+
|
368
|
+
def find_nodes(opts, parent, level)
|
369
|
+
result = ProxyNode.new(parent, self)
|
370
|
+
|
371
|
+
children.each do |child|
|
372
|
+
c_result = child.find_nodes(opts, result, level + 1)
|
373
|
+
result.children << c_result unless c_result.nil?
|
374
|
+
end if opts[:levels] && level <= opts[:levels]
|
375
|
+
|
376
|
+
(!result.children.empty? || find_match?(opts) ? result : nil)
|
377
|
+
end
|
378
|
+
protected :find_nodes
|
379
|
+
|
380
|
+
def find_match?(opts)
|
381
|
+
(!opts[:alcn] || self =~ opts[:alcn])
|
382
|
+
end
|
383
|
+
private :find_match?
|
384
|
+
|
355
385
|
#######
|
356
386
|
private
|
357
387
|
#######
|
@@ -396,4 +426,66 @@ module Webgen
|
|
396
426
|
|
397
427
|
end
|
398
428
|
|
429
|
+
# Encapsulates a node. This class is needed when a hierarchy of nodes should be created but the
|
430
|
+
# original hierarchy should not be destroyed.
|
431
|
+
class ProxyNode
|
432
|
+
|
433
|
+
# Array of child proxy nodes.
|
434
|
+
attr_accessor :children
|
435
|
+
|
436
|
+
# The parent proxy node.
|
437
|
+
attr_accessor :parent
|
438
|
+
|
439
|
+
# The encapsulated node.
|
440
|
+
attr_reader :node
|
441
|
+
|
442
|
+
# Create a new proxy node under +parent+ (also has to be a ProxyNode object) for the real node
|
443
|
+
# +node+.
|
444
|
+
def initialize(parent, node)
|
445
|
+
@parent = parent
|
446
|
+
@node = node
|
447
|
+
@children = []
|
448
|
+
end
|
449
|
+
|
450
|
+
# Sort recursively all children of the node using the wrapped nodes. If +value+ is +false+, no
|
451
|
+
# sorting is done at all. If it is +true+, then the default sort mechanism is used (see
|
452
|
+
# Node#<=>). Otherwise +value+ has to be a meta information key on which should be sorted.
|
453
|
+
def sort!(value = true)
|
454
|
+
return self unless value
|
455
|
+
|
456
|
+
if value.kind_of?(String)
|
457
|
+
self.children.sort! do |a,b|
|
458
|
+
aval, bval = a.node[value].to_s, b.node[value].to_s
|
459
|
+
if aval !~ /\D/ && aval !~ /\D/
|
460
|
+
aval = aval.to_i
|
461
|
+
bval = bval.to_i
|
462
|
+
end
|
463
|
+
aval <=> bval
|
464
|
+
end
|
465
|
+
else
|
466
|
+
self.children.sort! {|a,b| a.node <=> b.node}
|
467
|
+
end
|
468
|
+
self.children.each {|child| child.sort!(value)}
|
469
|
+
self
|
470
|
+
end
|
471
|
+
|
472
|
+
# Turn the hierarchy of proxy nodes into a flat list.
|
473
|
+
def flatten!
|
474
|
+
result = []
|
475
|
+
while !self.children.empty?
|
476
|
+
result << self.children.shift
|
477
|
+
result.last.parent = self
|
478
|
+
self.children.unshift(*result.last.children)
|
479
|
+
result.last.children = []
|
480
|
+
end
|
481
|
+
self.children = result
|
482
|
+
end
|
483
|
+
|
484
|
+
# Return the hierarchy under this node as nested list of alcn values.
|
485
|
+
def to_list
|
486
|
+
self.children.inject([]) {|temp, n| temp << n.node.alcn; temp += ((t = n.to_list).empty? ? [] : [t]) }
|
487
|
+
end
|
488
|
+
|
489
|
+
end
|
490
|
+
|
399
491
|
end
|
data/lib/webgen/output.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
+
require 'webgen/common'
|
4
|
+
|
3
5
|
module Webgen
|
4
6
|
|
5
7
|
# Namespace for all classes that know how to write out node content.
|
@@ -74,7 +76,7 @@ module Webgen
|
|
74
76
|
classes = (WebsiteAccess.website.cache.volatile[:classes] ||= {})
|
75
77
|
unless classes.has_key?(:output_instance)
|
76
78
|
klass, *args = WebsiteAccess.website.config['output']
|
77
|
-
classes[:output_instance] =
|
79
|
+
classes[:output_instance] = Common.const_for_name(klass).new(*args)
|
78
80
|
end
|
79
81
|
classes[:output_instance]
|
80
82
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'webgen/websiteaccess'
|
4
4
|
require 'webgen/source'
|
5
|
+
require 'webgen/common'
|
5
6
|
|
6
7
|
module Webgen::Source
|
7
8
|
|
@@ -30,7 +31,7 @@ module Webgen::Source
|
|
30
31
|
if !defined?(@paths)
|
31
32
|
stack = Stacked.new
|
32
33
|
website.config['resources'].select {|name, infos| File.fnmatch(@glob, name)}.sort.each do |name, infos|
|
33
|
-
stack.add([['/',
|
34
|
+
stack.add([['/', Webgen::Common.const_for_name(infos.first).new(*infos[1..-1])]])
|
34
35
|
end
|
35
36
|
@paths = stack.paths
|
36
37
|
@paths = @paths.select {|p| File.fnmatch(@paths_glob, p)} if @paths_glob
|
@@ -8,7 +8,7 @@ require 'zlib'
|
|
8
8
|
begin
|
9
9
|
require 'archive/tar/minitar'
|
10
10
|
rescue LoadError
|
11
|
-
raise Webgen::LoadError.new('archive/tar/minitar', self.class.name,
|
11
|
+
raise Webgen::LoadError.new('archive/tar/minitar', self.class.name, nil, 'archive-tar-minitar')
|
12
12
|
end
|
13
13
|
|
14
14
|
module Webgen
|
@@ -64,7 +64,8 @@ module Webgen
|
|
64
64
|
@paths = input.collect do |entry|
|
65
65
|
path = entry.full_name
|
66
66
|
next unless File.fnmatch(@glob, path, File::FNM_DOTMATCH|File::FNM_CASEFOLD|File::FNM_PATHNAME)
|
67
|
-
path += '/' if entry.directory? && path[-1] !=
|
67
|
+
path += '/' if entry.directory? && path[-1,1] != '/'
|
68
|
+
path = '/' + path unless path[0,1] == '/'
|
68
69
|
Path.new(path, entry.read, Time.at(entry.mtime), @uri)
|
69
70
|
end.compact.to_set
|
70
71
|
end
|
data/lib/webgen/sourcehandler.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
require 'webgen/loggable'
|
4
|
+
require 'webgen/common'
|
4
5
|
require 'benchmark'
|
5
6
|
|
6
7
|
module Webgen
|
@@ -41,7 +42,9 @@ module Webgen
|
|
41
42
|
website.blackboard.add_listener(:node_meta_info_changed?, method(:meta_info_changed?))
|
42
43
|
|
43
44
|
website.blackboard.add_listener(:before_node_deleted) do |node|
|
44
|
-
|
45
|
+
unless node.is_fragment? || node['no_output'] || node.path == '/' || node == node.tree.dummy_root
|
46
|
+
website.blackboard.invoke(:output_instance).delete(node.path)
|
47
|
+
end
|
45
48
|
end if website.config['output.do_deletion']
|
46
49
|
end
|
47
50
|
|
@@ -173,10 +176,10 @@ module Webgen
|
|
173
176
|
def find_all_source_paths
|
174
177
|
if !defined?(@paths)
|
175
178
|
active_source = Webgen::Source::Stacked.new(website.config['sources'].collect do |mp, name, *args|
|
176
|
-
[mp,
|
179
|
+
[mp, Webgen::Common.const_for_name(name).new(*args)]
|
177
180
|
end)
|
178
181
|
passive_source = Webgen::Source::Stacked.new(website.config['passive_sources'].collect do |mp, name, *args|
|
179
|
-
[mp,
|
182
|
+
[mp, Webgen::Common.const_for_name(name).new(*args)]
|
180
183
|
end, true)
|
181
184
|
passive_source.paths.each {|path| path.passive = true }
|
182
185
|
source = Webgen::Source::Stacked.new([['/', active_source], ['/', passive_source]])
|
@@ -197,7 +200,8 @@ module Webgen
|
|
197
200
|
return [] if patterns.nil?
|
198
201
|
|
199
202
|
options = (website.config['sourcehandler.casefold'] ? File::FNM_CASEFOLD : 0) |
|
200
|
-
(website.config['sourcehandler.use_hidden_files'] ? File::FNM_DOTMATCH : 0)
|
203
|
+
(website.config['sourcehandler.use_hidden_files'] ? File::FNM_DOTMATCH : 0) |
|
204
|
+
File::FNM_PATHNAME
|
201
205
|
find_all_source_paths.values_at(*paths).compact.select do |path|
|
202
206
|
patterns.any? {|pat| File.fnmatch(pat, path, options)}
|
203
207
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
-
require 'facets/symbol/to_proc'
|
4
3
|
require 'webgen/websiteaccess'
|
5
4
|
require 'webgen/loggable'
|
6
5
|
require 'webgen/page'
|
@@ -181,7 +180,7 @@ module Webgen::SourceHandler
|
|
181
180
|
Webgen::WebsiteAccess.website.config['sourcehandler.default_lang_in_output_path'] ||
|
182
181
|
Webgen::WebsiteAccess.website.config['website.lang'] != path.meta_info['lang']
|
183
182
|
end
|
184
|
-
if OutputPathHelpers.public_instance_methods(false).map
|
183
|
+
if OutputPathHelpers.public_instance_methods(false).map {|c| c.to_s}.include?(method)
|
185
184
|
name = send(method, parent, path, use_lang_part)
|
186
185
|
name += '/' if path.path =~ /\/$/ && name !~ /\/$/
|
187
186
|
if (node = node_exists?(path, name)) && node.lang != path.meta_info['lang']
|
@@ -61,7 +61,7 @@ module Webgen::SourceHandler
|
|
61
61
|
|
62
62
|
node.tree.node_access[:alcn].values.
|
63
63
|
select {|node| patterns.any? {|pat| node =~ pat} && node.node_info[:page]}.
|
64
|
-
sort {|a,b| a['modified_at'] <=> b['modified_at']}[0, nr_items]
|
64
|
+
sort {|a,b| a['modified_at'] <=> b['modified_at']}.reverse[0, nr_items]
|
65
65
|
end
|
66
66
|
|
67
67
|
# Return the feed link URL for the feed +node+.
|
data/lib/webgen/tag/base.rb
CHANGED
@@ -57,7 +57,7 @@ require 'webgen/websiteaccess'
|
|
57
57
|
#
|
58
58
|
# end
|
59
59
|
#
|
60
|
-
# WebsiteAccess.website.config.reverser.do_reverse nil, :mandatory => default
|
60
|
+
# WebsiteAccess.website.config.reverser.do_reverse nil, :mandatory => 'default'
|
61
61
|
# WebsiteAccess.website.config['contentprocessor.tags.map']['reverse'] = 'Reverser'
|
62
62
|
#
|
63
63
|
module Webgen::Tag::Base
|
data/lib/webgen/tag/langbar.rb
CHANGED
@@ -19,8 +19,11 @@ module Webgen::Tag
|
|
19
19
|
result = lang_nodes.
|
20
20
|
reject {|n| (context.content_node.lang == n.lang && !param('tag.langbar.show_own_lang'))}.
|
21
21
|
sort {|a, b| a.lang <=> b.lang}.
|
22
|
-
collect
|
23
|
-
|
22
|
+
collect do |n|
|
23
|
+
attrs = {:link_text => (param('tag.langbar.lang_names')[n.lang] || n.lang), :lang => n.lang}
|
24
|
+
attrs['class'] = 'webgen-langbar-current-lang' if context.content_node.lang == n.lang
|
25
|
+
context.dest_node.link_to(n, attrs)
|
26
|
+
end.join(param('tag.langbar.separator'))
|
24
27
|
|
25
28
|
[(param('tag.langbar.show_single_lang') || lang_nodes.length > 1 ? result : ""), param('tag.langbar.process_output')]
|
26
29
|
end
|
data/lib/webgen/version.rb
CHANGED
data/lib/webgen/website.rb
CHANGED
@@ -10,7 +10,6 @@
|
|
10
10
|
require 'logger'
|
11
11
|
require 'set'
|
12
12
|
require 'fileutils'
|
13
|
-
require 'facets/symbol/to_proc'
|
14
13
|
|
15
14
|
# Requirements for Website
|
16
15
|
require 'webgen/coreext'
|
@@ -38,9 +37,6 @@ require 'webgen/node'
|
|
38
37
|
require 'webgen/page'
|
39
38
|
require 'webgen/version'
|
40
39
|
|
41
|
-
# Load deprecated classes/methods/...
|
42
|
-
require 'webgen/deprecated'
|
43
|
-
|
44
40
|
|
45
41
|
# The Webgen namespace houses all classes/modules used by webgen.
|
46
42
|
#
|
@@ -336,13 +332,16 @@ module Webgen
|
|
336
332
|
else
|
337
333
|
config['website.cache'].last
|
338
334
|
end
|
339
|
-
cache_data,
|
340
|
-
|
335
|
+
cache_data, tree, version = Marshal.load(data) rescue nil
|
336
|
+
if cache_data && version == Webgen::VERSION
|
337
|
+
@cache.restore(cache_data)
|
338
|
+
@tree = tree
|
339
|
+
end
|
341
340
|
end
|
342
341
|
|
343
342
|
# Save the +tree+ and the +cache+ to +website.cache+.
|
344
343
|
def save_tree_and_cache
|
345
|
-
cache_data = [@cache.dump, @tree]
|
344
|
+
cache_data = [@cache.dump, @tree, Webgen::VERSION]
|
346
345
|
if config['website.cache'].first == :file
|
347
346
|
cache_file = File.join(@directory, config['website.cache'].last)
|
348
347
|
File.open(cache_file, 'wb') {|f| Marshal.dump(cache_data, f)}
|
@@ -360,7 +359,7 @@ module Webgen
|
|
360
359
|
raise 'Structure of config file is not valid, has to be a Hash' if !config.kind_of?(Hash)
|
361
360
|
config.each do |key, value|
|
362
361
|
case key
|
363
|
-
when *Webgen::Configuration::Helpers.public_instance_methods(false).map
|
362
|
+
when *Webgen::Configuration::Helpers.public_instance_methods(false).map {|c| c.to_s} then @config.send(key, value)
|
364
363
|
else @config[key] = value
|
365
364
|
end
|
366
365
|
end
|
data/misc/default.template
CHANGED
@@ -59,7 +59,7 @@
|
|
59
59
|
|
60
60
|
<div class="col2 float-right">
|
61
61
|
<p>
|
62
|
-
©
|
62
|
+
© 2004-2010 Thomas Leitner | generated by <a href="http://webgen.rubyforge.org">webgen</a><br />
|
63
63
|
Design based on Ablaze 2.1 by <a href="http://www.styleshout.com/">styleshout</a><br />
|
64
64
|
Block quote icons from the <a href="http://tango.freedesktop.org//">Tango Icon Theme</a><br />
|
65
65
|
Valid <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> |
|
data/misc/htmldoc.virtual
CHANGED
@@ -2,4 +2,16 @@ api.html:
|
|
2
2
|
url: rdoc/index.html
|
3
3
|
title: API
|
4
4
|
in_menu: true
|
5
|
-
sort_info: 60
|
5
|
+
sort_info: 60
|
6
|
+
|
7
|
+
rdoc/index.html:
|
8
|
+
title: API
|
9
|
+
|
10
|
+
rdoc/Webgen/Context.html:
|
11
|
+
title: Webgen::Context
|
12
|
+
|
13
|
+
rdoc/Webgen/ContentProcessor/Head.html:
|
14
|
+
title: Webgen::ContentProcessor::Head
|
15
|
+
|
16
|
+
rdoc/Webgen/Tag/Base.html:
|
17
|
+
title: Webgen::Tag::Base
|
@@ -10,7 +10,7 @@ class TestContentProcessor < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
def setup
|
12
12
|
super
|
13
|
-
@website.config.data['contentprocessor.map'] = {'test' => Hash, 'binary' => [Hash, :binary]}
|
13
|
+
@website.config.data['contentprocessor.map'] = {'test' => 'Hash', 'binary' => ['Hash', :binary]}
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_access_hash
|