gettalong-webgen 0.5.7.20090227 → 0.5.8.20090507
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +37 -36
- 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 +181 -171
- 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
data/test/test_common_sitemap.rb
CHANGED
@@ -48,11 +48,11 @@ class TestCommonSitemap < Test::Unit::TestCase
|
|
48
48
|
|
49
49
|
@nodes[:file11_en].unflag(:dirty)
|
50
50
|
@website.blackboard.dispatch_msg(:node_changed?, @nodes[:file11_en])
|
51
|
-
assert(!@nodes[:file11_en].flagged(:dirty))
|
51
|
+
assert(!@nodes[:file11_en].flagged?(:dirty))
|
52
52
|
|
53
53
|
@nodes[:file11_en].flag(:dirty_meta_info)
|
54
54
|
@website.blackboard.dispatch_msg(:node_changed?, @nodes[:file11_en])
|
55
|
-
assert(@nodes[:file11_en].flagged(:dirty))
|
55
|
+
assert(@nodes[:file11_en].flagged?(:dirty))
|
56
56
|
end
|
57
57
|
|
58
58
|
end
|
@@ -16,12 +16,16 @@ class TestContentProcessorBlocks < Test::Unit::TestCase
|
|
16
16
|
template.node_info[:page] = Webgen::Page.from_data("--- name:content pipeline:blocks\nbefore<webgen:block name='content' />after")
|
17
17
|
processors = { 'blocks' => obj }
|
18
18
|
|
19
|
-
context = Webgen::
|
19
|
+
context = Webgen::Context.new(:chain => [node], :processors => processors)
|
20
20
|
context.content = '<webgen:block name="content" /><webgen:block name="content" chain="template;test" />'
|
21
21
|
obj.call(context)
|
22
22
|
assert_equal('databeforedataafter', context.content)
|
23
23
|
assert_equal(Set.new([node.absolute_lcn, template.absolute_lcn]), node.node_info[:used_nodes])
|
24
24
|
|
25
|
+
context.content = '<webgen:block name="content" node="next" /><webgen:block name="content" chain="template;test" />'
|
26
|
+
obj.call(context)
|
27
|
+
assert_equal('databeforedataafter', context.content)
|
28
|
+
|
25
29
|
context.content = '<webgen:block name="nothing"/>'
|
26
30
|
assert_raise(RuntimeError) { obj.call(context) }
|
27
31
|
|
@@ -50,6 +54,15 @@ class TestContentProcessorBlocks < Test::Unit::TestCase
|
|
50
54
|
context.content = '<webgen:block name="invalid" node="first" notfound="ignore" /><webgen:block name="content" />'
|
51
55
|
obj.call(context)
|
52
56
|
assert_equal('beforedataafter', context.content)
|
57
|
+
|
58
|
+
context[:chain] = [node, template]
|
59
|
+
context.content = '<webgen:block name="other" node="current" />'
|
60
|
+
obj.call(context)
|
61
|
+
assert_equal('other', context.content)
|
62
|
+
|
63
|
+
context.content = '<webgen:block name="other" node="current" chain="template"/>'
|
64
|
+
obj.call(context)
|
65
|
+
assert_equal('other', context.content)
|
53
66
|
end
|
54
67
|
|
55
68
|
end
|
@@ -10,7 +10,9 @@ class TestContentProcessorBuilder < Test::Unit::TestCase
|
|
10
10
|
obj = Webgen::ContentProcessor::Builder.new
|
11
11
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
12
12
|
node = Webgen::Node.new(root, 'test', 'test')
|
13
|
-
|
13
|
+
content = "xml.div(:path => context.node.absolute_lcn) { xml.strong('test'); " +
|
14
|
+
"context.website; context; context.ref_node; context.dest_node }"
|
15
|
+
context = Webgen::Context.new(:content => content,
|
14
16
|
:chain => [node])
|
15
17
|
assert_equal("<div path=\"/test\">\n <strong>test</strong>\n</div>\n", obj.call(context).content)
|
16
18
|
|
@@ -10,10 +10,11 @@ class TestContentProcessorErb < Test::Unit::TestCase
|
|
10
10
|
obj = Webgen::ContentProcessor::Erb.new
|
11
11
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
12
12
|
node = Webgen::Node.new(root, 'test', 'test')
|
13
|
-
|
13
|
+
content = "<%= context[:doit] %>6\n<%= context.ref_node.absolute_lcn %>\n<%= context.node.absolute_lcn %>\n<%= context.dest_node.absolute_lcn %><% website %>"
|
14
|
+
context = Webgen::Context.new(:content => content, :doit => 'hallo',
|
14
15
|
:chain => [node])
|
15
16
|
obj.call(context)
|
16
|
-
assert_equal(
|
17
|
+
assert_equal("hallo6\n/test\n/test\n/test", context.content)
|
17
18
|
|
18
19
|
context.content = '<%= 5* %>'
|
19
20
|
assert_raise(RuntimeError) { obj.call(context) }
|
@@ -15,10 +15,10 @@ class TestContentProcessorErubis < Test::Unit::TestCase
|
|
15
15
|
obj = Webgen::ContentProcessor::Erubis.new
|
16
16
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
17
17
|
node = Webgen::Node.new(root, 'test', 'test')
|
18
|
-
context = Webgen::
|
18
|
+
context = Webgen::Context.new(:doit => 'hallo', :chain => [node])
|
19
19
|
|
20
|
-
context.content =
|
21
|
-
assert_equal(
|
20
|
+
context.content = "<%= context[:doit] %>6\n<%= context.ref_node.absolute_lcn %>\n<%= context.node.absolute_lcn %>\n<%= context.dest_node.absolute_lcn %><% context.website %>"
|
21
|
+
assert_equal("hallo6\n/test\n/test\n/test", obj.call(context).content)
|
22
22
|
|
23
23
|
context.content = '<%= 5* %>'
|
24
24
|
assert_raise(RuntimeError) { obj.call(context) }
|
@@ -20,20 +20,20 @@ class TestContentProcessorFragments < Test::Unit::TestCase
|
|
20
20
|
root.node_info[:src] = '/'
|
21
21
|
processors = { 'fragments' => obj }
|
22
22
|
|
23
|
-
context = Webgen::
|
23
|
+
context = Webgen::Context.new(:chain => [root], :processors => processors)
|
24
24
|
context.content = '<h1 id="test">Test</h1><h1>Test2</h1>'
|
25
25
|
obj.call(context)
|
26
26
|
assert(root.tree['/#test'])
|
27
27
|
assert_equal(3, root.tree.node_access[:alcn].length)
|
28
28
|
root.tree.delete_node('/#test')
|
29
29
|
|
30
|
-
context[:block] = Webgen::Block.new('content', '', {})
|
30
|
+
context[:block] = Webgen::Page::Block.new('content', '', {})
|
31
31
|
obj.call(context)
|
32
32
|
assert(root.tree['/#test'])
|
33
33
|
assert_equal(3, root.tree.node_access[:alcn].length)
|
34
34
|
root.tree.delete_node('/#test')
|
35
35
|
|
36
|
-
context[:block] = Webgen::Block.new('other', '', {})
|
36
|
+
context[:block] = Webgen::Page::Block.new('other', '', {})
|
37
37
|
obj.call(context)
|
38
38
|
assert(!root.tree['/#test'])
|
39
39
|
assert_equal(2, root.tree.node_access[:alcn].length)
|
@@ -10,10 +10,11 @@ class TestContentProcessorHaml < Test::Unit::TestCase
|
|
10
10
|
obj = Webgen::ContentProcessor::Haml.new
|
11
11
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
12
12
|
node = Webgen::Node.new(root, 'test', 'test')
|
13
|
-
|
13
|
+
content = "#content\n %h1 Hallo\n = [context.node.absolute_lcn, context.ref_node.absolute_lcn, context.dest_node.absolute_lcn, context.website, context.dest_node.absolute_lcn].join"
|
14
|
+
context = Webgen::Context.new(:content => content,
|
14
15
|
:chain => [node])
|
15
16
|
obj.call(context)
|
16
|
-
assert_equal("<div id='content'>\n <h1>Hallo</h1>\n /test\n</div>\n", context.content)
|
17
|
+
assert_equal("<div id='content'>\n <h1>Hallo</h1>\n /test/test/test/test\n</div>\n", context.content)
|
17
18
|
|
18
19
|
context.content = "#cont\n = unknown"
|
19
20
|
assert_raise(RuntimeError) { obj.call(context) }
|
@@ -10,7 +10,7 @@ class TestContentProcessorMaruku < Test::Unit::TestCase
|
|
10
10
|
def test_call
|
11
11
|
@obj = Webgen::ContentProcessor::Maruku.new
|
12
12
|
node = Webgen::Node.new(Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/'), 'test', 'test')
|
13
|
-
context = Webgen::
|
13
|
+
context = Webgen::Context.new(:content => '# header', :chain => [node])
|
14
14
|
assert_equal('<h1 id=\'header\'>header</h1>', @obj.call(context).content)
|
15
15
|
|
16
16
|
context.content = "# head*d* {#das .dsaf "
|
@@ -19,10 +19,10 @@ class TestContentProcessorMaruku < Test::Unit::TestCase
|
|
19
19
|
|
20
20
|
def test_call_fix_for_invalid_id
|
21
21
|
@obj = Webgen::ContentProcessor::Maruku.new
|
22
|
-
context = Webgen::
|
22
|
+
context = Webgen::Context.new(:content => '# `test`')
|
23
23
|
assert_equal('<h1 id=\'id1\'><code>test</code></h1>', @obj.call(context).content)
|
24
24
|
|
25
|
-
context = Webgen::
|
25
|
+
context = Webgen::Context.new(:content => '# `test`')
|
26
26
|
assert_equal('<h1 id=\'id1\'><code>test</code></h1>', @obj.call(context).content)
|
27
27
|
end
|
28
28
|
|
@@ -10,7 +10,7 @@ class TestContentProcessorRDiscount < Test::Unit::TestCase
|
|
10
10
|
def test_call
|
11
11
|
@obj = Webgen::ContentProcessor::RDiscount.new
|
12
12
|
node = Webgen::Node.new(Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/'), 'test', 'test')
|
13
|
-
context = Webgen::
|
13
|
+
context = Webgen::Context.new(:content => '# header', :chain => [node])
|
14
14
|
assert_equal("<h1>header</h1>\n", @obj.call(context).content)
|
15
15
|
end
|
16
16
|
|
@@ -10,7 +10,7 @@ class TestContentProcessorRDoc < Test::Unit::TestCase
|
|
10
10
|
obj = Webgen::ContentProcessor::RDoc.new
|
11
11
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
12
12
|
node = Webgen::Node.new(root, 'test', 'test')
|
13
|
-
context = Webgen::
|
13
|
+
context = Webgen::Context.new(:content => "* hello",
|
14
14
|
:chain => [node])
|
15
15
|
assert_equal("<ul>\n<li>hello\n\n</li>\n</ul>\n", obj.call(context).content)
|
16
16
|
end
|
@@ -1,15 +1,22 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
|
+
require 'helper'
|
4
5
|
require 'webgen/websiteaccess'
|
5
6
|
require 'webgen/contentprocessor'
|
6
7
|
|
7
8
|
class TestContentProcessorRedCloth < Test::Unit::TestCase
|
8
9
|
|
10
|
+
include Test::WebsiteHelper
|
11
|
+
|
9
12
|
def test_call
|
10
13
|
@obj = Webgen::ContentProcessor::RedCloth.new
|
11
|
-
context = Webgen::
|
12
|
-
assert_equal(
|
14
|
+
context = Webgen::Context.new(:content => "h1. header\n\nthis\nis\nsome\ntext")
|
15
|
+
assert_equal("<h1>header</h1>\n<p>this\nis\nsome\ntext</p>", @obj.call(context).content)
|
16
|
+
|
17
|
+
context.content = "h1. header\n\nthis\nis\nsome\ntext"
|
18
|
+
@website.config['contentprocessor.redcloth.hard_breaks'] = true
|
19
|
+
assert_equal("<h1>header</h1>\n<p>this<br />\nis<br />\nsome<br />\ntext</p>", @obj.call(context).content)
|
13
20
|
end
|
14
21
|
|
15
22
|
end
|
@@ -10,7 +10,7 @@ class TestContentProcessorSass < Test::Unit::TestCase
|
|
10
10
|
obj = Webgen::ContentProcessor::Sass.new
|
11
11
|
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
12
12
|
node = Webgen::Node.new(root, 'test', 'test')
|
13
|
-
context = Webgen::
|
13
|
+
context = Webgen::Context.new(:content => "#main\n :background-color #000",
|
14
14
|
:chain => [node])
|
15
15
|
obj.call(context)
|
16
16
|
assert_equal("#main {\n background-color: #000; }\n", context.content)
|
@@ -35,7 +35,7 @@ class TestContentProcessorTags < Test::Unit::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_call
|
38
|
-
context = Webgen::
|
38
|
+
context = Webgen::Context.new(:chain => [Webgen::Tree.new.dummy_root])
|
39
39
|
context.content = "{test: }"
|
40
40
|
assert_equal('', @obj.call(context).content)
|
41
41
|
|
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
require 'helper'
|
5
|
-
require 'webgen/
|
5
|
+
require 'webgen/context'
|
6
6
|
|
7
|
-
class
|
7
|
+
class TestContext < Test::Unit::TestCase
|
8
8
|
|
9
9
|
def setup
|
10
|
-
@context = Webgen::
|
10
|
+
@context = Webgen::Context.new(:content => 'test', :key => :value, :chain => [:first, :last])
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_initialize
|
14
|
-
context = Webgen::
|
14
|
+
context = Webgen::Context.new
|
15
15
|
assert_equal('', context.content)
|
16
16
|
assert_kind_of(Webgen::ContentProcessor::AccessHash, context[:processors])
|
17
17
|
end
|
@@ -27,11 +27,13 @@ class TestContentProcessorContext < Test::Unit::TestCase
|
|
27
27
|
assert_equal(:value, @context[:key])
|
28
28
|
assert_equal([:first, :last], @context[:chain])
|
29
29
|
assert_equal('test', @context.content)
|
30
|
-
assert_equal(:first, @context.ref_node)
|
31
|
-
assert_equal(:last, @context.content_node)
|
32
|
-
assert_equal(:value, @context[:key])
|
33
30
|
@context[:key] = :newvalue
|
34
31
|
assert_equal(:newvalue, @context[:key])
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_node_methods
|
35
|
+
assert_equal(:first, @context.ref_node)
|
36
|
+
assert_equal(:last, @context.content_node)
|
35
37
|
assert_equal(:last, @context.dest_node)
|
36
38
|
@context[:dest_node] = :other
|
37
39
|
assert_equal(:other, @context.dest_node)
|
data/test/test_node.rb
CHANGED
@@ -42,8 +42,8 @@ class TestNode < Test::Unit::TestCase
|
|
42
42
|
assert_equal(alcn, node.absolute_lcn)
|
43
43
|
assert_equal(lang, node.lang)
|
44
44
|
assert_kind_of(Webgen::Language, node.lang) if node.lang
|
45
|
-
assert(node.flagged(:dirty))
|
46
|
-
assert(node.flagged(:created))
|
45
|
+
assert(node.flagged?(:dirty))
|
46
|
+
assert(node.flagged?(:created))
|
47
47
|
assert_equal(mi, node.meta_info)
|
48
48
|
assert_equal({:used_nodes => Set.new, :used_meta_info_nodes => Set.new}, node.node_info)
|
49
49
|
mi.each {|k,v| assert_equal(v, node[k])}
|
@@ -86,18 +86,18 @@ class TestNode < Test::Unit::TestCase
|
|
86
86
|
|
87
87
|
def test_flags
|
88
88
|
node = Webgen::Node.new(@tree.dummy_root, 'test/', 'test', {'lang' => 'de', :test => :value})
|
89
|
-
assert(node.flagged(:created))
|
90
|
-
assert(node.flagged(:dirty))
|
89
|
+
assert(node.flagged?(:created))
|
90
|
+
assert(node.flagged?(:dirty))
|
91
91
|
node.unflag(:dirty)
|
92
|
-
assert(!node.flagged(:dirty))
|
92
|
+
assert(!node.flagged?(:dirty))
|
93
93
|
node.flag(:a, :b, :c)
|
94
|
-
assert(node.flagged(:a))
|
95
|
-
assert(node.flagged(:b))
|
96
|
-
assert(node.flagged(:c))
|
94
|
+
assert(node.flagged?(:a))
|
95
|
+
assert(node.flagged?(:b))
|
96
|
+
assert(node.flagged?(:c))
|
97
97
|
node.unflag(:a, :b, :c)
|
98
|
-
assert(!node.flagged(:a))
|
99
|
-
assert(!node.flagged(:b))
|
100
|
-
assert(!node.flagged(:c))
|
98
|
+
assert(!node.flagged?(:a))
|
99
|
+
assert(!node.flagged?(:b))
|
100
|
+
assert(!node.flagged?(:c))
|
101
101
|
end
|
102
102
|
|
103
103
|
def test_in_lang
|
@@ -166,22 +166,34 @@ class TestNode < Test::Unit::TestCase
|
|
166
166
|
|
167
167
|
def test_changed
|
168
168
|
node = Webgen::Node.new(@tree.dummy_root, 'test/', 'test', {'lang' => 'de', :test => :value})
|
169
|
-
node.unflag(:dirty, :created)
|
169
|
+
node.unflag(:dirty, :dirty_meta_info, :created)
|
170
170
|
|
171
171
|
calls = 0
|
172
172
|
@website.blackboard.add_listener(:node_changed?) {|n| assert(node, n); node.flag(:dirty); calls += 1}
|
173
|
-
node.changed?
|
173
|
+
assert(node.changed?)
|
174
174
|
assert_equal(1, calls)
|
175
|
-
node.changed?
|
175
|
+
assert(node.changed?)
|
176
176
|
assert_equal(1, calls)
|
177
177
|
|
178
|
+
# Test :used_nodes array checking
|
178
179
|
node.unflag(:dirty)
|
179
180
|
node.node_info[:used_nodes] << node.absolute_lcn
|
180
181
|
node.node_info[:used_nodes] << 'unknown alcn'
|
181
182
|
node.node_info[:used_nodes] << @tree.dummy_root.absolute_lcn
|
182
|
-
node.changed?
|
183
|
+
assert(node.changed?)
|
183
184
|
assert_equal(1, calls)
|
184
185
|
|
186
|
+
# Test :used_nodes array checking
|
187
|
+
node.unflag(:dirty)
|
188
|
+
node.node_info[:used_nodes] = Set.new
|
189
|
+
node.node_info[:used_meta_info_nodes] << node.absolute_lcn
|
190
|
+
assert(node.changed?)
|
191
|
+
assert_equal(2, calls)
|
192
|
+
node.unflag(:dirty)
|
193
|
+
node.node_info[:used_meta_info_nodes] << 'unknown alcn'
|
194
|
+
assert(node.changed?)
|
195
|
+
assert_equal(2, calls)
|
196
|
+
|
185
197
|
# Test circular depdendence
|
186
198
|
other_node = Webgen::Node.new(@tree.dummy_root, '/other', 'test.l', {'lang' => 'de', :test => :value})
|
187
199
|
other_node.flag(:dirty, :created)
|
@@ -201,12 +213,6 @@ class TestNode < Test::Unit::TestCase
|
|
201
213
|
assert_equal(1, calls)
|
202
214
|
assert(node.meta_info_changed?)
|
203
215
|
assert_equal(1, calls)
|
204
|
-
|
205
|
-
node.unflag(:dirty_meta_info)
|
206
|
-
node.node_info[:used_meta_info_nodes] << node.absolute_lcn
|
207
|
-
node.node_info[:used_meta_info_nodes] << 'unknown alcn'
|
208
|
-
assert(node.meta_info_changed?)
|
209
|
-
assert_equal(1, calls)
|
210
216
|
end
|
211
217
|
|
212
218
|
def test_method_missing
|
data/test/test_page.rb
CHANGED
@@ -6,7 +6,7 @@ require 'webgen/page'
|
|
6
6
|
class TestBlock < Test::Unit::TestCase
|
7
7
|
|
8
8
|
def test_render
|
9
|
-
block = Webgen::Block.new('content', 'some content', {'pipeline' => 'test'})
|
9
|
+
block = Webgen::Page::Block.new('content', 'some content', {'pipeline' => 'test'})
|
10
10
|
context = {:processors => {}}
|
11
11
|
assert_raise(RuntimeError) { block.render(context) }
|
12
12
|
context[:processors]['test'] = lambda {|context| context[:content] = context[:content].reverse + context[:block].name }
|
@@ -161,12 +161,12 @@ EOF
|
|
161
161
|
def test_invalid_pagefiles
|
162
162
|
testdata = YAML::load(INVALID_MI)
|
163
163
|
testdata.each_with_index do |data, index|
|
164
|
-
assert_raise(Webgen::
|
165
|
-
assert_raise(Webgen::
|
164
|
+
assert_raise(Webgen::Page::FormatError, "test mi item #{index}") { Webgen::Page.from_data(data) }
|
165
|
+
assert_raise(Webgen::Page::FormatError, "test mi item #{index}") { Webgen::Page.meta_info_from_data(data) }
|
166
166
|
end
|
167
167
|
testdata = YAML::load(INVALID_BLOCKS)
|
168
168
|
testdata.each_with_index do |data, index|
|
169
|
-
assert_raise(Webgen::
|
169
|
+
assert_raise(Webgen::Page::FormatError, "test blocks item #{index}") { Webgen::Page.from_data(data) }
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'helper'
|
5
|
+
require 'webgen/source'
|
6
|
+
|
7
|
+
class TestSourceTarArchive < Test::Unit::TestCase
|
8
|
+
|
9
|
+
class FakeStream
|
10
|
+
|
11
|
+
def open
|
12
|
+
require 'stringio'
|
13
|
+
sio = StringIO.new
|
14
|
+
stream = Archive::Tar::Minitar::Writer.new(sio)
|
15
|
+
stream.mkdir('/test', :mtime => (Time.now - 5).to_i, :mode => 0100755)
|
16
|
+
stream.add_file('/test/hallo.page', :mtime => (Time.now - 4).to_i, :mode => 0100644) do |os, opts|
|
17
|
+
os.write('This is the contents!')
|
18
|
+
end
|
19
|
+
stream.add_file('/other.page', :mtime => (Time.now - 4).to_i, :mode => 0100644) do |os, opts|
|
20
|
+
os.write('This is other content!')
|
21
|
+
end
|
22
|
+
sio.rewind
|
23
|
+
sio
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
include Test::WebsiteHelper
|
29
|
+
|
30
|
+
def setup
|
31
|
+
super
|
32
|
+
@website = Webgen::Website.new(File.join(File.dirname(__FILE__), '..'), nil)
|
33
|
+
@website.init
|
34
|
+
Thread.current[:webgen_website] = @website
|
35
|
+
@stream = FakeStream.new
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_initialize
|
39
|
+
source = Webgen::Source::TarArchive.new(@stream)
|
40
|
+
assert_equal(@stream, source.uri)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_paths
|
44
|
+
source = Webgen::Source::TarArchive.new(@stream)
|
45
|
+
assert_equal(3, source.paths.length)
|
46
|
+
assert(source.paths.include?(Webgen::Path.new('/test/')))
|
47
|
+
assert(source.paths.include?(Webgen::Path.new('/test/hallo.page')))
|
48
|
+
assert_equal('This is the contents!', source.paths.find {|p| p.path == '/test/hallo.page'}.io.data)
|
49
|
+
|
50
|
+
source = Webgen::Source::TarArchive.new(@stream, '/test/*')
|
51
|
+
assert_equal(1, source.paths.length)
|
52
|
+
assert(source.paths.include?(Webgen::Path.new('/test/hallo.page')))
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_path_changed?
|
56
|
+
stream = @stream
|
57
|
+
source = Webgen::Source::TarArchive.new(stream)
|
58
|
+
source.paths.each do |path|
|
59
|
+
assert(!path.changed?)
|
60
|
+
@website.cache.instance_eval { @old_data[[:tararchive_path, stream, path.path]] = Time.now - 60 }
|
61
|
+
assert(path.changed?)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|