gettalong-webgen 0.5.8.20090507 → 0.5.9.20090620
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -6
- data/data/webgen/passive_sources/images/generated_by_webgen.png +0 -0
- data/data/webgen/passive_sources/images/webgen_logo.png +0 -0
- data/data/webgen/passive_sources/templates/atom_feed.template +38 -0
- data/data/webgen/passive_sources/templates/rss_feed.template +28 -0
- data/data/webgen/resources.yaml +2 -1
- data/doc/contentprocessor/builder.page +1 -1
- data/doc/contentprocessor/erb.page +5 -2
- data/doc/contentprocessor/erubis.page +2 -2
- data/doc/extensions.page +1 -1
- data/doc/manual.page +56 -26
- data/doc/reference_configuration.page +36 -1
- data/doc/reference_website_styles.page +1 -1
- data/doc/sourcehandler/feed.page +6 -11
- data/doc/tag/includefile.page +1 -1
- data/lib/webgen/cli/apply_command.rb +1 -1
- data/lib/webgen/cli/utils.rb +2 -2
- data/lib/webgen/common.rb +0 -9
- data/lib/webgen/contentprocessor/blocks.rb +60 -36
- data/lib/webgen/contentprocessor/builder.rb +2 -2
- data/lib/webgen/contentprocessor/erb.rb +3 -2
- data/lib/webgen/contentprocessor/erubis.rb +2 -2
- data/lib/webgen/contentprocessor/haml.rb +2 -2
- data/lib/webgen/contentprocessor/maruku.rb +1 -1
- data/lib/webgen/contentprocessor/sass.rb +2 -2
- data/lib/webgen/contentprocessor/tags.rb +25 -11
- data/lib/webgen/context.rb +4 -1
- data/lib/webgen/context/render.rb +32 -0
- data/lib/webgen/context/tags.rb +20 -0
- data/lib/webgen/default_config.rb +4 -1
- data/lib/webgen/deprecated.rb +37 -4
- data/lib/webgen/node.rb +37 -38
- data/lib/webgen/path.rb +151 -54
- data/lib/webgen/source.rb +6 -6
- data/lib/webgen/source/stacked.rb +13 -5
- data/lib/webgen/sourcehandler.rb +71 -45
- data/lib/webgen/sourcehandler/base.rb +51 -21
- data/lib/webgen/sourcehandler/copy.rb +4 -4
- data/lib/webgen/sourcehandler/directory.rb +3 -9
- data/lib/webgen/sourcehandler/feed.rb +23 -49
- data/lib/webgen/sourcehandler/fragment.rb +10 -8
- data/lib/webgen/sourcehandler/memory.rb +9 -10
- data/lib/webgen/sourcehandler/metainfo.rb +9 -9
- data/lib/webgen/sourcehandler/page.rb +5 -5
- data/lib/webgen/sourcehandler/sitemap.rb +3 -3
- data/lib/webgen/sourcehandler/template.rb +6 -6
- data/lib/webgen/sourcehandler/virtual.rb +19 -17
- data/lib/webgen/tag/base.rb +34 -26
- data/lib/webgen/tag/breadcrumbtrail.rb +3 -3
- data/lib/webgen/tag/executecommand.rb +3 -3
- data/lib/webgen/tag/langbar.rb +2 -2
- data/lib/webgen/tag/link.rb +3 -3
- data/lib/webgen/tag/menu.rb +2 -2
- data/lib/webgen/tag/metainfo.rb +1 -1
- data/lib/webgen/tag/relocatable.rb +17 -21
- data/lib/webgen/tag/tikz.rb +5 -6
- data/lib/webgen/tree.rb +7 -7
- data/lib/webgen/version.rb +1 -1
- data/lib/webgen/website.rb +4 -2
- data/misc/default.css +8 -2
- data/misc/default.template +2 -2
- data/misc/logo.svg +313 -0
- data/misc/style.page +1 -1
- data/test/helper.rb +2 -2
- data/test/test_common_sitemap.rb +1 -1
- data/test/test_contentprocessor_blocks.rb +12 -4
- data/test/test_contentprocessor_builder.rb +2 -1
- data/test/test_contentprocessor_erb.rb +2 -1
- data/test/test_contentprocessor_erubis.rb +1 -1
- data/test/test_contentprocessor_fragments.rb +12 -11
- data/test/test_contentprocessor_haml.rb +2 -1
- data/test/test_contentprocessor_maruku.rb +1 -0
- data/test/test_contentprocessor_rdiscount.rb +1 -0
- data/test/test_contentprocessor_rdoc.rb +1 -0
- data/test/test_contentprocessor_sass.rb +1 -0
- data/test/test_contentprocessor_tags.rb +13 -0
- data/test/test_context.rb +28 -0
- data/test/test_node.rb +40 -20
- data/test/test_path.rb +106 -65
- data/test/test_source_filesystem.rb +1 -1
- data/test/test_source_stacked.rb +19 -6
- data/test/test_sourcehandler_base.rb +53 -47
- data/test/test_sourcehandler_copy.rb +6 -6
- data/test/test_sourcehandler_directory.rb +8 -12
- data/test/test_sourcehandler_feed.rb +10 -6
- data/test/test_sourcehandler_fragment.rb +6 -5
- data/test/test_sourcehandler_main.rb +39 -0
- data/test/test_sourcehandler_memory.rb +4 -4
- data/test/test_sourcehandler_metainfo.rb +10 -10
- data/test/test_sourcehandler_page.rb +9 -9
- data/test/test_sourcehandler_sitemap.rb +4 -4
- data/test/test_sourcehandler_template.rb +14 -14
- data/test/test_sourcehandler_virtual.rb +9 -5
- data/test/test_tag_base.rb +2 -2
- data/test/test_tag_executecommand.rb +1 -1
- data/test/test_tag_link.rb +4 -3
- data/test/test_tag_menu.rb +15 -15
- data/test/test_tag_metainfo.rb +1 -0
- data/test/test_tag_relocatable.rb +2 -1
- data/test/test_tag_tikz.rb +3 -3
- data/test/test_tree.rb +8 -8
- data/test/test_website.rb +15 -0
- metadata +14 -14
- data/test/test_common.rb +0 -18
@@ -14,46 +14,46 @@ class TestSourceHandlerPage < Test::Unit::TestCase
|
|
14
14
|
@website.blackboard.del_service(:templates_for_node)
|
15
15
|
@website.blackboard.add_service(:templates_for_node) {|node| []}
|
16
16
|
@obj = Webgen::SourceHandler::Page.new
|
17
|
-
@root = Webgen::Node.new(
|
17
|
+
@root = Webgen::Node.new(@website.tree.dummy_root, '/', '/')
|
18
18
|
@path = path_with_meta_info('/index.page') {StringIO.new('content')}
|
19
19
|
@path.meta_info.update({'lang'=>'eo', 'test'=>'yes', 'sort_info'=>6})
|
20
20
|
@website.blackboard.add_service(:source_paths) {{@path.path => @path}}
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_create_node
|
24
|
-
node = @obj.create_node(@
|
24
|
+
node = @obj.create_node(@path.dup)
|
25
25
|
|
26
26
|
assert_not_nil(node)
|
27
|
-
assert_equal('
|
27
|
+
assert_equal('/index.eo.html', node.path)
|
28
28
|
assert_equal(@obj.class.name, node.node_info[:processor])
|
29
29
|
assert_equal('Index', node['title'])
|
30
30
|
assert_equal('yes', node['test'])
|
31
31
|
assert_equal(6, node['sort_info'])
|
32
32
|
assert_equal(Webgen::LanguageManager.language_for_code('epo'), node.lang)
|
33
33
|
|
34
|
-
assert_equal(node, @obj.create_node(@
|
34
|
+
assert_equal(node, @obj.create_node(@path.dup))
|
35
35
|
|
36
36
|
@root.tree.delete_node(node)
|
37
37
|
path = @path.dup
|
38
38
|
def path.changed?
|
39
39
|
false
|
40
40
|
end
|
41
|
-
@obj.create_node(
|
41
|
+
@obj.create_node(path)
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_content
|
45
|
-
node = @obj.create_node(@
|
45
|
+
node = @obj.create_node(@path)
|
46
46
|
assert_equal("content", @obj.content(node))
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_render_node
|
50
|
-
node = @obj.create_node(@
|
50
|
+
node = @obj.create_node(@path)
|
51
51
|
assert_equal("content", @obj.render_node(node))
|
52
52
|
assert_raise(RuntimeError) { @obj.render_node(node, 'other') }
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_meta_info_changed
|
56
|
-
node = @obj.create_node(@
|
56
|
+
node = @obj.create_node(@path)
|
57
57
|
@website.blackboard.dispatch_msg(:node_meta_info_changed?, node)
|
58
58
|
assert(!node.meta_info_changed?)
|
59
59
|
|
@@ -63,7 +63,7 @@ class TestSourceHandlerPage < Test::Unit::TestCase
|
|
63
63
|
|
64
64
|
# Remove path from which node is created, meta info should naturally change
|
65
65
|
@root.tree.delete_node(node)
|
66
|
-
node = @obj.create_node(@
|
66
|
+
node = @obj.create_node(@path)
|
67
67
|
@website.blackboard.del_service(:source_paths)
|
68
68
|
@website.blackboard.add_service(:source_paths) { {} }
|
69
69
|
@website.blackboard.dispatch_msg(:node_meta_info_changed?, node)
|
@@ -26,19 +26,19 @@ EOF
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_create_node
|
29
|
-
sitemap = @obj.create_node(@
|
29
|
+
sitemap = @obj.create_node(@path)
|
30
30
|
|
31
31
|
assert_not_nil(sitemap)
|
32
32
|
assert_equal('/test.xml', sitemap.path)
|
33
|
-
assert_equal('/test.xml', sitemap.
|
33
|
+
assert_equal('/test.xml', sitemap.alcn)
|
34
34
|
|
35
35
|
assert_raise(RuntimeError) do
|
36
|
-
@obj.create_node(
|
36
|
+
@obj.create_node(path_with_meta_info('/test.sitemap', {}, @obj.class.name) {StringIO.new('')})
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_content
|
41
|
-
sitemap = @obj.create_node(@
|
41
|
+
sitemap = @obj.create_node(@path)
|
42
42
|
content = sitemap.content
|
43
43
|
assert_match(/<changefreq>daily<\/changefreq>/, content)
|
44
44
|
assert_match(/<changefreq>hourly<\/changefreq>/, content)
|
@@ -18,23 +18,23 @@ class TestSourceHandlerTemplate < Test::Unit::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_create_node
|
21
|
-
root = Webgen::Node.new(
|
22
|
-
node = @obj.create_node(
|
21
|
+
root = Webgen::Node.new(@website.tree.dummy_root, '/', '/', {'lang' => 'de', :test => :value})
|
22
|
+
node = @obj.create_node(path_with_meta_info('/default.template') {StringIO.new('')})
|
23
23
|
|
24
24
|
assert_not_nil(node)
|
25
25
|
assert_not_nil(node.node_info[:page])
|
26
|
-
assert_equal('
|
26
|
+
assert_equal('/default.template', node.path)
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_templates_for_node
|
30
|
-
root = Webgen::Node.new(
|
31
|
-
default_template = Webgen::Node.new(root, 'default.template', 'default.template')
|
32
|
-
default_de_template = Webgen::Node.new(root, 'default.de.template', 'default.template', {'lang' => 'de'})
|
33
|
-
other_template = Webgen::Node.new(root, 'other.template', 'other.template')
|
34
|
-
stopped_template = Webgen::Node.new(root, 'stopped.html', 'stopped.page', { 'template' => nil})
|
35
|
-
invalid_template = Webgen::Node.new(root, 'invalid.template', 'invalid.template', {'template' => 'invalidity'})
|
36
|
-
chained_template = Webgen::Node.new(root, 'chained.template', 'chained.template', {'template' => 'other.template'})
|
37
|
-
german_file = Webgen::Node.new(root, 'german.html', 'german.page', {'lang' => 'de', 'template' => 'other.template'})
|
30
|
+
root = Webgen::Node.new(@website.tree.dummy_root, '/', '/', {:test => :value})
|
31
|
+
default_template = Webgen::Node.new(root, '/default.template', 'default.template')
|
32
|
+
default_de_template = Webgen::Node.new(root, '/default.de.template', 'default.template', {'lang' => 'de'})
|
33
|
+
other_template = Webgen::Node.new(root, '/other.template', 'other.template')
|
34
|
+
stopped_template = Webgen::Node.new(root, '/stopped.html', 'stopped.page', { 'template' => nil})
|
35
|
+
invalid_template = Webgen::Node.new(root, '/invalid.template', 'invalid.template', {'template' => 'invalidity'})
|
36
|
+
chained_template = Webgen::Node.new(root, '/chained.template', 'chained.template', {'template' => 'other.template'})
|
37
|
+
german_file = Webgen::Node.new(root, '/german.html', 'german.page', {'lang' => 'de', 'template' => 'other.template'})
|
38
38
|
dir = Webgen::Node.new(root, '/dir/', 'dir')
|
39
39
|
dir_default_template = Webgen::Node.new(dir, '/dir/default.template', 'default.template')
|
40
40
|
|
@@ -52,9 +52,9 @@ class TestSourceHandlerTemplate < Test::Unit::TestCase
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_default_template
|
55
|
-
root = Webgen::Node.new(
|
56
|
-
dir = Webgen::Node.new(root, 'dir/', 'dir')
|
57
|
-
template = Webgen::Node.new(root, 'default.template', 'default.template')
|
55
|
+
root = Webgen::Node.new(@website.tree.dummy_root, '/', '/', {:test => :value})
|
56
|
+
dir = Webgen::Node.new(root, '/dir/', 'dir/')
|
57
|
+
template = Webgen::Node.new(root, '/default.template', 'default.template')
|
58
58
|
|
59
59
|
assert_equal(template, @obj.default_template(root, nil))
|
60
60
|
assert_equal(template, @obj.default_template(dir, nil))
|
@@ -25,16 +25,20 @@ class TestSourceHandlerVirtual < Test::Unit::TestCase
|
|
25
25
|
- api.html:
|
26
26
|
url: http://www.example.com
|
27
27
|
title: Absolute
|
28
|
+
|
29
|
+
- other.html:
|
30
|
+
url: directory/path.en.html
|
31
|
+
title: Nothing
|
28
32
|
EOF
|
29
33
|
|
30
34
|
def setup
|
31
35
|
super
|
32
36
|
@obj = Webgen::SourceHandler::Virtual.new
|
33
|
-
@root = Webgen::Node.new(
|
37
|
+
@root = Webgen::Node.new(@website.tree.dummy_root, '/', '/')
|
34
38
|
shm = Webgen::SourceHandler::Main.new # for using service :create_nodes
|
35
39
|
@time = Time.now
|
36
40
|
@path = path_with_meta_info('/virtuals', {'modified_at' => @time}, @obj.class.name) {StringIO.new(CONTENT)}
|
37
|
-
@nodes = @obj.create_node(@
|
41
|
+
@nodes = @obj.create_node(@path)
|
38
42
|
@website.blackboard.del_service(:source_paths)
|
39
43
|
@website.blackboard.add_service(:source_paths) {{@path.path => @path}}
|
40
44
|
end
|
@@ -44,7 +48,7 @@ EOF
|
|
44
48
|
|
45
49
|
path_de = @root.tree['/path.de.html']
|
46
50
|
path_en = @root.tree['/directory/path.en.html']
|
47
|
-
dir = @root.tree['/dir']
|
51
|
+
dir = @root.tree['/dir/']
|
48
52
|
assert_not_nil(path_de)
|
49
53
|
assert_not_nil(dir)
|
50
54
|
assert_not_nil(path_en)
|
@@ -74,7 +78,7 @@ EOF
|
|
74
78
|
|
75
79
|
# Reinit node, meta info of path_de should not change, #create_node should only return one node
|
76
80
|
path_de.flag(:reinit)
|
77
|
-
assert(1, @obj.create_node(@
|
81
|
+
assert(1, @obj.create_node(@path).length)
|
78
82
|
@obj.send(:node_meta_info_changed?, path_de)
|
79
83
|
assert(!path_de.flagged?(:dirty_meta_info))
|
80
84
|
|
@@ -86,7 +90,7 @@ EOF
|
|
86
90
|
# Remove path from which virtual node is created, meta info should naturally change
|
87
91
|
@root.tree.delete_node(path_de)
|
88
92
|
@path.instance_eval { @io = Webgen::Path::SourceIO.new {StringIO.new("path.de.html:\n title: hallo")} }
|
89
|
-
@obj.create_node(@
|
93
|
+
@obj.create_node(@path)
|
90
94
|
path_de = @root.tree['/path.de.html']
|
91
95
|
@website.blackboard.del_service(:source_paths)
|
92
96
|
@website.blackboard.add_service(:source_paths) { {} }
|
data/test/test_tag_base.rb
CHANGED
@@ -36,7 +36,7 @@ class TestTagBase < Test::Unit::TestCase
|
|
36
36
|
@website.logger.level = Logger::WARN
|
37
37
|
|
38
38
|
output.string = ''
|
39
|
-
assert_equal({}, @obj.create_tag_params("--\nhal:param1\ntest:[;", Webgen::Tree.new.dummy_root))
|
39
|
+
assert_equal([{}, true], @obj.create_tag_params("--\nhal:param1\ntest:[;", Webgen::Tree.new.dummy_root))
|
40
40
|
output.rewind; assert_match(/Could not parse the tag params/, output.read)
|
41
41
|
|
42
42
|
output.string = ''
|
@@ -79,7 +79,7 @@ class TestTagBase < Test::Unit::TestCase
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def set_params(params)
|
82
|
-
@obj.set_params(@obj.send(:create_params_hash, params, Webgen::Tree.new.dummy_root))
|
82
|
+
@obj.set_params(@obj.send(:create_params_hash, params, Webgen::Tree.new.dummy_root).first)
|
83
83
|
end
|
84
84
|
|
85
85
|
end
|
@@ -35,7 +35,7 @@ class TestTagExecuteCommand < Test::Unit::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def echo_cmd(data)
|
38
|
-
(Config::CONFIG['
|
38
|
+
(Config::CONFIG['host_os'] =~ /mswin|mingw/ ? "echo #{data}" : "echo '#{data}'")
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
data/test/test_tag_link.rb
CHANGED
@@ -34,12 +34,13 @@ class TestTagLink < Test::Unit::TestCase
|
|
34
34
|
# no path set
|
35
35
|
node.unflag(:dirty)
|
36
36
|
@obj.set_params('tag.link.path' => nil)
|
37
|
-
assert_equal('', call(context))
|
38
|
-
assert(node.flagged?(:dirty))
|
37
|
+
assert_equal('<span></span>', call(context))
|
38
|
+
assert(!node.flagged?(:dirty))
|
39
39
|
|
40
40
|
# invalid paths
|
41
41
|
@obj.set_params('tag.link.path' => ':/asdf=-)')
|
42
42
|
assert_equal('', call(context))
|
43
|
+
assert(node.flagged?(:dirty))
|
43
44
|
|
44
45
|
# basic node resolving
|
45
46
|
@obj.set_params('tag.link.path' => 'dir/file.html')
|
@@ -63,7 +64,7 @@ class TestTagLink < Test::Unit::TestCase
|
|
63
64
|
node.node_info[:used_meta_info_nodes] = Set.new
|
64
65
|
@obj.set_params('tag.link.path' => 'dir/file.html')
|
65
66
|
call(context)
|
66
|
-
assert(Set.new([file.
|
67
|
+
assert(Set.new([file.alcn]), node.node_info[:used_meta_info_nodes])
|
67
68
|
end
|
68
69
|
|
69
70
|
end
|
data/test/test_tag_menu.rb
CHANGED
@@ -111,12 +111,12 @@ class TestTagMenu < Test::Unit::TestCase
|
|
111
111
|
expected = [nodes[:dir1], nodes[:dir11], nodes[:file111_en], nodes[:index11_en],
|
112
112
|
nodes[:file11_en], nodes[:file11_en_f1], nodes[:file11_en_f11], nodes[:file11_en_f2],
|
113
113
|
nodes[:dir2], nodes[:file21_en],
|
114
|
-
nodes[:dir3], nodes[:file31_en], nodes[:file31_en_f1]].collect {|n| n.
|
114
|
+
nodes[:dir3], nodes[:file31_en], nodes[:file31_en_f1]].collect {|n| n.alcn}
|
115
115
|
|
116
116
|
assert_equal(expected, tree_en.to_lcn_list.flatten)
|
117
117
|
|
118
118
|
tree_de = @obj.send(:menu_tree_for_lang, 'de', nodes[:root])
|
119
|
-
expected = [nodes[:dir1], nodes[:dir11], nodes[:file111_de], nodes[:file1_de]].collect {|n| n.
|
119
|
+
expected = [nodes[:dir1], nodes[:dir11], nodes[:file111_de], nodes[:file1_de]].collect {|n| n.alcn}
|
120
120
|
|
121
121
|
assert_equal(expected, tree_de.to_lcn_list.flatten)
|
122
122
|
end
|
@@ -126,26 +126,26 @@ class TestTagMenu < Test::Unit::TestCase
|
|
126
126
|
|
127
127
|
# testing min_levels and max_levels
|
128
128
|
output = build_menu(nodes[:index_en], [1, 1, 1, true])
|
129
|
-
expected = [nodes[:dir1], nodes[:dir2], nodes[:dir3]].collect {|n| n.
|
129
|
+
expected = [nodes[:dir1], nodes[:dir2], nodes[:dir3]].collect {|n| n.alcn}
|
130
130
|
assert_equal(expected, output.to_lcn_list.flatten)
|
131
131
|
|
132
132
|
output = build_menu(nodes[:index_en], [1, 2, 1, true])
|
133
|
-
expected = [nodes[:dir1], nodes[:dir2], nodes[:dir3]].collect {|n| n.
|
133
|
+
expected = [nodes[:dir1], nodes[:dir2], nodes[:dir3]].collect {|n| n.alcn}
|
134
134
|
assert_equal(expected, output.to_lcn_list.flatten)
|
135
135
|
|
136
136
|
output = build_menu(nodes[:index_en], [1, 2, 2, true])
|
137
137
|
expected = [nodes[:dir1], nodes[:dir11], nodes[:file11_en], nodes[:dir2], nodes[:file21_en],
|
138
|
-
nodes[:dir3], nodes[:file31_en]].collect {|n| n.
|
138
|
+
nodes[:dir3], nodes[:file31_en]].collect {|n| n.alcn}
|
139
139
|
assert_equal(expected, output.to_lcn_list.flatten)
|
140
140
|
|
141
141
|
# testing show_current_subtree_only
|
142
142
|
output = build_menu(nodes[:file11_en], [1, 1, 2, true])
|
143
|
-
expected = [nodes[:dir1], nodes[:dir11], nodes[:file11_en], nodes[:dir2], nodes[:dir3]].collect {|n| n.
|
143
|
+
expected = [nodes[:dir1], nodes[:dir11], nodes[:file11_en], nodes[:dir2], nodes[:dir3]].collect {|n| n.alcn}
|
144
144
|
assert_equal(expected, output.to_lcn_list.flatten)
|
145
145
|
|
146
146
|
output = build_menu(nodes[:file11_en], [1, 1, 2, false])
|
147
147
|
expected = [nodes[:dir1], nodes[:dir11], nodes[:file11_en], nodes[:dir2], nodes[:file21_en],
|
148
|
-
nodes[:dir3], nodes[:file31_en]].collect {|n| n.
|
148
|
+
nodes[:dir3], nodes[:file31_en]].collect {|n| n.alcn}
|
149
149
|
assert_equal(expected, output.to_lcn_list.flatten)
|
150
150
|
|
151
151
|
# testing start_level
|
@@ -153,38 +153,38 @@ class TestTagMenu < Test::Unit::TestCase
|
|
153
153
|
assert_equal([], output.to_lcn_list.flatten)
|
154
154
|
|
155
155
|
output = build_menu(nodes[:file11_en], [2, 1, 2, true])
|
156
|
-
expected = [nodes[:dir11], nodes[:file11_en]].collect {|n| n.
|
156
|
+
expected = [nodes[:dir11], nodes[:file11_en]].collect {|n| n.alcn}
|
157
157
|
assert_equal(expected, output.to_lcn_list.flatten)
|
158
158
|
|
159
159
|
output = build_menu(nodes[:file11_en], [2, 1, 2, false])
|
160
|
-
expected = [nodes[:dir11], nodes[:file11_en]].collect {|n| n.
|
160
|
+
expected = [nodes[:dir11], nodes[:file11_en]].collect {|n| n.alcn}
|
161
161
|
assert_equal(expected, output.to_lcn_list.flatten)
|
162
162
|
|
163
163
|
output = build_menu(nodes[:file11_en], [2, 2, 2, false])
|
164
164
|
expected = [nodes[:dir11], nodes[:file111_en], nodes[:index11_en],
|
165
|
-
nodes[:file11_en], nodes[:file11_en_f1], nodes[:file11_en_f2]].collect {|n| n.
|
165
|
+
nodes[:file11_en], nodes[:file11_en_f1], nodes[:file11_en_f2]].collect {|n| n.alcn}
|
166
166
|
assert_equal(expected, output.to_lcn_list.flatten)
|
167
167
|
|
168
168
|
output = build_menu(nodes[:file111_en], [2, 1, 2, true])
|
169
|
-
expected = [nodes[:dir11], nodes[:file111_en], nodes[:index11_en], nodes[:file11_en]].collect {|n| n.
|
169
|
+
expected = [nodes[:dir11], nodes[:file111_en], nodes[:index11_en], nodes[:file11_en]].collect {|n| n.alcn}
|
170
170
|
assert_equal(expected, output.to_lcn_list.flatten)
|
171
171
|
|
172
172
|
# testing used_nodes=files setting
|
173
173
|
output = build_menu(nodes[:file11_en], [2, 2, 2, false, 'files'])
|
174
|
-
expected = [nodes[:dir11], nodes[:file111_en], nodes[:index11_en], nodes[:file11_en]].collect {|n| n.
|
174
|
+
expected = [nodes[:dir11], nodes[:file111_en], nodes[:index11_en], nodes[:file11_en]].collect {|n| n.alcn}
|
175
175
|
assert_equal(expected, output.to_lcn_list.flatten)
|
176
176
|
|
177
177
|
output = build_menu(nodes[:file11_en], [1, 1, 1, true, 'files'])
|
178
|
-
expected = [nodes[:dir1], nodes[:dir2]].collect {|n| n.
|
178
|
+
expected = [nodes[:dir1], nodes[:dir2]].collect {|n| n.alcn}
|
179
179
|
assert_equal(expected, output.to_lcn_list.flatten)
|
180
180
|
|
181
181
|
# testing used_nodes=fragments setting
|
182
182
|
output = build_menu(nodes[:file11_en], [1, 1, 2, false, 'fragments'])
|
183
|
-
expected = [nodes[:file11_en_f1], nodes[:file11_en_f2]].collect {|n| n.
|
183
|
+
expected = [nodes[:file11_en_f1], nodes[:file11_en_f2]].collect {|n| n.alcn}
|
184
184
|
assert_equal(expected, output.to_lcn_list.flatten)
|
185
185
|
|
186
186
|
output = build_menu(nodes[:file11_en], [1, 2, 2, false, 'fragments'])
|
187
|
-
expected = [nodes[:file11_en_f1], nodes[:file11_en_f11], nodes[:file11_en_f2]].collect {|n| n.
|
187
|
+
expected = [nodes[:file11_en_f1], nodes[:file11_en_f11], nodes[:file11_en_f2]].collect {|n| n.alcn}
|
188
188
|
assert_equal(expected, output.to_lcn_list.flatten)
|
189
189
|
end
|
190
190
|
|
data/test/test_tag_metainfo.rb
CHANGED
@@ -20,7 +20,7 @@ class TestTagRelocatable < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_call
|
23
|
-
root = Webgen::Node.new(
|
23
|
+
root = Webgen::Node.new(@website.tree.dummy_root, '/', '/')
|
24
24
|
node = Webgen::Node.new(root, '/file.html', 'file.html', {'lang' => 'en'})
|
25
25
|
dir = Webgen::Node.new(root, '/dir/', 'dir/', 'index_path' => "index.html")
|
26
26
|
file = Webgen::Node.new(dir, '/dir/file.html', 'file.html', {'lang' => 'en'})
|
@@ -34,6 +34,7 @@ class TestTagRelocatable < Test::Unit::TestCase
|
|
34
34
|
# basic node resolving
|
35
35
|
@obj.set_params('tag.relocatable.path' => 'dir/file.html')
|
36
36
|
assert_equal('dir/file.html', call(context))
|
37
|
+
assert(context.dest_node.node_info[:used_meta_info_nodes].include?(file.alcn))
|
37
38
|
@obj.set_params('tag.relocatable.path' => 'dir/other.html')
|
38
39
|
assert_equal('', call(context))
|
39
40
|
|
data/test/test_tag_tikz.rb
CHANGED
@@ -25,7 +25,7 @@ class TestTagTikZ < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_call
|
28
|
-
root = Webgen::Node.new(
|
28
|
+
root = Webgen::Node.new(@website.tree.dummy_root, '/', '/')
|
29
29
|
node = Webgen::Node.new(root, '/file.html', 'file.page')
|
30
30
|
context = Webgen::Context.new(:chain => [node])
|
31
31
|
|
@@ -55,14 +55,14 @@ class TestTagTikZ < Test::Unit::TestCase
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_run_command
|
58
|
-
root = Webgen::Node.new(
|
58
|
+
root = Webgen::Node.new(@website.tree.dummy_root, '/', '/')
|
59
59
|
context = Webgen::Context.new(:chain => [root])
|
60
60
|
assert_equal("hallo\n", @obj.send(:run_command, echo_cmd('hallo'), context))
|
61
61
|
assert_nil(@obj.send(:run_command, 'unknown_command 2>&1', context))
|
62
62
|
end
|
63
63
|
|
64
64
|
def echo_cmd(data)
|
65
|
-
(Config::CONFIG['
|
65
|
+
(Config::CONFIG['host_os'] =~ /mswin|mingw/ ? "echo #{data}" : "echo '#{data}'")
|
66
66
|
end
|
67
67
|
|
68
68
|
|
data/test/test_tree.rb
CHANGED
@@ -15,24 +15,24 @@ class TestTree < Test::Unit::TestCase
|
|
15
15
|
|
16
16
|
def test_initialize
|
17
17
|
assert_not_nil(@tree.dummy_root)
|
18
|
-
assert_equal('', @tree.dummy_root.
|
18
|
+
assert_equal('', @tree.dummy_root.alcn)
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_root
|
22
22
|
root = Webgen::Node.new(@tree.dummy_root, '/', '/')
|
23
23
|
assert_equal(root, @tree.root)
|
24
|
-
assert_equal('/', root.
|
24
|
+
assert_equal('/', root.alcn)
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_register_node_and_register_path
|
28
28
|
# Tree#register_node/_path is called when creating a node
|
29
|
-
node = Webgen::Node.new(@tree.dummy_root, '
|
30
|
-
assert_equal(node, @tree['/
|
31
|
-
assert_equal(node, @tree['/
|
32
|
-
assert_equal(node, @tree['
|
29
|
+
node = Webgen::Node.new(@tree.dummy_root, '/', '/')
|
30
|
+
assert_equal(node, @tree['/', :alcn])
|
31
|
+
assert_equal(node, @tree['/', :acn])
|
32
|
+
assert_equal(node, @tree['/', :path])
|
33
33
|
assert_raise(RuntimeError) { Webgen::Node.new(@tree.dummy_root, '/', 'dummy') }
|
34
|
-
assert_raise(RuntimeError) { Webgen::Node.new(@tree.dummy_root, 'dummy
|
35
|
-
assert_nothing_raised { Webgen::Node.new(@tree.dummy_root, '
|
34
|
+
assert_raise(RuntimeError) { Webgen::Node.new(@tree.dummy_root, 'dummy', '/') }
|
35
|
+
assert_nothing_raised { Webgen::Node.new(@tree.dummy_root, '/', 'unknown', {'no_output' => true}) }
|
36
36
|
Webgen::Node.new(@tree.dummy_root, 'new', 'new', {'no_output' => true})
|
37
37
|
assert(!@tree['new', :path])
|
38
38
|
end
|
data/test/test_website.rb
CHANGED
@@ -57,6 +57,19 @@ class TestWebsite < Test::Unit::TestCase
|
|
57
57
|
assert(ws.config['website.cache'][1].length == 0)
|
58
58
|
end
|
59
59
|
|
60
|
+
def test_render
|
61
|
+
dir = File.join(Dir.tmpdir, 'webgen-' + Process.pid.to_s)
|
62
|
+
FileUtils.mkdir_p(dir)
|
63
|
+
FileUtils.mkdir_p(File.join(dir, 'src'))
|
64
|
+
FileUtils.touch(File.join(dir, 'src', 'test.jpg'))
|
65
|
+
|
66
|
+
ws = Webgen::Website.new(dir, nil)
|
67
|
+
assert_equal(:success, ws.render)
|
68
|
+
assert_equal(:success, ws.render)
|
69
|
+
ensure
|
70
|
+
FileUtils.rm_rf(dir)
|
71
|
+
end
|
72
|
+
|
60
73
|
def test_execute_in_env
|
61
74
|
ws = Webgen::Website.new('hallo')
|
62
75
|
assert_nil(Webgen::WebsiteAccess.website)
|
@@ -110,6 +123,8 @@ class TestWebsite < Test::Unit::TestCase
|
|
110
123
|
assert(File.directory?(File.join(dir, 'out')))
|
111
124
|
ws.clean(true)
|
112
125
|
assert(!File.directory?(File.join(dir, 'out')))
|
126
|
+
ensure
|
127
|
+
FileUtils.rm_rf(dir)
|
113
128
|
end
|
114
129
|
|
115
130
|
end
|