webgen 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/Rakefile +32 -2
  2. data/VERSION +1 -1
  3. data/doc/contentprocessor.template +10 -0
  4. data/doc/contentprocessor/blocks.page +67 -0
  5. data/doc/contentprocessor/builder.page +80 -0
  6. data/doc/contentprocessor/erb.page +51 -33
  7. data/doc/contentprocessor/haml.page +47 -0
  8. data/doc/contentprocessor/maruku.page +41 -0
  9. data/doc/contentprocessor/rdoc.page +36 -0
  10. data/doc/contentprocessor/redcloth.page +40 -0
  11. data/doc/contentprocessor/sass.page +32 -0
  12. data/doc/contentprocessor/tags.page +56 -44
  13. data/doc/extensions.metainfo +29 -0
  14. data/doc/extensions.page +15 -4
  15. data/doc/extensions.template +17 -0
  16. data/doc/reference_configuration.page +242 -5
  17. data/doc/reference_metainfo.page +9 -0
  18. data/doc/sourcehandler.template +21 -0
  19. data/doc/sourcehandler/copy.page +20 -0
  20. data/doc/sourcehandler/directory.page +27 -0
  21. data/doc/sourcehandler/metainfo.page +38 -115
  22. data/doc/sourcehandler/page.page +9 -27
  23. data/doc/sourcehandler/template.page +45 -0
  24. data/doc/sourcehandler/virtual.page +49 -0
  25. data/doc/tag.template +26 -0
  26. data/doc/tag/breadcrumbtrail.page +32 -0
  27. data/doc/tag/coderay.page +49 -0
  28. data/doc/tag/date.page +31 -0
  29. data/doc/tag/executecommand.page +26 -0
  30. data/doc/tag/includefile.page +32 -0
  31. data/doc/tag/langbar.page +22 -0
  32. data/doc/tag/menu.page +90 -0
  33. data/doc/tag/metainfo.page +29 -0
  34. data/doc/tag/relocatable.page +38 -0
  35. data/doc/webgen_page_format.page +2 -2
  36. data/lib/webgen/cli/utils.rb +1 -1
  37. data/lib/webgen/contentprocessor.rb +5 -0
  38. data/lib/webgen/contentprocessor/builder.rb +26 -0
  39. data/lib/webgen/contentprocessor/context.rb +4 -0
  40. data/lib/webgen/contentprocessor/erb.rb +24 -0
  41. data/lib/webgen/contentprocessor/haml.rb +25 -0
  42. data/lib/webgen/contentprocessor/maruku.rb +1 -1
  43. data/lib/webgen/contentprocessor/rdoc.rb +17 -0
  44. data/lib/webgen/contentprocessor/sass.rb +18 -0
  45. data/lib/webgen/default_config.rb +41 -10
  46. data/lib/webgen/node.rb +3 -2
  47. data/lib/webgen/path.rb +8 -1
  48. data/lib/webgen/sourcehandler.rb +15 -10
  49. data/lib/webgen/sourcehandler/page.rb +9 -1
  50. data/lib/webgen/tag.rb +6 -0
  51. data/lib/webgen/tag/breadcrumbtrail.rb +39 -0
  52. data/lib/webgen/tag/coderay.rb +32 -0
  53. data/lib/webgen/tag/date.rb +18 -0
  54. data/lib/webgen/tag/executecommand.rb +26 -0
  55. data/lib/webgen/tag/includefile.rb +42 -0
  56. data/lib/webgen/tag/langbar.rb +24 -0
  57. data/lib/webgen/tag/metainfo.rb +1 -1
  58. data/lib/webgen/version.rb +1 -1
  59. data/lib/webgen/webgentask.rb +5 -10
  60. data/misc/default.css +19 -0
  61. data/misc/default.template +3 -1
  62. data/misc/htmldoc.metainfo +3 -0
  63. data/misc/htmldoc.virtual +1 -1
  64. data/test/test_contentprocessor_builder.rb +19 -0
  65. data/test/test_contentprocessor_erb.rb +20 -0
  66. data/test/test_contentprocessor_haml.rb +20 -0
  67. data/test/test_contentprocessor_rdoc.rb +16 -0
  68. data/test/test_contentprocessor_sass.rb +20 -0
  69. data/test/test_node.rb +6 -2
  70. data/test/test_path.rb +5 -0
  71. data/test/test_sourcehandler_page.rb +8 -0
  72. data/test/test_tag_breadcrumbtrail.rb +78 -0
  73. data/test/test_tag_coderay.rb +30 -0
  74. data/test/test_tag_date.rb +16 -0
  75. data/test/test_tag_executecommand.rb +40 -0
  76. data/test/test_tag_includefile.rb +48 -0
  77. data/test/test_tag_langbar.rb +53 -0
  78. data/test/test_tag_menu.rb +1 -1
  79. data/test/test_webgentask.rb +21 -0
  80. metadata +81 -2
