webgen 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +870 -0
- data/Rakefile +37 -36
- data/VERSION +1 -1
- data/data/webgen/resources.yaml +2 -2
- data/data/webgen/webgui/app.rb +11 -0
- data/data/webgen/webgui/controller/main.rb +30 -26
- data/data/webgen/webgui/{view/page.xhtml → layout/default.xhtml} +8 -8
- data/data/webgen/webgui/start.rb +9 -0
- data/data/webgen/webgui/view/create_website.xhtml +6 -14
- data/data/webgen/webgui/view/manage_website.xhtml +2 -2
- data/data/webgen/website_bundles/default/README +6 -0
- data/data/webgen/website_bundles/default/src/index.page +15 -0
- data/data/webgen/{website_styles → website_bundles/style}/1024px/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/1024px/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/1024px/src/default.template +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/1024px/src/images/background.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas00/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/default.template +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/images/bg.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/images/front.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/images/menubg.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/images/menubg2.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas01/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/default.template +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/images/bg.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/images/front.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/print.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas03/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/default.template +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/bodybg.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/contbg.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/footerbg.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/gradient1.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/gradient2.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/default.template +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/blinkarrow.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/bodybg.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/contentbg.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/entrybg.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/flash.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/flash2.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/globe.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/globebottom.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/linkarrow.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/menuhover.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas05/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas05/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas05/src/default.template +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas05/src/images/bodybg.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas05/src/images/front.png +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/default.css +6 -4
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/default.template +2 -2
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/bodybg.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/boxbg.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/greypx.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/header.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/innerbg.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/leaves.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/tabs.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas07/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/browserfix.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/default.template +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/images/bodybg.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/images/sidebarbg.gif +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas08/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas08/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas08/src/default.template +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/default.template +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-black.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-green.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-orange.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-purple.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-red.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/footerbg.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-black.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-green.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-orange.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-purple.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-red.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover.jpg +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/simple/README +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/simple/src/default.css +0 -0
- data/data/webgen/{website_styles → website_bundles/style}/simple/src/default.template +0 -0
- data/data/webgen/website_skeleton/README +1 -1
- data/data/webgen/website_skeleton/config.yaml +5 -4
- data/doc/contentprocessor/blocks.page +43 -10
- data/doc/contentprocessor/builder.page +1 -1
- data/doc/contentprocessor/erb.page +12 -11
- data/doc/contentprocessor/redcloth.page +3 -1
- data/doc/extensions.page +3 -3
- data/doc/faq.page +13 -10
- data/doc/getting_started.page +12 -15
- data/doc/index.page +7 -1
- data/doc/manual.page +78 -27
- data/doc/reference_configuration.page +166 -3
- data/doc/reference_website_styles.page +28 -0
- data/doc/source/filesystem.page +39 -0
- data/doc/source/tararchive.page +40 -0
- data/doc/tag/tikz.page +2 -1
- data/doc/webgen_page_format.page +13 -12
- data/doc/website_styles.metainfo +8 -0
- data/lib/webgen/blackboard.rb +2 -2
- data/lib/webgen/cache.rb +4 -4
- data/lib/webgen/cli.rb +29 -16
- data/lib/webgen/cli/apply_command.rb +66 -0
- data/lib/webgen/cli/create_command.rb +22 -16
- data/lib/webgen/cli/utils.rb +23 -0
- data/lib/webgen/cli/webgui_command.rb +31 -16
- data/lib/webgen/configuration.rb +8 -6
- data/lib/webgen/contentprocessor.rb +4 -5
- data/lib/webgen/contentprocessor/blocks.rb +2 -0
- data/lib/webgen/contentprocessor/builder.rb +6 -3
- data/lib/webgen/contentprocessor/erb.rb +6 -3
- data/lib/webgen/contentprocessor/erubis.rb +7 -6
- data/lib/webgen/contentprocessor/haml.rb +6 -3
- data/lib/webgen/contentprocessor/rdoc.rb +0 -1
- data/lib/webgen/contentprocessor/redcloth.rb +3 -1
- data/lib/webgen/context.rb +73 -0
- data/lib/webgen/context/nodes.rb +36 -0
- data/lib/webgen/coreext.rb +3 -2
- data/lib/webgen/default_config.rb +3 -1
- data/lib/webgen/deprecated.rb +53 -0
- data/lib/webgen/node.rb +24 -19
- data/lib/webgen/output.rb +50 -7
- data/lib/webgen/page.rb +45 -36
- data/lib/webgen/path.rb +1 -1
- data/lib/webgen/source.rb +32 -4
- data/lib/webgen/source/resource.rb +3 -3
- data/lib/webgen/source/stacked.rb +1 -1
- data/lib/webgen/source/tararchive.rb +73 -0
- data/lib/webgen/sourcehandler.rb +4 -4
- data/lib/webgen/sourcehandler/base.rb +36 -24
- data/lib/webgen/sourcehandler/copy.rb +1 -1
- data/lib/webgen/sourcehandler/feed.rb +2 -2
- data/lib/webgen/sourcehandler/fragment.rb +1 -1
- data/lib/webgen/sourcehandler/metainfo.rb +15 -6
- data/lib/webgen/sourcehandler/page.rb +9 -5
- data/lib/webgen/sourcehandler/virtual.rb +44 -7
- data/lib/webgen/tag/base.rb +19 -13
- data/lib/webgen/tag/link.rb +1 -0
- data/lib/webgen/version.rb +1 -1
- data/lib/webgen/webgentask.rb +15 -13
- data/lib/webgen/website.rb +42 -11
- data/lib/webgen/websiteaccess.rb +1 -1
- data/lib/webgen/websitemanager.rb +61 -66
- data/man/man1/webgen.1 +4 -0
- data/misc/default.css +13 -0
- data/misc/default.template +1 -1
- data/misc/htmldoc.metainfo +2 -1
- data/misc/style.page +33 -0
- data/test/test_cli.rb +1 -7
- data/test/test_common_sitemap.rb +2 -2
- data/test/test_contentprocessor_blocks.rb +14 -1
- data/test/test_contentprocessor_builder.rb +3 -1
- data/test/test_contentprocessor_erb.rb +3 -2
- data/test/test_contentprocessor_erubis.rb +3 -3
- data/test/test_contentprocessor_fragments.rb +3 -3
- data/test/test_contentprocessor_haml.rb +3 -2
- data/test/test_contentprocessor_maruku.rb +3 -3
- data/test/test_contentprocessor_rdiscount.rb +1 -1
- data/test/test_contentprocessor_rdoc.rb +1 -1
- data/test/test_contentprocessor_redcloth.rb +9 -2
- data/test/test_contentprocessor_sass.rb +1 -1
- data/test/test_contentprocessor_tags.rb +1 -1
- data/test/{test_contentprocessor_context.rb → test_context.rb} +9 -7
- data/test/test_node.rb +27 -21
- data/test/test_page.rb +4 -4
- data/test/test_source_tararchive.rb +65 -0
- data/test/test_sourcehandler_fragment.rb +1 -1
- data/test/test_sourcehandler_memory.rb +6 -6
- data/test/test_sourcehandler_metainfo.rb +34 -13
- data/test/test_sourcehandler_page.rb +8 -0
- data/test/test_sourcehandler_virtual.rb +51 -12
- data/test/test_tag_breadcrumbtrail.rb +4 -4
- data/test/test_tag_coderay.rb +1 -1
- data/test/test_tag_date.rb +1 -1
- data/test/test_tag_executecommand.rb +1 -1
- data/test/test_tag_includefile.rb +3 -3
- data/test/test_tag_langbar.rb +6 -6
- data/test/test_tag_link.rb +8 -2
- data/test/test_tag_menu.rb +9 -9
- data/test/test_tag_metainfo.rb +1 -1
- data/test/test_tag_relocatable.rb +1 -1
- data/test/test_tag_sitemap.rb +1 -1
- data/test/test_tag_tikz.rb +2 -2
- data/test/test_website.rb +17 -0
- data/test/test_websitemanager.rb +16 -21
- metadata +146 -187
- data/data/webgen/website_templates/default/README +0 -6
- data/data/webgen/website_templates/default/src/index.page +0 -8
- data/data/webgen/website_templates/project/README +0 -5
- data/data/webgen/website_templates/project/src/about.page +0 -12
- data/data/webgen/website_templates/project/src/download.page +0 -15
- data/data/webgen/website_templates/project/src/features.page +0 -8
- data/data/webgen/website_templates/project/src/index.page +0 -9
- data/data/webgen/website_templates/project/src/screenshots.page +0 -18
- data/lib/webgen/contentprocessor/context.rb +0 -89
@@ -60,6 +60,14 @@ class TestSourceHandlerPage < Test::Unit::TestCase
|
|
60
60
|
@path.instance_eval { @io = Webgen::Path::SourceIO.new {StringIO.new("---\ntitle: test\n---\ncontent")} }
|
61
61
|
@website.blackboard.dispatch_msg(:node_meta_info_changed?, node)
|
62
62
|
assert(node.meta_info_changed?)
|
63
|
+
|
64
|
+
# Remove path from which node is created, meta info should naturally change
|
65
|
+
@root.tree.delete_node(node)
|
66
|
+
node = @obj.create_node(@root, @path)
|
67
|
+
@website.blackboard.del_service(:source_paths)
|
68
|
+
@website.blackboard.add_service(:source_paths) { {} }
|
69
|
+
@website.blackboard.dispatch_msg(:node_meta_info_changed?, node)
|
70
|
+
assert(node.meta_info_changed?)
|
63
71
|
end
|
64
72
|
|
65
73
|
end
|
@@ -27,32 +27,71 @@ class TestSourceHandlerVirtual < Test::Unit::TestCase
|
|
27
27
|
title: Absolute
|
28
28
|
EOF
|
29
29
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
30
|
+
def setup
|
31
|
+
super
|
32
|
+
@obj = Webgen::SourceHandler::Virtual.new
|
33
|
+
@root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
33
34
|
shm = Webgen::SourceHandler::Main.new # for using service :create_nodes
|
34
|
-
time = Time.now
|
35
|
-
|
35
|
+
@time = Time.now
|
36
|
+
@path = path_with_meta_info('/virtuals', {'modified_at' => @time}, @obj.class.name) {StringIO.new(CONTENT)}
|
37
|
+
@nodes = @obj.create_node(@root, @path)
|
38
|
+
@website.blackboard.del_service(:source_paths)
|
39
|
+
@website.blackboard.add_service(:source_paths) {{@path.path => @path}}
|
40
|
+
end
|
36
41
|
|
37
|
-
|
42
|
+
def test_create_node
|
43
|
+
@nodes.each {|n| assert_equal('/virtuals', n.node_info[:src])}
|
38
44
|
|
39
|
-
path_de = root.tree['/path.de.html']
|
40
|
-
path_en = root.tree['/directory/path.en.html']
|
41
|
-
dir = root.tree['/dir']
|
45
|
+
path_de = @root.tree['/path.de.html']
|
46
|
+
path_en = @root.tree['/directory/path.en.html']
|
47
|
+
dir = @root.tree['/dir']
|
42
48
|
assert_not_nil(path_de)
|
43
49
|
assert_not_nil(dir)
|
44
50
|
assert_not_nil(path_en)
|
45
51
|
|
46
52
|
assert_equal('new title', path_en['title'])
|
47
|
-
assert_equal(time, path_en['modified_at'])
|
53
|
+
assert_equal(@time, path_en['modified_at'])
|
48
54
|
assert(path_en['no_output'])
|
49
55
|
assert_equal('My Dir', dir['title'])
|
50
56
|
assert_equal('directory/other.html', path_de.route_to(path_en))
|
51
57
|
assert_equal('../path.de.html', dir.route_to(path_de))
|
52
58
|
assert_equal('../directory/other.html', dir.route_to(path_en))
|
53
59
|
|
54
|
-
assert_equal('http://www.example.com', root.tree['/api.html'].path)
|
55
|
-
assert_equal('http://www.example.com', root.tree['/path.de.html'].route_to(root.tree['/api.html']))
|
60
|
+
assert_equal('http://www.example.com', @root.tree['/api.html'].path)
|
61
|
+
assert_equal('http://www.example.com', @root.tree['/path.de.html'].route_to(@root.tree['/api.html']))
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_meta_info_changed
|
65
|
+
# Nothing done, nothing should have changed
|
66
|
+
path_de = @root.tree['/path.de.html']
|
67
|
+
@obj.send(:node_meta_info_changed?, path_de)
|
68
|
+
assert(!path_de.flagged?(:dirty_meta_info))
|
69
|
+
|
70
|
+
# Change data, meta info should have changed
|
71
|
+
@path.instance_eval { @io = Webgen::Path::SourceIO.new {StringIO.new("path.de.html:\n title: hallo")} }
|
72
|
+
@obj.send(:node_meta_info_changed?, path_de)
|
73
|
+
assert(path_de.flagged?(:dirty_meta_info))
|
74
|
+
|
75
|
+
# Reinit node, meta info of path_de should not change, #create_node should only return one node
|
76
|
+
path_de.flag(:reinit)
|
77
|
+
assert(1, @obj.create_node(@root, @path).length)
|
78
|
+
@obj.send(:node_meta_info_changed?, path_de)
|
79
|
+
assert(!path_de.flagged?(:dirty_meta_info))
|
80
|
+
|
81
|
+
# Remove data, meta info should have changed
|
82
|
+
@path.instance_eval { @io = Webgen::Path::SourceIO.new {StringIO.new("patha.de.html:\n title: hallo")} }
|
83
|
+
@obj.send(:node_meta_info_changed?, path_de)
|
84
|
+
assert(path_de.flagged?(:dirty_meta_info))
|
85
|
+
|
86
|
+
# Remove path from which virtual node is created, meta info should naturally change
|
87
|
+
@root.tree.delete_node(path_de)
|
88
|
+
@path.instance_eval { @io = Webgen::Path::SourceIO.new {StringIO.new("path.de.html:\n title: hallo")} }
|
89
|
+
@obj.create_node(@root, @path)
|
90
|
+
path_de = @root.tree['/path.de.html']
|
91
|
+
@website.blackboard.del_service(:source_paths)
|
92
|
+
@website.blackboard.add_service(:source_paths) { {} }
|
93
|
+
@obj.send(:node_meta_info_changed?, path_de)
|
94
|
+
assert(path_de.meta_info_changed?)
|
56
95
|
end
|
57
96
|
|
58
97
|
end
|
@@ -40,7 +40,7 @@ class TestTagBreadcrumbTrail < Test::Unit::TestCase
|
|
40
40
|
|
41
41
|
def test_call
|
42
42
|
nodes = create_default_nodes
|
43
|
-
context = Webgen::
|
43
|
+
context = Webgen::Context.new(:chain => [nodes[:file11_en]])
|
44
44
|
|
45
45
|
assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <a href="index.html">Dir11</a> / <span>File111</span>',
|
46
46
|
call(context, ' / ', false, 0, -1))
|
@@ -76,16 +76,16 @@ class TestTagBreadcrumbTrail < Test::Unit::TestCase
|
|
76
76
|
|
77
77
|
def test_node_changed
|
78
78
|
nodes = create_default_nodes
|
79
|
-
context = Webgen::
|
79
|
+
context = Webgen::Context.new(:chain => [nodes[:file11_en]])
|
80
80
|
call(context, ' / ', false, 0, -1)
|
81
81
|
|
82
82
|
nodes[:file11_en].unflag(:dirty)
|
83
83
|
@website.blackboard.dispatch_msg(:node_changed?, nodes[:file11_en])
|
84
|
-
assert(!nodes[:file11_en].flagged(:dirty))
|
84
|
+
assert(!nodes[:file11_en].flagged?(:dirty))
|
85
85
|
|
86
86
|
nodes[:index11_en].flag(:dirty_meta_info)
|
87
87
|
@website.blackboard.dispatch_msg(:node_changed?, nodes[:file11_en])
|
88
|
-
assert(nodes[:file11_en].flagged(:dirty))
|
88
|
+
assert(nodes[:file11_en].flagged?(:dirty))
|
89
89
|
end
|
90
90
|
|
91
91
|
end
|
data/test/test_tag_coderay.rb
CHANGED
@@ -23,7 +23,7 @@ class TestTagCoderay < Test::Unit::TestCase
|
|
23
23
|
|
24
24
|
def test_call
|
25
25
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/', {'title' => 'Hallo'})
|
26
|
-
context = Webgen::
|
26
|
+
context = Webgen::Context.new(:chain => [root])
|
27
27
|
|
28
28
|
assert(call(context, 'TestData', 'html', false).include?('TestData'))
|
29
29
|
assert(call(context, '{title:}', :ruby, true).include?('Hallo'))
|
data/test/test_tag_date.rb
CHANGED
@@ -12,7 +12,7 @@ class TestTagDate < Test::Unit::TestCase
|
|
12
12
|
|
13
13
|
def test_call
|
14
14
|
@obj = Webgen::Tag::Date.new
|
15
|
-
assert_not_nil(Time.parse(@obj.call('date', '', Webgen::
|
15
|
+
assert_not_nil(Time.parse(@obj.call('date', '', Webgen::Context.new)))
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
@@ -24,7 +24,7 @@ class TestTagExecuteCommand < Test::Unit::TestCase
|
|
24
24
|
|
25
25
|
def test_call
|
26
26
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
27
|
-
context = Webgen::
|
27
|
+
context = Webgen::Context.new(:chain => [root])
|
28
28
|
|
29
29
|
test_text = "a\"b\""
|
30
30
|
assert_equal([test_text, false], call(context, echo_cmd(test_text), false, false))
|
@@ -26,7 +26,7 @@ class TestTagIncludeFile < Test::Unit::TestCase
|
|
26
26
|
|
27
27
|
def test_call
|
28
28
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
29
|
-
context = Webgen::
|
29
|
+
context = Webgen::Context.new(:chain => [root])
|
30
30
|
|
31
31
|
content = "<a>This is 'a' Test</a>"
|
32
32
|
file = Tempfile.new('webgen-test-file')
|
@@ -40,11 +40,11 @@ class TestTagIncludeFile < Test::Unit::TestCase
|
|
40
40
|
|
41
41
|
root.unflag(:dirty)
|
42
42
|
@website.blackboard.dispatch_msg(:node_changed?, root)
|
43
|
-
assert(!root.flagged(:dirty))
|
43
|
+
assert(!root.flagged?(:dirty))
|
44
44
|
|
45
45
|
File.utime(Time.now + 1, Time.now + 1, file.path)
|
46
46
|
@website.blackboard.dispatch_msg(:node_changed?, root)
|
47
|
-
assert(root.flagged(:dirty))
|
47
|
+
assert(root.flagged?(:dirty))
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
data/test/test_tag_langbar.rb
CHANGED
@@ -34,28 +34,28 @@ class TestTagLangbar < Test::Unit::TestCase
|
|
34
34
|
|
35
35
|
@obj.set_params('tag.langbar.show_single_lang' => true, 'tag.langbar.show_own_lang' => true, 'tag.langbar.separator' => ' --- ')
|
36
36
|
assert_equal(["#{de_link} --- #{en_link}", false],
|
37
|
-
@obj.call('langbar', '', Webgen::
|
37
|
+
@obj.call('langbar', '', Webgen::Context.new(:chain => [nodes[:index_en]])))
|
38
38
|
|
39
39
|
@obj.set_params('tag.langbar.show_single_lang' => true, 'tag.langbar.show_own_lang' => true,
|
40
40
|
'tag.langbar.lang_names' => {'de' => 'Deutsch'})
|
41
41
|
assert_equal(["<a href=\"index.de.html\">Deutsch</a> | #{en_link}", false],
|
42
|
-
@obj.call('langbar', '', Webgen::
|
42
|
+
@obj.call('langbar', '', Webgen::Context.new(:chain => [nodes[:index_en]])))
|
43
43
|
|
44
44
|
@obj.set_params('tag.langbar.show_single_lang' => true, 'tag.langbar.show_own_lang' => true,
|
45
45
|
'tag.langbar.process_output' => true)
|
46
46
|
assert_equal(["#{de_link} | #{en_link}", true],
|
47
|
-
@obj.call('langbar', '', Webgen::
|
47
|
+
@obj.call('langbar', '', Webgen::Context.new(:chain => [nodes[:index_en]])))
|
48
48
|
|
49
49
|
nodes[:index_en].unflag(:dirty)
|
50
50
|
@website.blackboard.dispatch_msg(:node_changed?, nodes[:index_en])
|
51
|
-
assert(!nodes[:index_en].flagged(:dirty))
|
51
|
+
assert(!nodes[:index_en].flagged?(:dirty))
|
52
52
|
nodes[:index_en].tree.delete_node(nodes[:index_de])
|
53
53
|
@website.blackboard.dispatch_msg(:node_changed?, nodes[:index_en])
|
54
|
-
assert(nodes[:index_en].flagged(:dirty))
|
54
|
+
assert(nodes[:index_en].flagged?(:dirty))
|
55
55
|
end
|
56
56
|
|
57
57
|
def check_results(node, both_true, both_false, first_false, second_false)
|
58
|
-
context = Webgen::
|
58
|
+
context = Webgen::Context.new(:chain => [node])
|
59
59
|
@obj.set_params('tag.langbar.show_single_lang'=>true, 'tag.langbar.show_own_lang'=>true)
|
60
60
|
assert_equal(both_true, @obj.call('langbar', '', context).first)
|
61
61
|
|
data/test/test_tag_link.rb
CHANGED
@@ -29,13 +29,13 @@ class TestTagLink < Test::Unit::TestCase
|
|
29
29
|
dir2 = Webgen::Node.new(root, '/dir2/', 'dir2/', 'index_path' => "index.html")
|
30
30
|
Webgen::Node.new(dir2, '/dir2/index.html', 'index.html')
|
31
31
|
|
32
|
-
context = Webgen::
|
32
|
+
context = Webgen::Context.new(:chain => [node])
|
33
33
|
|
34
34
|
# no path set
|
35
35
|
node.unflag(:dirty)
|
36
36
|
@obj.set_params('tag.link.path' => nil)
|
37
37
|
assert_equal('', call(context))
|
38
|
-
assert(node.flagged(:dirty))
|
38
|
+
assert(node.flagged?(:dirty))
|
39
39
|
|
40
40
|
# invalid paths
|
41
41
|
@obj.set_params('tag.link.path' => ':/asdf=-)')
|
@@ -58,6 +58,12 @@ class TestTagLink < Test::Unit::TestCase
|
|
58
58
|
assert_equal('<a href="dir/"></a>', call(context))
|
59
59
|
@obj.set_params('tag.link.path' => 'dir2')
|
60
60
|
assert_equal('<a href="dir2/index.html"></a>', call(context))
|
61
|
+
|
62
|
+
# used node information correctly set
|
63
|
+
node.node_info[:used_meta_info_nodes] = Set.new
|
64
|
+
@obj.set_params('tag.link.path' => 'dir/file.html')
|
65
|
+
call(context)
|
66
|
+
assert(Set.new([file.absolute_lcn]), node.node_info[:used_meta_info_nodes])
|
61
67
|
end
|
62
68
|
|
63
69
|
end
|
data/test/test_tag_menu.rb
CHANGED
@@ -52,14 +52,14 @@ class TestTagMenu < Test::Unit::TestCase
|
|
52
52
|
def test_call
|
53
53
|
nodes = create_default_nodes
|
54
54
|
|
55
|
-
output = @obj.call('menu', '', Webgen::
|
55
|
+
output = @obj.call('menu', '', Webgen::Context.new(:chain => [nodes[:file11_en]]))
|
56
56
|
assert_equal("<ul><li class=\"webgen-menu-level1 webgen-menu-submenu webgen-menu-submenu-inhierarchy\"><a href=\"./\"></a>" +
|
57
57
|
"<ul><li class=\"webgen-menu-level2 webgen-menu-submenu\"><a href=\"dir11/index.en.html\"></a></li>" +
|
58
58
|
"<li class=\"webgen-menu-level2 webgen-menu-item-selected\"><span></span></li></ul></li>" +
|
59
59
|
"<li class=\"webgen-menu-level1 webgen-menu-submenu\"><a href=\"../dir2/\"></a></li>" +
|
60
60
|
"<li class=\"webgen-menu-level1 webgen-menu-submenu\"><a href=\"../dir3/\"></a></li></ul>", output)
|
61
61
|
|
62
|
-
output = @obj.call('menu', '', Webgen::
|
62
|
+
output = @obj.call('menu', '', Webgen::Context.new(:chain => [nodes[:index11_en]]))
|
63
63
|
assert_equal("<ul><li class=\"webgen-menu-level1 webgen-menu-submenu webgen-menu-submenu-inhierarchy\"><a href=\"../\"></a>" +
|
64
64
|
"<ul><li class=\"webgen-menu-level2 webgen-menu-submenu webgen-menu-submenu-inhierarchy\"><span></span>" +
|
65
65
|
"<ul><li class=\"webgen-menu-level3\"><a href=\"file111.en.html\"></a></li>" +
|
@@ -69,7 +69,7 @@ class TestTagMenu < Test::Unit::TestCase
|
|
69
69
|
"<li class=\"webgen-menu-level1 webgen-menu-submenu\"><a href=\"../../dir3/\"></a></li></ul>", output)
|
70
70
|
|
71
71
|
@obj.set_params('tag.menu.nested' => false)
|
72
|
-
output = @obj.call('menu', '', Webgen::
|
72
|
+
output = @obj.call('menu', '', Webgen::Context.new(:chain => [nodes[:index11_en]]))
|
73
73
|
@obj.set_params({})
|
74
74
|
assert_equal("<ul><li class=\"webgen-menu-level1 webgen-menu-submenu webgen-menu-submenu-inhierarchy\"><a href=\"../\"></a></li>" +
|
75
75
|
"<li class=\"webgen-menu-level1 webgen-menu-submenu\"><a href=\"../../dir2/\"></a></li>" +
|
@@ -80,28 +80,28 @@ class TestTagMenu < Test::Unit::TestCase
|
|
80
80
|
"<li class=\"webgen-menu-level3 webgen-menu-item-selected\"><span></span></li></ul>", output)
|
81
81
|
|
82
82
|
@obj.set_params('tag.menu.used_nodes' => 'fragments')
|
83
|
-
output = @obj.call('menu', '', Webgen::
|
83
|
+
output = @obj.call('menu', '', Webgen::Context.new(:chain => [nodes[:file11_en]]))
|
84
84
|
@obj.set_params({})
|
85
85
|
assert_equal("<ul><li class=\"webgen-menu-level1 webgen-menu-submenu\"><a href=\"#f1\"></a></li>" +
|
86
86
|
"<li class=\"webgen-menu-level1\"><a href=\"#f2\"></a></li></ul>", output)
|
87
87
|
|
88
88
|
@obj.set_params('tag.menu.start_level' => 5)
|
89
|
-
output = @obj.call('menu', '', Webgen::
|
89
|
+
output = @obj.call('menu', '', Webgen::Context.new(:chain => [nodes[:file11_en]]))
|
90
90
|
@obj.set_params({})
|
91
91
|
assert_equal("", output)
|
92
92
|
|
93
93
|
nodes.each {|k,v| v.unflag(:dirty)}
|
94
94
|
@website.blackboard.dispatch_msg(:node_changed?, nodes[:file11_en])
|
95
|
-
assert(!nodes[:file11_en].flagged(:dirty))
|
95
|
+
assert(!nodes[:file11_en].flagged?(:dirty))
|
96
96
|
|
97
97
|
nodes[:index11_en].flag(:dirty_meta_info)
|
98
98
|
@website.blackboard.dispatch_msg(:node_changed?, nodes[:file11_en])
|
99
|
-
assert(nodes[:file11_en].flagged(:dirty))
|
99
|
+
assert(nodes[:file11_en].flagged?(:dirty))
|
100
100
|
|
101
101
|
nodes.each {|k,v| v.unflag(:dirty)}
|
102
102
|
nodes[:file11_en_f2]['in_menu'] = false
|
103
103
|
@website.blackboard.dispatch_msg(:node_changed?, nodes[:file11_en])
|
104
|
-
assert(nodes[:file11_en].flagged(:dirty))
|
104
|
+
assert(nodes[:file11_en].flagged?(:dirty))
|
105
105
|
end
|
106
106
|
|
107
107
|
def test_menu_tree_for_lang_and_create_menu_tree
|
@@ -191,7 +191,7 @@ class TestTagMenu < Test::Unit::TestCase
|
|
191
191
|
def test_create_output_and_menu_item_details
|
192
192
|
nodes = create_default_nodes
|
193
193
|
tree = build_menu(nodes[:file111_en], [1, 2, 3, true])
|
194
|
-
context = Webgen::
|
194
|
+
context = Webgen::Context.new(:chain => [nodes[:file111_en]])
|
195
195
|
assert_equal("<ul><li class=\"webgen-menu-level1 webgen-menu-submenu webgen-menu-submenu-inhierarchy\"><a href=\"../\"></a>" +
|
196
196
|
"<ul><li class=\"webgen-menu-level2 webgen-menu-submenu webgen-menu-submenu-inhierarchy\"><a href=\"index.en.html\"></a>" +
|
197
197
|
"<ul><li class=\"webgen-menu-level3 webgen-menu-item-selected\"><span></span></li>" +
|
data/test/test_tag_metainfo.rb
CHANGED
@@ -10,7 +10,7 @@ class TestTagMetainfo < Test::Unit::TestCase
|
|
10
10
|
def test_call
|
11
11
|
@obj = Webgen::Tag::Metainfo.new
|
12
12
|
node = Webgen::Node.new(Webgen::Tree.new.dummy_root, 'hallo.page', 'hallo.page', 'test' => 10, 'lang' => 'en')
|
13
|
-
c = Webgen::
|
13
|
+
c = Webgen::Context.new(:chain => [node])
|
14
14
|
assert_equal('', @obj.call('invalid', '', c))
|
15
15
|
assert_equal('10', @obj.call('test', '', c))
|
16
16
|
assert_equal('en', @obj.call('lang', '', c))
|
@@ -29,7 +29,7 @@ class TestTagRelocatable < Test::Unit::TestCase
|
|
29
29
|
dir2 = Webgen::Node.new(root, '/dir2/', 'dir2/', 'index_path' => "index.html")
|
30
30
|
Webgen::Node.new(dir2, '/dir2/index.html', 'index.html')
|
31
31
|
|
32
|
-
context = Webgen::
|
32
|
+
context = Webgen::Context.new(:chain => [node])
|
33
33
|
|
34
34
|
# basic node resolving
|
35
35
|
@obj.set_params('tag.relocatable.path' => 'dir/file.html')
|
data/test/test_tag_sitemap.rb
CHANGED
@@ -26,7 +26,7 @@ class TestTagSitemap < Test::Unit::TestCase
|
|
26
26
|
|
27
27
|
def test_call
|
28
28
|
nodes = create_sitemap_nodes
|
29
|
-
context = Webgen::
|
29
|
+
context = Webgen::Context.new(:chain => [nodes[:file11_en]])
|
30
30
|
|
31
31
|
assert_equal("<ul><li><a href=\"./\"></a>" +
|
32
32
|
"<ul><li><span></span>"+
|
data/test/test_tag_tikz.rb
CHANGED
@@ -27,7 +27,7 @@ class TestTagTikZ < Test::Unit::TestCase
|
|
27
27
|
def test_call
|
28
28
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
29
29
|
node = Webgen::Node.new(root, '/file.html', 'file.page')
|
30
|
-
context = Webgen::
|
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
33
|
assert_equal('<img src="test.png" />', output)
|
@@ -56,7 +56,7 @@ class TestTagTikZ < Test::Unit::TestCase
|
|
56
56
|
|
57
57
|
def test_run_command
|
58
58
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
59
|
-
context = Webgen::
|
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
|
data/test/test_website.rb
CHANGED
@@ -19,6 +19,15 @@ class TestWebsite < Test::Unit::TestCase
|
|
19
19
|
assert_equal('dir', ws.directory)
|
20
20
|
assert_throws(:called) { ws.init }
|
21
21
|
assert_nil(Thread.current[:webgen_website])
|
22
|
+
|
23
|
+
ws = Webgen::Website.new
|
24
|
+
assert_equal(Dir.pwd, ws.directory)
|
25
|
+
ENV['WEBGEN_WEBSITE'] = 'hallo'
|
26
|
+
ws = Webgen::Website.new
|
27
|
+
assert_equal('hallo', ws.directory)
|
28
|
+
ENV['WEBGEN_WEBSITE'] = ''
|
29
|
+
ws = Webgen::Website.new
|
30
|
+
assert_equal(Dir.pwd, ws.directory)
|
22
31
|
end
|
23
32
|
|
24
33
|
def test_autoload_service
|
@@ -52,6 +61,14 @@ class TestWebsite < Test::Unit::TestCase
|
|
52
61
|
ws = Webgen::Website.new('hallo')
|
53
62
|
assert_nil(Webgen::WebsiteAccess.website)
|
54
63
|
ws.execute_in_env { assert_not_nil(Webgen::WebsiteAccess.website) }
|
64
|
+
assert_nil(Webgen::WebsiteAccess.website)
|
65
|
+
ws.execute_in_env do
|
66
|
+
assert_equal(ws, Webgen::WebsiteAccess.website)
|
67
|
+
ws2 = Webgen::Website.new("hallo2")
|
68
|
+
ws2.execute_in_env { assert_equal(ws2, Webgen::WebsiteAccess.website) }
|
69
|
+
assert_equal(ws, Webgen::WebsiteAccess.website)
|
70
|
+
end
|
71
|
+
assert_equal(nil, Webgen::WebsiteAccess.website)
|
55
72
|
end
|
56
73
|
|
57
74
|
def test_read_config_file
|
data/test/test_websitemanager.rb
CHANGED
@@ -10,12 +10,13 @@ class TestWebsiteManager < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
def test_initialize
|
12
12
|
wm = Webgen::WebsiteManager.new('.')
|
13
|
-
t = wm.
|
13
|
+
t = wm.bundles['default']
|
14
14
|
assert_equal('Thomas Leitner', t.author)
|
15
15
|
assert(t.paths.length > 0)
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
ws = Webgen::Website.new('.')
|
18
|
+
wm = Webgen::WebsiteManager.new(ws)
|
19
|
+
assert_equal('Thomas Leitner', wm.bundles['default'].author)
|
19
20
|
end
|
20
21
|
|
21
22
|
def test_create_website
|
@@ -29,34 +30,28 @@ class TestWebsiteManager < Test::Unit::TestCase
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
|
-
def
|
33
|
+
def test_apply_bundle
|
33
34
|
with_tmpdir do |dir|
|
34
35
|
wm = Webgen::WebsiteManager.new(dir)
|
35
|
-
assert_raise(RuntimeError) { wm.
|
36
|
+
assert_raise(RuntimeError) { wm.apply_bundle('default') }
|
36
37
|
|
37
38
|
Dir.mkdir(dir)
|
38
|
-
wm.
|
39
|
+
wm.apply_bundle('default')
|
39
40
|
assert(File.directory?(File.join(dir, 'src')))
|
40
41
|
assert(File.file?(File.join(dir, 'src', 'index.page')))
|
41
42
|
|
42
|
-
assert_raise(ArgumentError) { wm.
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_apply_style
|
47
|
-
dir = with_tmpdir
|
48
|
-
wm = Webgen::WebsiteManager.new(dir)
|
49
|
-
assert_raise(RuntimeError) { wm.apply_style('simple') }
|
43
|
+
assert_raise(ArgumentError) { wm.apply_bundle('unknown-bundle') }
|
50
44
|
|
51
|
-
wm.styles.each do |name, infos|
|
52
|
-
Dir.mkdir(dir)
|
53
|
-
wm.apply_style(name)
|
54
|
-
assert(File.directory?(File.join(dir, 'src')))
|
55
|
-
assert(File.file?(File.join(dir, 'src', 'default.template')))
|
56
|
-
assert(File.file?(File.join(dir, 'src', 'default.css')))
|
57
45
|
FileUtils.rm_rf(dir)
|
46
|
+
wm.bundles.select {|n,i| n =~ /^style-/}.each do |name, infos|
|
47
|
+
Dir.mkdir(dir)
|
48
|
+
wm.apply_bundle(name)
|
49
|
+
assert(File.directory?(File.join(dir, 'src')))
|
50
|
+
assert(File.file?(File.join(dir, 'src', 'default.template')))
|
51
|
+
assert(File.file?(File.join(dir, 'src', 'default.css')))
|
52
|
+
FileUtils.rm_rf(dir)
|
53
|
+
end
|
58
54
|
end
|
59
|
-
assert_raise(ArgumentError) { wm.apply_style('unknown-style') }
|
60
55
|
end
|
61
56
|
|
62
57
|
def with_tmpdir
|