@@ -1,4 +1,7 @@
1
1
  --- name:alcn
2
+ /index.en.html:
3
+ routed_title: Documentation
4
+
2
5
  index.*.html:
3
6
  in_menu: true
4
7
  sort_info: 10
@@ -1,5 +1,5 @@
1
1
  api.html:
2
2
  url: rdoc/index.html
3
- title: API doc
3
+ title: API
4
4
  in_menu: true
5
5
  sort_info: 60
@@ -0,0 +1,19 @@
1
+ require 'test/unit'
2
+ require 'webgen/tree'
3
+ require 'webgen/contentprocessor'
4
+
5
+ class TestContentProcessorBuilder < Test::Unit::TestCase
6
+
7
+ def test_call
8
+ obj = Webgen::ContentProcessor::Builder.new
9
+ root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
10
+ node = Webgen::Node.new(root, 'test', 'test')
11
+ context = Webgen::ContentProcessor::Context.new(:content => "xml.div(:path => node.absolute_lcn) { xml.strong('test') }",
12
+ :chain => [node])
13
+ assert_equal("<div path=\"/test\">\n <strong>test</strong>\n</div>\n", obj.call(context).content)
14
+
15
+ context.content = 'raise "bla"'
16
+ assert_raise(RuntimeError) { obj.call(context).content }
17
+ end
18
+
19
+ end
@@ -0,0 +1,20 @@
1
+ require 'test/unit'
2
+ require 'webgen/tree'
3
+ require 'webgen/contentprocessor'
4
+
5
+ class TestContentProcessorErb < Test::Unit::TestCase
6
+
7
+ def test_call
8
+ obj = Webgen::ContentProcessor::Erb.new
9
+ root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
10
+ node = Webgen::Node.new(root, 'test', 'test')
11
+ context = Webgen::ContentProcessor::Context.new(:content => '<%= context[:doit] %>6', :doit => 'hallo',
12
+ :chain => [node])
13
+ obj.call(context)
14
+ assert_equal('hallo6', context.content)
15
+
16
+ context.content = '<%= 5* %>'
17
+ assert_raise(RuntimeError) { obj.call(context) }
18
+ end
19
+
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'test/unit'
2
+ require 'webgen/tree'
3
+ require 'webgen/contentprocessor'
4
+
5
+ class TestContentProcessorHaml < Test::Unit::TestCase
6
+
7
+ def test_call
8
+ obj = Webgen::ContentProcessor::Haml.new
9
+ root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
10
+ node = Webgen::Node.new(root, 'test', 'test')
11
+ context = Webgen::ContentProcessor::Context.new(:content => "#content\n %h1 Hallo\n = node.absolute_lcn",
12
+ :chain => [node])
13
+ obj.call(context)
14
+ assert_equal("<div id='content'>\n <h1>Hallo</h1>\n /test\n</div>\n", context.content)
15
+
16
+ context.content = "#cont\n = unknown"
17
+ assert_raise(RuntimeError) { obj.call(context) }
18
+ end
19
+
20
+ end
@@ -0,0 +1,16 @@
1
+ require 'test/unit'
2
+ require 'webgen/tree'
3
+ require 'webgen/contentprocessor'
4
+
5
+ class TestContentProcessorRDoc < Test::Unit::TestCase
6
+
7
+ def test_call
8
+ obj = Webgen::ContentProcessor::RDoc.new
9
+ root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
10
+ node = Webgen::Node.new(root, 'test', 'test')
11
+ context = Webgen::ContentProcessor::Context.new(:content => "* hello",
12
+ :chain => [node])
13
+ assert_equal("<ul>\n<li>hello\n\n</li>\n</ul>\n", obj.call(context).content)
14
+ end
15
+
16
+ end
@@ -0,0 +1,20 @@
1
+ require 'test/unit'
2
+ require 'webgen/tree'
3
+ require 'webgen/contentprocessor'
4
+
5
+ class TestContentProcessorSass < Test::Unit::TestCase
6
+
7
+ def test_call
8
+ obj = Webgen::ContentProcessor::Sass.new
9
+ root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
10
+ node = Webgen::Node.new(root, 'test', 'test')
11
+ context = Webgen::ContentProcessor::Context.new(:content => "#main\n :background-color #000",
12
+ :chain => [node])
13
+ obj.call(context)
14
+ assert_equal("#main {\n background-color: #000; }\n", context.content)
15
+
16
+ context.content = "#cont \n = unknown"
17
+ assert_raise(RuntimeError) { obj.call(context) }
18
+ end
19
+
20
+ end
@@ -26,7 +26,7 @@ class TestNode < Test::Unit::TestCase
26
26
  :dir_file => dir_file = Webgen::Node.new(dir, '/dir/file.html', 'file.html'),
27
27
  :dir_file_frag => Webgen::Node.new(dir_file, '/dir/file.html#frag', '#frag'),
28
28
  :dir2 => dir2 = Webgen::Node.new(node, '/dir2/', 'dir2/', {'index_path' => 'index.html', 'title' => 'dir2'}),
29
- :dir2_index_en => Webgen::Node.new(dir2, '/dir2/index.html', 'index.html', {'lang' => 'en', 'routed_title' => 'routed'}),
29
+ :dir2_index_en => Webgen::Node.new(dir2, '/dir2/index.html', 'index.html', {'lang' => 'en', 'routed_title' => 'routed', 'title' => 'index'}),
30
30
  }
31
31
  end
32
32
 
@@ -207,7 +207,7 @@ class TestNode < Test::Unit::TestCase
207
207
  assert_equal('ftp://test', nodes[:dir].route_to('ftp://test'))
208
208
 
209
209
  #test args with '..' and '.': either too many of them or absolute path given
210
- assert_equal('../dir2', nodes[:dir_file].route_to('../../../dir2/./'))
210
+ assert_equal('../dir2', nodes[:dir_file].route_to('../../.././dir2'))
211
211
  assert_equal('../file', nodes[:dir_file].route_to('/dir/../file'))
212
212
  assert_equal('file', nodes[:dir_file].route_to('dir/../file'))
213
213
 
@@ -281,6 +281,8 @@ class TestNode < Test::Unit::TestCase
281
281
  nodes[:somename_en].link_to(nodes[:somename_en_frag], 'attr1' => 'val1'))
282
282
  assert_equal('<a href="#frag">frag</a>',
283
283
  nodes[:somename_en].link_to(nodes[:somename_en_frag], :attr1 => 'val1'))
284
+ assert_equal('<a href="dir2/index.html">index</a>',
285
+ nodes[:somename_en].link_to(nodes[:dir2_index_en]))
284
286
 
285
287
  nodes[:somename_en_frag]['link_attrs'] = {:link_text => 'Default Text', 'class'=>'help'}
286
288
  assert_equal('<a attr1="val1" class="help" href="#frag">link_text</a>',
@@ -291,6 +293,8 @@ class TestNode < Test::Unit::TestCase
291
293
  nodes[:somename_de].link_to(nodes[:dir2]))
292
294
  assert_equal('<a href="dir2/index.html">routed</a>',
293
295
  nodes[:somename_en].link_to(nodes[:dir2]))
296
+ assert_equal('<span>routed</span>',
297
+ nodes[:dir2_index_en].link_to(nodes[:dir2]))
294
298
 
295
299
  # varying the website.link_to_current_page option
296
300
  @website.config['website.link_to_current_page'] = true
@@ -109,4 +109,9 @@ class TestPath < Test::Unit::TestCase
109
109
  assert(p.inspect.include?('test.de.page'))
110
110
  end
111
111
 
112
+ def test_changed?
113
+ p = Webgen::Path.new('test.de.page')
114
+ assert(p.changed?)
115
+ end
116
+
112
117
  end
@@ -44,8 +44,16 @@ class TestSourceHandlerPage < Test::Unit::TestCase
44
44
  assert_equal('yes', node['test'])
45
45
  assert_equal(6, node['sort_info'])
46
46
  assert_equal(Webgen::LanguageManager.language_for_code('epo'), node.lang)
47
+ assert_not_nil(@website.cache.permanent[:page_sections]['/test/index.eo.html'])
47
48
 
48
49
  assert_nil(@obj.create_node(@root, @path.dup))
50
+
51
+ @root.tree.delete_node(node)
52
+ path = @path.dup
53
+ def path.changed?
54
+ false
55
+ end
56
+ @obj.create_node(@root, path)
49
57
  end
50
58
 
51
59
  def test_content
@@ -0,0 +1,78 @@
1
+ require 'test/unit'
2
+ require 'helper'
3
+ require 'webgen/tree'
4
+ require 'webgen/contentprocessor'
5
+ require 'webgen/tag'
6
+
7
+ class TestTagBreadcrumbTrail < Test::Unit::TestCase
8
+
9
+ include Test::WebsiteHelper
10
+
11
+ def setup
12
+ super
13
+ @obj = Webgen::Tag::BreadcrumbTrail.new
14
+ end
15
+
16
+ def create_default_nodes
17
+ {
18
+ :root => root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/', {'index_path' => 'index.html'}),
19
+ :dir1 => dir1 = Webgen::Node.new(root, '/dir1/', 'dir1/', {'title' => 'Dir1'}),
20
+ :dir11 => dir11 = Webgen::Node.new(dir1, '/dir1/dir11/', 'dir11/', {'index_path' => 'index.html'}),
21
+ :index11_en => Webgen::Node.new(dir11, '/dir1/dir11/index.html', 'index.html',
22
+ {'lang' => 'en', 'routed_title' => 'Dir11', 'title' => 'Index'}),
23
+ :file11_en => Webgen::Node.new(dir11, '/dir1/dir11/file111.html', 'file111.html',
24
+ {'lang' => 'en', 'title' => 'File111'}),
25
+ :index_en => Webgen::Node.new(root, '/index.html', 'index.html', {'lang' => 'en'}),
26
+ }
27
+ end
28
+
29
+ def call(context, separator, omit_last, omit_index_path)
30
+ @obj.set_params({'tag.breadcrumbtrail.separator' => separator,
31
+ 'tag.breadcrumbtrail.omit_last' => omit_last,
32
+ 'tag.breadcrumbtrail.omit_index_path' => omit_index_path})
33
+ result = @obj.call('breadcrumbTrail', '', context)
34
+ @obj.set_params({})
35
+ result
36
+ end
37
+
38
+ def test_call
39
+ nodes = create_default_nodes
40
+ context = Webgen::ContentProcessor::Context.new(:chain => [nodes[:file11_en]])
41
+
42
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <a href="index.html">Dir11</a> / <span>File111</span>',
43
+ call(context, ' / ', false, false))
44
+ assert_equal(Set.new([nodes[:file11_en], nodes[:index_en], nodes[:index11_en], nodes[:dir1], nodes[:dir11], nodes[:root]].map {|n| n.absolute_lcn}),
45
+ nodes[:file11_en].node_info[:used_nodes])
46
+
47
+
48
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <a href="index.html">Dir11</a> / <span>File111</span>',
49
+ call(context, ' / ', false, true))
50
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <a href="index.html">Dir11</a> / ',
51
+ call(context, ' / ', true, true))
52
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <a href="index.html">Dir11</a> / ',
53
+ call(context, ' / ', true, false))
54
+
55
+
56
+ context[:chain] = [nodes[:index11_en]]
57
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <span>Dir11</span> / <span>Index</span>',
58
+ call(context, ' / ', false, false))
59
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <span>Dir11</span>',
60
+ call(context, ' / ', false, true))
61
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <span>Dir11</span>',
62
+ call(context, ' / ', true, true))
63
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <span>Dir11</span> / ',
64
+ call(context, ' / ', true, false))
65
+
66
+ assert_equal('<a href="../../index.html"></a> | <a href="../">Dir1</a> | <span>Dir11</span> | ',
67
+ call(context, ' | ', true, false))
68
+
69
+
70
+ nodes[:index11_en]['omit_index_path'] = false
71
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <span>Dir11</span> / <span>Index</span>',
72
+ call(context, ' / ', false, true))
73
+ nodes[:index11_en]['omit_index_path'] = true
74
+ assert_equal('<a href="../../index.html"></a> / <a href="../">Dir1</a> / <span>Dir11</span>',
75
+ call(context, ' / ', false, false))
76
+ end
77
+
78
+ end
@@ -0,0 +1,30 @@
1
+ require 'test/unit'
2
+ require 'helper'
3
+ require 'webgen/tag'
4
+
5
+ class TestTagCoderay < Test::Unit::TestCase
6
+
7
+ include Test::WebsiteHelper
8
+
9
+ def setup
10
+ super
11
+ @obj = Webgen::Tag::Coderay.new
12
+ end
13
+
14
+ def call(context, body, lang, process)
15
+ @obj.set_params({'tag.coderay.lang' => lang,
16
+ 'tag.coderay.process' => process})
17
+ result = @obj.call('coderay', body, context)
18
+ @obj.set_params({})
19
+ result
20
+ end
21
+
22
+ def test_call
23
+ root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/', {'title' => 'Hallo'})
24
+ context = Webgen::ContentProcessor::Context.new(:chain => [root])
25
+
26
+ assert(call(context, 'TestData', 'html', false).include?('TestData'))
27
+ assert(call(context, '{title:}', :ruby, true).include?('Hallo'))
28
+ end
29
+
30
+ end
@@ -0,0 +1,16 @@
1
+ require 'test/unit'
2
+ require 'helper'
3
+ require 'webgen/contentprocessor'
4
+ require 'webgen/tag'
5
+ require 'time'
6
+
7
+ class TestTagDate < Test::Unit::TestCase
8
+
9
+ include Test::WebsiteHelper
10
+
11
+ def test_call
12
+ @obj = Webgen::Tag::Date.new
13
+ assert_not_nil(Time.parse(@obj.call('date', '', Webgen::ContentProcessor::Context.new)))
14
+ end
15
+
16
+ end
@@ -0,0 +1,40 @@
1
+ require 'test/unit'
2
+ require 'helper'
3
+ require 'webgen/tag'
4
+ require 'rbconfig'
5
+
6
+ class TestTagExecuteCommand < Test::Unit::TestCase
7
+
8
+ include Test::WebsiteHelper
9
+
10
+ def setup
11
+ super
12
+ @obj = Webgen::Tag::ExecuteCommand.new
13
+ end
14
+
15
+ def call(context, command, process, escape)
16
+ @obj.set_params({'tag.executecommand.command' => command,
17
+ 'tag.executecommand.process_output' => process,
18
+ 'tag.executecommand.escape_html' => escape})
19
+ result = @obj.call('execute_cmd', '', context)
20
+ @obj.set_params({})
21
+ [result.first.chomp.strip, result.last]
22
+ end
23
+
24
+ def test_call
25
+ root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
26
+ context = Webgen::ContentProcessor::Context.new(:chain => [root])
27
+
28
+ test_text = "a\"b\""
29
+ assert_equal([test_text, false], call(context, echo_cmd(test_text), false, false))
30
+ assert_equal([test_text, true], call(context, echo_cmd(test_text), true, false))
31
+ assert_equal(['a&quot;b&quot;', true], call(context, echo_cmd(test_text), true, true))
32
+ assert_equal(['a&quot;b&quot;', true], call(context, echo_cmd(test_text), true, true))
33
+ assert_raise(RuntimeError) { call(context, 'invalid_echo_command', true, true) }
34
+ end
35
+
36
+ def echo_cmd(data)
37
+ (Config::CONFIG['arch'].include?('mswin32') ? "echo #{data}" : "echo '#{data}'")
38
+ end
39
+
40
+ end
@@ -0,0 +1,48 @@
1
+ require 'test/unit'
2
+ require 'helper'
3
+ require 'fileutils'
4
+ require 'tempfile'
5
+ require 'webgen/tag'
6
+
7
+ class TestTagIncludeFile < Test::Unit::TestCase
8
+
9
+ include Test::WebsiteHelper
10
+
11
+ def setup
12
+ super
13
+ @obj = Webgen::Tag::IncludeFile.new
14
+ end
15
+
16
+ def call(context, filename, process, escape)
17
+ @obj.set_params({'tag.includefile.filename' => filename,
18
+ 'tag.includefile.process_output' => process,
19
+ 'tag.includefile.escape_html' => escape})
20
+ result = @obj.call('include_file', '', context)
21
+ @obj.set_params({})
22
+ result
23
+ end
24
+
25
+ def test_call
26
+ root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
27
+ context = Webgen::ContentProcessor::Context.new(:chain => [root])
28
+
29
+ content = "<a>This is 'a' Test</a>"
30
+ file = Tempfile.new('webgen-test-file')
31
+ file.write(content)
32
+ file.close
33
+
34
+ assert_equal([content, false], call(context, file.path, false, false))
35
+ assert_equal([content, true], call(context, file.path, true, false))
36
+ assert_equal([CGI::escapeHTML(content), true], call(context, file.path, true, true))
37
+ assert_raise(Errno::ENOENT) { call(context, 'invalidfile', true, true) }
38
+
39
+ root.dirty = false
40
+ @website.blackboard.dispatch_msg(:node_changed?, root)
41
+ assert(!root.dirty)
42
+
43
+ File.utime(Time.now + 1, Time.now + 1, file.path)
44
+ @website.blackboard.dispatch_msg(:node_changed?, root)
45
+ assert(root.dirty)
46
+ end
47
+
48
+ end
@@ -0,0 +1,53 @@
1
+ require 'test/unit'
2
+ require 'helper'
3
+ require 'webgen/tag'
4
+
5
+ class TestTagLangbar < Test::Unit::TestCase
6
+
7
+ include Test::WebsiteHelper
8
+
9
+ def setup
10
+ super
11
+ @obj = Webgen::Tag::Langbar.new
12
+ end
13
+
14
+ def create_default_nodes
15
+ {
16
+ :root => root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/', {'index_path' => 'index.html'}),
17
+ :file_en => Webgen::Node.new(root, '/file1.html', 'file1.html',
18
+ {'lang' => 'en', 'title' => 'File1'}),
19
+ :index_en => Webgen::Node.new(root, '/index.html', 'index.html', {'lang' => 'en'}),
20
+ :index_de => Webgen::Node.new(root, '/index.de.html', 'index.html', {'lang' => 'de'}),
21
+ }
22
+ end
23
+
24
+ def test_call
25
+ nodes = create_default_nodes
26
+
27
+ de_link = '<a href="index.de.html">de</a>'
28
+ en_link = '<span>en</span>'
29
+ check_results(nodes[:index_en], "#{de_link} | #{en_link}", de_link, "#{de_link} | #{en_link}", de_link)
30
+
31
+ link = '<span>en</span>'
32
+ check_results(nodes[:file_en], link, '', '', '')
33
+
34
+ @obj.set_params('tag.langbar.show_single_lang'=>true, 'tag.langbar.show_own_lang'=>true, 'tag.langbar.separator' => ' --- ')
35
+ assert_equal("#{de_link} --- #{en_link}", @obj.call('langbar', '', Webgen::ContentProcessor::Context.new(:chain => [nodes[:index_en]])))
36
+ end
37
+
38
+ def check_results(node, both_true, both_false, first_false, second_false)
39
+ context = Webgen::ContentProcessor::Context.new(:chain => [node])
40
+ @obj.set_params('tag.langbar.show_single_lang'=>true, 'tag.langbar.show_own_lang'=>true)
41
+ assert_equal(both_true, @obj.call('langbar', '', context))
42
+
43
+ @obj.set_params('tag.langbar.show_single_lang'=>false, 'tag.langbar.show_own_lang'=>false)
44
+ assert_equal(both_false, @obj.call('langbar', '', context))
45
+
46
+ @obj.set_params('tag.langbar.show_single_lang'=>false, 'tag.langbar.show_own_lang'=>true)
47
+ assert_equal(first_false, @obj.call('langbar', '', context))
48
+
49
+ @obj.set_params('tag.langbar.show_single_lang'=>true, 'tag.langbar.show_own_lang'=>false)
50
+ assert_equal(second_false, @obj.call('langbar', '', context))
51
+ end
52
+
53
+ end