docgenerator 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/build_test_and_doc.rb +505 -0
- data/examples/creole_example.rb +82 -0
- data/examples/creole_example_footnote.rb +67 -0
- data/examples/creole_example_placeholder.rb +77 -0
- data/examples/creole_example_rail.rb +154 -0
- data/examples/creole_example_rubycode.rb +144 -0
- data/examples/creole_example_struktex.rb +169 -0
- data/examples/docgenerator_example.rb +1 -1
- data/examples/docgenerator_example_footnote.rb +1 -0
- data/examples/docgenerator_example_list.rb +3 -0
- data/examples/docgenerator_example_restrictions.rb +1 -1
- data/examples/docgenerator_example_tabular.rb +1 -1
- data/examples/docgenerator_example_tripfalls.rb +2 -2
- data/examples/results/readme +2 -1
- data/examples/wiki2docgenerator_example.rb +61 -32
- data/lib/creole/creole2doc.rb +57 -58
- data/lib/creole/creole_characters.rb +56 -0
- data/lib/creole/creole_inclusion_and_plugins.rb +59 -284
- data/lib/creole/creole_inclusions.rb +142 -0
- data/lib/creole/creole_placeholder.rb +57 -23
- data/lib/creole/creole_plugins.rb +198 -0
- data/lib/creole/creole_tabular.rb +16 -8
- data/lib/creole/plugins/rail.rb +182 -0
- data/lib/creole/plugins/rubycode4creole.rb +136 -0
- data/lib/creole/plugins/struktex.rb +59 -0
- data/lib/creole/plugins/todonotes.rb +70 -0
- data/lib/docgenerator.rb +161 -71
- data/lib/docgenerator/attribute.rb +189 -156
- data/lib/docgenerator/characters.rb +824 -267
- data/lib/docgenerator/compatibility_v1.rb +249 -0
- data/lib/docgenerator/css.rb +53 -32
- data/lib/docgenerator/document.rb +119 -56
- data/lib/docgenerator/element.rb +304 -351
- data/lib/docgenerator/element_meta.rb +303 -0
- data/lib/docgenerator/elements.rb +1112 -481
- data/lib/docgenerator/environments.rb +153 -62
- data/lib/docgenerator/footnote.rb +30 -9
- data/lib/docgenerator/lists.rb +71 -47
- data/lib/docgenerator/packages/attachfile.rb +136 -0
- data/lib/{packages/docgenerator_caption.rb → docgenerator/packages/caption.rb} +28 -19
- data/lib/docgenerator/packages/hyperref.rb +194 -0
- data/lib/docgenerator/packages/listings.rb +179 -0
- data/lib/docgenerator/packages/pdfpages.rb +43 -0
- data/lib/docgenerator/packages/rubycode4doc.rb +227 -0
- data/lib/{packages/docgenerator_scrlettr2.rb → docgenerator/packages/scrlettr2.rb} +25 -16
- data/lib/docgenerator/packages/scrpage2.rb +410 -0
- data/lib/docgenerator/packages/struktex.rb +447 -0
- data/lib/docgenerator/packages/todonotes.rb +85 -0
- data/lib/{packages/docgenerator_url.rb → docgenerator/packages/url.rb} +7 -6
- data/lib/docgenerator/sections.rb +257 -83
- data/lib/docgenerator/standard.rb +19 -11
- data/lib/docgenerator/tabular.rb +234 -118
- data/lib/{templates → docgenerator/templates}/docgenerator_template.rb +52 -44
- data/lib/{templates → docgenerator/templates}/docgenerator_template.yaml +0 -0
- data/lib/{templates → docgenerator/templates}/docgenerator_template_css.rb +22 -16
- data/lib/wiki2doc/plugins/rubycode4wiki.rb +53 -0
- data/lib/wiki2doc/plugins/struktex.rb +12 -0
- data/lib/wiki2doc/wiki2docgenerator.rb +39 -38
- data/lib/wiki2doc/wikimedia_document.rb +24 -0
- data/manpage_elements.rb +10411 -0
- data/readme.rd +34 -24
- data/unittest/creole_testtext.creole +11 -0
- data/unittest/expected/test_document_usepackage_undefined.log +2 -2
- data/unittest/expected/test_runtex.stdout +0 -1
- data/unittest/expected/test_runtex_2.stdout +0 -1
- data/unittest/expected/toc_css.css +3 -2
- data/unittest/expected_creole/test_creole_characters_all.creole +28 -0
- data/unittest/expected_creole/test_creole_characters_all.html +15 -15
- data/unittest/expected_creole/test_creole_characters_all.latex +15 -15
- data/unittest/expected_creole/test_creole_footnotes_groupid.html +15 -0
- data/unittest/expected_creole/test_creole_links_file.html +2 -2
- data/unittest/expected_creole/test_creole_links_file.latex +2 -2
- data/unittest/expected_creole/test_creole_links_file.text +2 -2
- data/unittest/expected_creole/test_creole_picture_link.html +1 -1
- data/unittest/expected_creole_rail/test_rail_creole_object.tex +33 -0
- data/unittest/expected_creole_rail/test_rail_creole_placeholder.tex +40 -0
- data/unittest/expected_rubycode4doc/creole_complete.html +26 -0
- data/unittest/expected_rubycode4doc/creole_complete.tex +40 -0
- data/unittest/expected_rubycode4doc/creole_in_tab.html +4 -0
- data/unittest/expected_rubycode4doc/creole_in_tab.tex +6 -0
- data/unittest/expected_rubycode4doc/creole_inline_ruby.html +7 -0
- data/unittest/expected_rubycode4doc/creole_output.html +2 -0
- data/unittest/expected_rubycode4doc/creole_output.tex +4 -0
- data/unittest/expected_rubycode4doc/creole_rubycode.html +1 -0
- data/unittest/expected_rubycode4doc/creole_rubycode.tex +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.html +1 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.tex +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.html +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.tex +5 -0
- data/unittest/expected_rubycode4doc/wiki_1.html +8 -0
- data/unittest/expected_rubycode4doc/wiki_2.html +8 -0
- data/unittest/expected_rubycode4doc/wiki_3.html +9 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_1.html +5 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_2.html +5 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_3.html +8 -0
- data/unittest/expected_rubycode4doc/wiki_immediate_full.html +21 -0
- data/unittest/expected_struktex/test_struktex_krug.creole +15 -0
- data/unittest/expected_struktex/test_struktex_krug.tex +19 -0
- data/unittest/expected_struktex/test_struktex_krug.wiki +15 -0
- data/unittest/expected_struktex/test_struktex_statement.creole +7 -0
- data/unittest/expected_struktex/test_struktex_statement.tex +9 -0
- data/unittest/expected_struktex/test_struktex_statement.wiki +7 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.html +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.latex +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.text +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.wiki +1 -1
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_2.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_groupid.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_label.html +0 -0
- data/unittest/expected_wikimedia/test_wiki_link.html +8 -0
- data/unittest/expected_wikimedia/test_wiki_link.latex +17 -0
- data/unittest/expected_wikimedia/test_wiki_link.wiki +11 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.wiki +0 -0
- data/unittest/expected_wikimedia/test_wiki_picture.html +55 -0
- data/unittest/expected_wikimedia/test_wiki_picture.latex +76 -0
- data/unittest/expected_wikimedia/test_wiki_picture_thumb.html +5 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.wiki +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.html +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.latex +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.text +0 -0
- data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.wiki +0 -0
- data/unittest/{unittest_creole2doc.rb → unittest_creole.rb} +385 -476
- data/unittest/unittest_creole_placeholders.rb +272 -0
- data/unittest/unittest_creole_plugin_rail.rb +147 -0
- data/unittest/unittest_docgenerator.rb +206 -332
- data/unittest/unittest_docgenerator_characters.rb +650 -0
- data/unittest/unittest_docgenerator_runtex.rb +48 -20
- data/unittest/unittest_packages_struktex.rb +187 -0
- data/unittest/unittest_rubycode4doc.rb +275 -0
- data/unittest/unittest_wikimedia.rb +479 -0
- metadata +245 -172
- data/examples/results_expected/docgenerator_example.html +0 -39
- data/examples/results_expected/docgenerator_example.pdf +0 -0
- data/examples/results_expected/docgenerator_example.tex +0 -56
- data/examples/results_expected/docgenerator_example_footnote.html +0 -40
- data/examples/results_expected/docgenerator_example_footnote.pdf +0 -0
- data/examples/results_expected/docgenerator_example_footnote.tex +0 -50
- data/examples/results_expected/docgenerator_example_list.html +0 -18
- data/examples/results_expected/docgenerator_example_list.pdf +0 -0
- data/examples/results_expected/docgenerator_example_list.tex +0 -46
- data/examples/results_expected/docgenerator_example_restrictions.html +0 -22
- data/examples/results_expected/docgenerator_example_restrictions.pdf +0 -0
- data/examples/results_expected/docgenerator_example_restrictions.tex +0 -31
- data/examples/results_expected/docgenerator_example_tabular.html +0 -37
- data/examples/results_expected/docgenerator_example_tabular.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tabular.tex +0 -41
- data/examples/results_expected/docgenerator_example_tripfalls.html +0 -27
- data/examples/results_expected/docgenerator_example_tripfalls.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tripfalls.tex +0 -31
- data/lib/packages/docgenerator_attachfile.rb +0 -71
- data/lib/packages/docgenerator_hyperref.rb +0 -109
- data/lib/packages/docgenerator_listings.rb +0 -103
- data/lib/packages/docgenerator_pdfpages.rb +0 -24
- data/lib/packages/docgenerator_scrpage2.rb +0 -172
- data/self_docgenerator.rb +0 -163
- data/unittest/expected_wiki/test_wiki_link.html +0 -8
- data/unittest/expected_wiki/test_wiki_link.latex +0 -17
- data/unittest/expected_wiki/test_wiki_link.wiki +0 -11
- data/unittest/expected_wiki/test_wiki_picture.html +0 -55
- data/unittest/expected_wiki/test_wiki_picture.latex +0 -76
- data/unittest/expected_wiki/test_wiki_picture_thumb.html +0 -5
- data/unittest/test_rakefile_docgenerator.rb +0 -43
- data/unittest/unittest_versions.rb +0 -44
- data/unittest/unittest_wiki2doc.rb +0 -464
@@ -0,0 +1,272 @@
|
|
1
|
+
if $0 == __FILE__
|
2
|
+
$:.unshift("../lib")
|
3
|
+
end
|
4
|
+
|
5
|
+
gem 'test-unit'
|
6
|
+
require 'test/unit'
|
7
|
+
require 'more_unit_test/assert_equal_filecontent.rb'
|
8
|
+
|
9
|
+
require 'creole/creole2doc.rb'
|
10
|
+
require 'creole/plugins/rail.rb'
|
11
|
+
require 'creole/plugins/struktex.rb'
|
12
|
+
require 'creole/plugins/todonotes.rb'
|
13
|
+
require 'creole/plugins/rubycode4creole.rb'
|
14
|
+
|
15
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::DEBUG
|
16
|
+
#~ DOCGENERATOR_DEFAULT_LOGGER.level = Log4r::WARN
|
17
|
+
#~ Docgenerator.trace_on
|
18
|
+
|
19
|
+
|
20
|
+
#Avoid warnings about missing logger in to_doc
|
21
|
+
OPT = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER } unless defined? OPT
|
22
|
+
|
23
|
+
require 'log4r'
|
24
|
+
#Warn -> report missing important test
|
25
|
+
#Info -> report missing test
|
26
|
+
$log = Log4r::Logger.new('Unittest creole', Log4r::ERROR)
|
27
|
+
#~ $log = Log4r::Logger.new('Unittest creole', Log4r::WARN)
|
28
|
+
#~ $log = Log4r::Logger.new('Unittest creole', Log4r::INFO)
|
29
|
+
$log.outputters = Log4r::StdoutOutputter.new('log_stdout')
|
30
|
+
|
31
|
+
#Logger to catch unwanted messages
|
32
|
+
$tmplog = Log4r::Logger.new('Creole', Log4r::FATAL)
|
33
|
+
|
34
|
+
<<missingtests
|
35
|
+
erweitern:
|
36
|
+
*tabulars
|
37
|
+
*Creole_creoletab
|
38
|
+
*csv-tabs
|
39
|
+
|
40
|
+
placeholder mit parameter (siehe creole_rail)
|
41
|
+
|
42
|
+
Bug:
|
43
|
+
http://... am Ende ohne folgenden Text wird falsch erkannt.
|
44
|
+
--> test_creole_links_implicit_end()
|
45
|
+
missingtests
|
46
|
+
|
47
|
+
class Test_creole_placeholder_interface < Test::Unit::TestCase
|
48
|
+
def test_creole_placeholders()
|
49
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
50
|
+
==Titel 1==
|
51
|
+
Text
|
52
|
+
creole
|
53
|
+
)
|
54
|
+
assert_equal( Docgenerator::Creole::Placeholders::Collection, creole.placeholders)
|
55
|
+
assert_equal( Docgenerator::Creole::Placeholders::Dummy, Docgenerator::Creole::Placeholders::Collection[:undefined])
|
56
|
+
assert_equal( Docgenerator::Creole::Placeholders::Creole_html, Docgenerator::Creole::Placeholders::Collection['html'])
|
57
|
+
#~ assert_instance_of( Dummy_placeholder, Creole::Placeholders[:undefined])
|
58
|
+
end #test_creole_placeholders
|
59
|
+
|
60
|
+
=begin
|
61
|
+
Define test for each placeholder.
|
62
|
+
=end
|
63
|
+
Docgenerator::Creole::Placeholders::Collection.each{|key,placeholder_class|
|
64
|
+
code = <<-xx
|
65
|
+
def test_#{placeholder_class.to_s.gsub(/::/, '_')}()
|
66
|
+
do_interfacetest('#{key}', #{placeholder_class})
|
67
|
+
end
|
68
|
+
xx
|
69
|
+
class_eval(code)
|
70
|
+
}
|
71
|
+
=begin rdoc
|
72
|
+
Test, if the interface for a placeholder follows the main definition.
|
73
|
+
|
74
|
+
=end
|
75
|
+
def do_interfacetest(key,placeholder_class)
|
76
|
+
assert_equal( placeholder_class, Docgenerator::Creole::Placeholders[key])
|
77
|
+
assert_equal( placeholder_class, Docgenerator::Creole::Placeholders::Collection[key])
|
78
|
+
assert_equal( placeholder_class, Docgenerator::Creole::Creole.new.placeholders[key])
|
79
|
+
|
80
|
+
assert_nothing_raised("Interface error for class #{placeholder_class}"){
|
81
|
+
begin
|
82
|
+
placeholder = placeholder_class.new( Docgenerator::Creole::Creole.new )
|
83
|
+
rescue Docgenerator::Creole::Placeholder::ParameterError
|
84
|
+
#Docgenerator::Creole_placeholder::ParameterError is an accepted error
|
85
|
+
#Happens if this placeholder needs a parameter.
|
86
|
+
else
|
87
|
+
#Check inheritance.
|
88
|
+
assert_kind_of( Docgenerator::Creole::Placeholder, placeholder)
|
89
|
+
end
|
90
|
+
}
|
91
|
+
assert_nothing_raised("Interface error for class #{placeholder_class}"){
|
92
|
+
begin
|
93
|
+
placeholder = placeholder_class.new( Docgenerator::Creole::Creole.new, 'a' )
|
94
|
+
rescue Docgenerator::Creole::Placeholder::ParameterError
|
95
|
+
#Docgenerator::Creole_placeholder::ParameterError is an accepted error
|
96
|
+
#Happens if this placeholder needs a specific parameter.
|
97
|
+
else
|
98
|
+
#Check inheritance.
|
99
|
+
assert_kind_of( Docgenerator::Creole::Placeholder, placeholder)
|
100
|
+
end
|
101
|
+
}
|
102
|
+
#Check 2 parameters
|
103
|
+
assert_raise(ArgumentError, "Interface error for class #{placeholder_class}"){
|
104
|
+
placeholder = placeholder_class.new( Docgenerator::Creole::Creole.new, 'a', 'b' )
|
105
|
+
#Check inheritance.
|
106
|
+
assert_kind_of( Docgenerator::Creole::Placeholder, placeholder)
|
107
|
+
}
|
108
|
+
end #do_interfacetest(key,placeholder_class)
|
109
|
+
|
110
|
+
end #class Test_creole_placeholder_interface
|
111
|
+
|
112
|
+
class Test_creole_placeholders_html < Test::Unit::TestCase
|
113
|
+
def test_creole_placeholders_html()
|
114
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
115
|
+
before
|
116
|
+
<<<html
|
117
|
+
<em>this is only for HTML</em>
|
118
|
+
>>>
|
119
|
+
after
|
120
|
+
creole
|
121
|
+
)
|
122
|
+
#Really like this? Or should there be no paragraph?
|
123
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.html", creole.to_doc(:html, OPT))
|
124
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.latex", creole.to_doc(:latex, OPT))
|
125
|
+
$log.warn('test_creole_placeholders_html: to_context')
|
126
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.context", creole.to_doc(:context))
|
127
|
+
$log.warn('test_creole_placeholders_html: to wiki/creole')
|
128
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.creole", creole.to_doc(:creole))
|
129
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.text", creole.to_doc(:text, OPT))
|
130
|
+
end #test_creole_placeholders_html
|
131
|
+
end #class Test_creole_placeholders_html
|
132
|
+
class Test_creole_placeholders_latex < Test::Unit::TestCase
|
133
|
+
def test_creole_placeholders_latex()
|
134
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
135
|
+
before
|
136
|
+
<<<latex
|
137
|
+
\\textbf{this is only for latex}
|
138
|
+
>>>
|
139
|
+
after
|
140
|
+
creole
|
141
|
+
)
|
142
|
+
#Really like this? Or should there be no paragraph?
|
143
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.html", creole.to_doc(:html, OPT))
|
144
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.latex", creole.to_doc(:latex, OPT))
|
145
|
+
$log.warn('test_creole_placeholders_latex: to_context')
|
146
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_context.context", creole.to_doc(:context))
|
147
|
+
$log.warn('test_creole_placeholders_latex: to wiki/creole')
|
148
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.creole", creole.to_doc(:creole))
|
149
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.text", creole.to_doc(:text, OPT))
|
150
|
+
end #test_creole_placeholders_latex
|
151
|
+
end #Test_creole_placeholders
|
152
|
+
|
153
|
+
#http://www.wikicreole.org/wiki/Tables
|
154
|
+
class Test_creole_tabular < Test::Unit::TestCase
|
155
|
+
def test_creole_tabular_creole()
|
156
|
+
creole = Docgenerator::Creole::Creole.new(
|
157
|
+
:name => 'tabular_creole',
|
158
|
+
:content => <<'creole'
|
159
|
+
Tables are done like this:
|
160
|
+
|=header col1|=header col2|
|
161
|
+
|col1|col2|
|
162
|
+
|you |can |
|
163
|
+
|also |align\\ it. |
|
164
|
+
creole
|
165
|
+
)
|
166
|
+
$log.warn('test_creole_tabular_creole: tabular inside paragraphs/list...')
|
167
|
+
$log.warn('test_creole_tabular_creole: wiki syntax inside cell ')
|
168
|
+
assert_equal_filecontent( "expected_creole/test_creole_tabular_creole.html", creole.to_doc(:html, OPT))
|
169
|
+
assert_equal_filecontent( "expected_creole/test_creole_tabular_creole.latex", creole.to_doc(:latex, OPT))
|
170
|
+
$log.warn('test_creole_tabular_creole: to_context')
|
171
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular_creole.context", creole.to_doc(:context))
|
172
|
+
$log.warn('test_creole_tabular_creole: to wiki/creole')
|
173
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular_creole.creole", creole.to_doc(:creole))
|
174
|
+
$log.warn('test_creole_tabular_creole: to text/creole')
|
175
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular_creole.text", creole.to_doc(:text))
|
176
|
+
end #test_creole_tabular_creole
|
177
|
+
|
178
|
+
def test_creole_tabular()
|
179
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
180
|
+
before
|
181
|
+
<<<tabular
|
182
|
+
|!columns=3
|
183
|
+
|!columndescription=ccc
|
184
|
+
|=1
|
185
|
+
|=2
|
186
|
+
|=3
|
187
|
+
|-
|
188
|
+
|eins
|
189
|
+
|zwei
|
190
|
+
|drei
|
191
|
+
|-
|
192
|
+
|one
|
193
|
+
|two
|
194
|
+
|three
|
195
|
+
>>>
|
196
|
+
after
|
197
|
+
creole
|
198
|
+
)
|
199
|
+
assert_equal_filecontent( "expected_creole/test_creole_tabular.html", creole.to_doc(:html, OPT))
|
200
|
+
assert_equal_filecontent( "expected_creole/test_creole_tabular.latex", creole.to_doc(:latex, OPT))
|
201
|
+
$log.warn('test_creole_tabular: to_context')
|
202
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular.context", creole.to_doc(:context))
|
203
|
+
$log.warn('test_creole_tabular: to wiki/creole')
|
204
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular.creole", creole.to_doc(:creole))
|
205
|
+
$log.warn('test_creole_tabular: to text/creole')
|
206
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular.text", creole.to_doc(:text))
|
207
|
+
end #test_creole_tabular
|
208
|
+
|
209
|
+
def test_creole_tabular_with_cell_option()
|
210
|
+
# title...
|
211
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
212
|
+
before
|
213
|
+
<<<tabular
|
214
|
+
|!columns=3
|
215
|
+
|eins||css=color: red
|
216
|
+
|css = zwei
|
217
|
+
|||class=empty
|
218
|
+
|-
|
219
|
+
|normal
|
220
|
+
|//italic//
|
221
|
+
|//italic//||class=it
|
222
|
+
|-
|
223
|
+
|text with | nice! ||class = it
|
224
|
+
|||css =
|
225
|
+
|
|
226
|
+
>>>
|
227
|
+
after
|
228
|
+
creole
|
229
|
+
)
|
230
|
+
assert_equal_filecontent( "expected_creole/test_creole_tabular_with_cell_option.html", creole.to_doc(:html, OPT))
|
231
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular_with_option.latex", creole.to_doc(:latex))
|
232
|
+
$log.warn('test_creole_tabular: to_context')
|
233
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular.context", creole.to_doc(:context))
|
234
|
+
$log.warn('test_creole_tabular: to wiki/creole')
|
235
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular.creole", creole.to_doc(:creole))
|
236
|
+
$log.warn('test_creole_tabular: to text/creole')
|
237
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular.text", creole.to_doc(:text))
|
238
|
+
end #test_creole_tabular
|
239
|
+
|
240
|
+
def test_creole_tabular_css()
|
241
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
242
|
+
before
|
243
|
+
<<<tabular
|
244
|
+
|!columns=3
|
245
|
+
|!columndescription=ccc
|
246
|
+
|!css=border-width: 1px
|
247
|
+
|!css=border-style: solid
|
248
|
+
|=1
|
249
|
+
|=2
|
250
|
+
|=3
|
251
|
+
|-
|
252
|
+
|eins
|
253
|
+
|zwei
|
254
|
+
|drei
|
255
|
+
|-
|
256
|
+
|one
|
257
|
+
|two
|
258
|
+
|three
|
259
|
+
>>>
|
260
|
+
after
|
261
|
+
creole
|
262
|
+
)
|
263
|
+
assert_equal_filecontent( "expected_creole/test_creole_tabular_css.html", creole.to_doc(:html, OPT))
|
264
|
+
assert_equal_filecontent( "expected_creole/test_creole_tabular_css.latex", creole.to_doc(:latex, OPT))
|
265
|
+
$log.warn('test_creole_tabular_css: to_context')
|
266
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular_css.context", creole.to_doc(:context))
|
267
|
+
$log.warn('test_creole_tabular_css: to wiki/creole')
|
268
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular_css.creole", creole.to_doc(:creole))
|
269
|
+
$log.warn('test_creole_tabular_css: to text/creole')
|
270
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular_css.text", creole.to_doc(:text))
|
271
|
+
end #test_creole_tabular_css
|
272
|
+
end #Test_creole_tabular
|
@@ -0,0 +1,147 @@
|
|
1
|
+
#~ require '../test_docgenerator.rb'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'more_unit_test/assert_equal_filecontent.rb'
|
4
|
+
|
5
|
+
if $0 == __FILE__
|
6
|
+
$:.unshift("../lib")
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'creole/plugins/rail.rb'
|
10
|
+
|
11
|
+
#~ $log = Log4r::Logger.new( 'test rail', Log4r::WARN )
|
12
|
+
#~ $log.outputters = Log4r::StdoutOutputter.new('test rail')
|
13
|
+
#~ $log.level = Log4r::INFO
|
14
|
+
|
15
|
+
#~ $log.info("Remark: Known errors/problems and missing checks are logged.")
|
16
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::DEBUG
|
17
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::INFO
|
18
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::WARN
|
19
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::ERROR
|
20
|
+
|
21
|
+
#~ include Log4r
|
22
|
+
|
23
|
+
#~ class Test_rail < Test::Unit::TestCase
|
24
|
+
#~ def test_rail()
|
25
|
+
#~ block = Rail_diagramm.new('block', <<-RAIL
|
26
|
+
#~ ( lbrace | 'begin' )
|
27
|
+
#~ ( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] )
|
28
|
+
#~ comm
|
29
|
+
#~ ( rbrace | 'end' )
|
30
|
+
#~ RAIL
|
31
|
+
#~ )
|
32
|
+
#~ assert_equal_filecontent( "expected_rail/rail_.rail", text.to_doc(:tex))
|
33
|
+
#~ end
|
34
|
+
#~ end #Test_rail
|
35
|
+
|
36
|
+
class Test_creole_rail < Test::Unit::TestCase
|
37
|
+
def test_document_placeholder()
|
38
|
+
doc = Docgenerator::Creole::Creole_document.new(
|
39
|
+
:title => 'Rail-Diagramms in Creole'
|
40
|
+
)
|
41
|
+
assert_nothing_raised(){
|
42
|
+
doc << <<DATA
|
43
|
+
<<<rail|id
|
44
|
+
A
|
45
|
+
>>>
|
46
|
+
DATA
|
47
|
+
}
|
48
|
+
end
|
49
|
+
def test_document_placeholder_missing_id()
|
50
|
+
doc = Docgenerator::Creole::Creole_document.new(
|
51
|
+
:title => 'Rail-Diagramms in Creole'
|
52
|
+
)
|
53
|
+
assert_raise( Docgenerator::Creole::Placeholder::ParameterError ){
|
54
|
+
doc << <<DATA
|
55
|
+
<<<rail
|
56
|
+
A
|
57
|
+
>>>
|
58
|
+
DATA
|
59
|
+
}
|
60
|
+
end
|
61
|
+
def test_document_placeholder_wrong_id()
|
62
|
+
doc = Docgenerator::Creole::Creole_document.new(
|
63
|
+
:title => 'Rail-Diagramms in Creole'
|
64
|
+
)
|
65
|
+
assert_raise( Docgenerator::Creole::Placeholder::ParameterError ){
|
66
|
+
doc << <<DATA
|
67
|
+
<<<rail|id-with-minus
|
68
|
+
A
|
69
|
+
>>>
|
70
|
+
DATA
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_document_placeholder_in_wiki()
|
75
|
+
doc = Docgenerator::Creole::Creole_document.new(
|
76
|
+
:title => 'Rail-Diagramms in Creole'
|
77
|
+
)
|
78
|
+
doc.doc.head << Docgenerator::Creole::Rail::Rail_diagramm::TEX_PACKAGE_RAIL
|
79
|
+
#~ doc.doc.head << element(:latexonly,{}, [
|
80
|
+
#~ Rail_diagramm::RAIL_ALIAS,
|
81
|
+
#~ '\railterm{lowcharacter,uppercharacter}',
|
82
|
+
#~ ])
|
83
|
+
|
84
|
+
doc << <<DATA
|
85
|
+
=Rail-Diagramms
|
86
|
+
==Via Placeholder
|
87
|
+
<<<rail|test
|
88
|
+
[1] (
|
89
|
+
( '[' string ']' )
|
90
|
+
? body[2--6] + '|'
|
91
|
+
)
|
92
|
+
| [2] body[3--6] '*' body[5--6]
|
93
|
+
| [2] body[3--6] '+' body[5--6]
|
94
|
+
| [3] ( body[4--5] + )
|
95
|
+
| [4] body[5] '?'
|
96
|
+
| [5] identifier ( '[' string ']' ) ?
|
97
|
+
| [5] quote string quote
|
98
|
+
| [5] dquote string dquote
|
99
|
+
| [5] '(' body[1--6] ')'
|
100
|
+
| [5] cr
|
101
|
+
| [6]
|
102
|
+
;
|
103
|
+
>>>
|
104
|
+
DATA
|
105
|
+
#~ doc.runtex = :pdflatex
|
106
|
+
assert_equal_filecontent( "expected_creole_rail/test_rail_creole_placeholder.tex", doc.doc.to_latex({
|
107
|
+
:template=> Docgenerator::DocumentTemplate[:article],
|
108
|
+
:filename => 'xx',
|
109
|
+
:log => doc.doc.log
|
110
|
+
}))
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
def test_document_object()
|
115
|
+
$block = Docgenerator::Creole::Rail::Rail_diagramm.new('block', <<-RAIL
|
116
|
+
( lbrace | 'begin' )
|
117
|
+
( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] )
|
118
|
+
comm
|
119
|
+
( rbrace | 'end' )
|
120
|
+
RAIL
|
121
|
+
)
|
122
|
+
doc = Docgenerator::Creole::Creole_document.new(
|
123
|
+
:title => 'Rail-Diagramms in Creole'
|
124
|
+
)
|
125
|
+
doc.doc.head << Docgenerator::Creole::Rail::Rail_diagramm::TEX_PACKAGE_RAIL
|
126
|
+
#~ doc.doc.head << element(:latexonly,{}, [
|
127
|
+
#~ Rail_diagramm::RAIL_ALIAS,
|
128
|
+
#~ '\railterm{lowcharacter,uppercharacter}',
|
129
|
+
#~ ])
|
130
|
+
|
131
|
+
doc << <<DATA
|
132
|
+
=Rail-Diagramms
|
133
|
+
==Via Ruby-object
|
134
|
+
<<ruby_raw|$block.to_latex>>
|
135
|
+
DATA
|
136
|
+
#~ doc.runtex = :pdflatex
|
137
|
+
assert_equal_filecontent( "expected_creole_rail/test_rail_creole_object.tex", doc.doc.to_latex({
|
138
|
+
:template=> Docgenerator::DocumentTemplate[:article],
|
139
|
+
:filename => 'xx',
|
140
|
+
:log => doc.doc.log
|
141
|
+
}))
|
142
|
+
end
|
143
|
+
end #Test_rail
|
144
|
+
|
145
|
+
#~ assert_equal_filecontent( "expected_rail/rail_.rail", text.to_doc(:tex))
|
146
|
+
|
147
|
+
__END__
|
@@ -1,57 +1,66 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
gem 'test-unit'
|
2
3
|
require 'test/unit'
|
3
|
-
$:.unshift('C:/usr/Script/more_unit_test/lib')
|
4
|
+
#~ $:.unshift('C:/usr/Script/more_unit_test/lib')
|
4
5
|
require 'more_unit_test/assert_equal_filecontent.rb'
|
5
6
|
|
6
7
|
if $0 == __FILE__
|
7
8
|
$:.unshift("../lib")
|
8
9
|
end
|
9
10
|
require 'docgenerator'
|
11
|
+
include Docgenerator
|
12
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::DEBUG
|
10
13
|
|
11
14
|
#~ Element::SUPPORTED_TARGETS << :context
|
12
15
|
#~ Element::SUPPORTED_TARGETS << :creole
|
13
|
-
#~ DOCGENERATOR_LOGGER.level = Log4r::DEBUG
|
14
|
-
#~ DOCGENERATOR_LOGGER.level = Log4r::ERROR
|
15
16
|
|
16
17
|
$log = Log4r::Logger.new('Unittest docgenerator', Log4r::ERROR )
|
18
|
+
$log.freeze
|
17
19
|
#~ $log = Log4r::Logger.new('Unittest docgenerator', Log4r::WARN)
|
18
20
|
#~ $log = Log4r::Logger.new('Unittest docgenerator', Log4r::INFO)
|
19
21
|
$log.outputters = Log4r::StdoutOutputter.new('log_stdout')
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
@
|
30
|
-
|
31
|
-
DOCGENERATOR_LOGGER.outputters = Log4r::IOOutputter.new('log_xxx', templogfile )
|
32
|
-
return templogfile
|
33
|
-
end
|
34
|
-
#Get temporary data and reset logger.
|
35
|
-
def get_temporary_logger(templogfile)
|
36
|
-
templogfile.close()
|
37
|
-
templogfile.open()
|
38
|
-
templogfile_content = templogfile.readlines.join()
|
39
|
-
templogfile.close(true)
|
40
|
-
DOCGENERATOR_LOGGER.level = @loglevel
|
41
|
-
DOCGENERATOR_LOGGER.outputters = @outputter
|
42
|
-
return templogfile_content
|
23
|
+
=begin rdoc
|
24
|
+
Define a new outputter to catch data into an array
|
25
|
+
=end
|
26
|
+
class ArrayOutputter < Log4r::StdoutOutputter
|
27
|
+
=begin rdoc
|
28
|
+
Collect messages in array.
|
29
|
+
=end
|
30
|
+
def write(message)
|
31
|
+
@messages ||= [] #create with first call
|
32
|
+
@messages << message
|
43
33
|
end
|
44
|
-
|
34
|
+
=begin rdoc
|
35
|
+
Clear message array and return messages
|
36
|
+
=end
|
37
|
+
def flush
|
38
|
+
@messages ||= [] #create with first call
|
39
|
+
messages = @messages.dup
|
40
|
+
@messages.clear
|
41
|
+
messages
|
42
|
+
end
|
43
|
+
end #ArrayOutputter
|
44
|
+
|
45
|
+
$log_array = Log4r::Logger.new('docgenerator', Log4r::DEBUG)
|
46
|
+
$log_array.outputters = $log_array_outputter = ArrayOutputter.new('xx')
|
45
47
|
|
46
48
|
|
47
49
|
|
48
50
|
class Test_elements < Test::Unit::TestCase
|
49
|
-
|
51
|
+
def setup()
|
52
|
+
#Avoid warnings about missing logger in to_doc
|
53
|
+
@opt = { :log => DOCGENERATOR_DEFAULT_LOGGER } #unless defined? @opt
|
54
|
+
end
|
50
55
|
def test_generell_settings()
|
51
56
|
#Check the logger
|
52
57
|
assert_instance_of( Log4r::Logger, DOCGENERATOR_LOGGER)
|
53
|
-
|
54
|
-
|
58
|
+
|
59
|
+
assert_equal( Log4r::ERROR, DOCGENERATOR_LOGGER.level, "Default Level of Default-Logger (DOCGENERATOR_LOGGER) changed:")
|
60
|
+
#Check the default logger
|
61
|
+
assert_instance_of( Log4r::Logger, DOCGENERATOR_DEFAULT_LOGGER)
|
62
|
+
assert_equal( Log4r::WARN, DOCGENERATOR_DEFAULT_LOGGER.level, "Default Level of Default-Logger (DOCGENERATOR_DEFAULT_LOGGER) changed:")
|
63
|
+
|
55
64
|
assert_instance_of( Log4r::StdoutOutputter, DOCGENERATOR_LOGGER.outputters.first)
|
56
65
|
#~ assert_equal( Log4r::FATAL, DOCGENERATOR_LOGGER.outputters.first.level)
|
57
66
|
end
|
@@ -63,193 +72,32 @@ class Test_elements < Test::Unit::TestCase
|
|
63
72
|
|
64
73
|
assert_equal( true, element(:p).content?)
|
65
74
|
assert_equal( false, element(:br).content?)
|
66
|
-
#Result ok, but warning
|
67
|
-
assert_equal( "<br />", element(:br,{},'content').to_html)
|
68
75
|
|
69
|
-
#
|
70
|
-
|
71
|
-
assert_equal( "<br />", element(:br,{},'content').to_html)
|
76
|
+
#Result ok, but warning
|
77
|
+
assert_equal( "<br />", element(:br,{log: $log_array},'content').to_html(@opt))
|
72
78
|
#~ assert_equal_filecontent( "expected/test_content.log", get_temporary_logger() )
|
73
79
|
#Problem: ids.inspect is unsorted -> check only match
|
74
|
-
#~ assert_equal(%Q{ WARN docgenerator: Add content to an element without this feature ["br/", :br, :newline, "br"], "content"\n},
|
75
|
-
assert_match(%r{WARN docgenerator: Add content to an element without this feature
|
80
|
+
#~ assert_equal(%Q{ WARN docgenerator: Add content to an element without this feature ["br/", :br, :newline, "br"], "content"\n}, $log_array_outputter.flush.join)
|
81
|
+
assert_match(%r{WARN docgenerator: Add content to an element without this feature <Docgenerator::Elements::Newline.*>, "content"\n},
|
82
|
+
$log_array_outputter.flush.join)
|
76
83
|
end
|
77
|
-
def
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
assert_equal( '~~', element(:emsp).to_latex)
|
93
|
-
#~ assert_equal( '??', element(:emsp).to_context)
|
94
|
-
assert_equal( ' ', element(:nbsp).to_html)
|
95
|
-
assert_equal( '~', element(:nbsp).to_latex)
|
96
|
-
#~ assert_equal( '??', element(:nbsp).to_context)
|
97
|
-
assert_equal( '€', element(:euro).to_html)
|
98
|
-
assert_equal( '\euro', element(:euro).to_latex)
|
99
|
-
#~ assert_equal( '??', element(:euro).to_context)
|
100
|
-
assert_equal( '%', element(:percent).to_html)
|
101
|
-
assert_equal( '%', element(:'%').to_html)
|
102
|
-
assert_equal( '\%', element(:percent).to_latex)
|
103
|
-
#~ assert_equal( '??', element(:percent).to_context)
|
104
|
-
assert_equal( '\%', element(:'%').to_latex)
|
105
|
-
#~ assert_equal( '??', element(:'%').to_context)
|
106
|
-
assert_equal( '^', element(:'^').to_html)
|
107
|
-
assert_equal( '\hat{}', element(:'^').to_latex)
|
108
|
-
#~ assert_equal( '??', element(:'^').to_context)
|
109
|
-
assert_equal( '¿', element(:iquest).to_html)
|
110
|
-
assert_equal( '¿', element(:iquest).to_latex)
|
111
|
-
#~ assert_equal( '??', element(:iquest).to_context)
|
112
|
-
assert_equal( '&', element(:ampersand).to_html)
|
113
|
-
assert_equal( '&', element(:'&').to_html)
|
114
|
-
assert_equal( '\&', element(:ampersand).to_latex)
|
115
|
-
#~ assert_equal( '??', element(:ampersand).to_context)
|
116
|
-
assert_equal( '\&', element(:'&').to_latex)
|
117
|
-
#~ assert_equal( '??', element(:'&').to_context)
|
118
|
-
assert_equal( '}', element(:rbrace).to_html)
|
119
|
-
assert_equal( '}', element(:'}').to_html)
|
120
|
-
assert_equal( '\}', element(:rbrace).to_latex)
|
121
|
-
#~ assert_equal( '??', element(:rbrace).to_context)
|
122
|
-
assert_equal( '\}', element(:'}').to_latex)
|
123
|
-
#~ assert_equal( '??', element(:'}').to_context)
|
124
|
-
assert_equal( '{', element(:lbrace).to_html)
|
125
|
-
assert_equal( '{', element(:'{').to_html)
|
126
|
-
assert_equal( '\{', element(:lbrace).to_latex)
|
127
|
-
#~ assert_equal( '??', element(:lbrace).to_context)
|
128
|
-
assert_equal( '\{', element(:'{').to_latex)
|
129
|
-
#~ assert_equal( '??', element(:'{').to_context)
|
130
|
-
assert_equal( '\\', element(:backslash).to_html)
|
131
|
-
assert_equal( '\ensuremath{\backslash}', element(:backslash).to_latex)
|
132
|
-
#~ assert_equal( '??', element(:backslash).to_context)
|
133
|
-
assert_equal( '√', element(:radic).to_html)
|
134
|
-
assert_equal( '\ensuremath{\sqrt{}}', element(:radic).to_latex)
|
135
|
-
#~ assert_equal( '??', element(:radic).to_context)
|
136
|
-
assert_equal( '→', element(:rarr).to_html)
|
137
|
-
assert_equal( '→', element(:rightarrow).to_html)
|
138
|
-
assert_equal( '→', element(:'->').to_html)
|
139
|
-
assert_equal( '->', element(:'->').to_text)
|
140
|
-
assert_equal( '\ensuremath{\rightarrow}', element(:rarr).to_latex)
|
141
|
-
#~ assert_equal( '??', element(:rarr).to_context)
|
142
|
-
assert_equal( '\ensuremath{\rightarrow}', element(:rightarrow).to_latex)
|
143
|
-
#~ assert_equal( '??', element(:rightarrow).to_context)
|
144
|
-
assert_equal( '\ensuremath{\rightarrow}', element(:'->').to_latex)
|
145
|
-
#~ assert_equal( '??', element(:'->').to_context)
|
146
|
-
assert_equal( '⇒', element(:rArr).to_html)
|
147
|
-
assert_equal( '⇒', element(:Rightarrow).to_html)
|
148
|
-
assert_equal( '⇒', element(:'=>').to_html)
|
149
|
-
assert_equal( '=>', element(:'=>').to_text)
|
150
|
-
assert_equal( '\ensuremath{\Rightarrow}', element(:rArr).to_latex)
|
151
|
-
#~ assert_equal( '??', element(:rArr).to_context)
|
152
|
-
assert_equal( '\ensuremath{\Rightarrow}', element(:Rightarrow).to_latex)
|
153
|
-
#~ assert_equal( '??', element(:Rightarrow).to_context)
|
154
|
-
assert_equal( '\ensuremath{\Rightarrow}', element(:'=>').to_latex)
|
155
|
-
#~ assert_equal( '??', element(:'=>').to_context)
|
156
|
-
assert_equal( '←', element(:larr).to_html)
|
157
|
-
assert_equal( '←', element(:leftarrow).to_html)
|
158
|
-
assert_equal( '←', element(:'<-').to_html)
|
159
|
-
assert_equal( '<-', element(:'<-').to_text)
|
160
|
-
assert_equal( '\ensuremath{\leftarrow}', element(:larr).to_latex)
|
161
|
-
#~ assert_equal( '??', element(:larr).to_context)
|
162
|
-
assert_equal( '\ensuremath{\leftarrow}', element(:leftarrow).to_latex)
|
163
|
-
#~ assert_equal( '??', element(:leftarrow).to_context)
|
164
|
-
assert_equal( '\ensuremath{\leftarrow}', element(:'<-').to_latex)
|
165
|
-
#~ assert_equal( '??', element(:'<-').to_context)
|
166
|
-
assert_equal( '⇐', element(:lArr).to_html)
|
167
|
-
assert_equal( '⇐', element(:Leftarrow).to_html)
|
168
|
-
assert_equal( '⇐', element(:'<=').to_html)
|
169
|
-
assert_equal( '<=', element(:'<=').to_text)
|
170
|
-
assert_equal( '\ensuremath{\Lefttarrow}', element(:lArr).to_latex)
|
171
|
-
#~ assert_equal( '??', element(:lArr).to_context)
|
172
|
-
assert_equal( '\ensuremath{\Lefttarrow}', element(:Leftarrow).to_latex)
|
173
|
-
#~ assert_equal( '??', element(:Leftarrow).to_context)
|
174
|
-
assert_equal( '\ensuremath{\Lefttarrow}', element(:'<=').to_latex)
|
175
|
-
#~ assert_equal( '??', element(:'<=').to_context)
|
176
|
-
assert_equal( '⇑', element(:uArr).to_html)
|
177
|
-
assert_equal( '⇑', element(:Uparrow).to_html)
|
178
|
-
assert_equal( '\ensuremath{\Uparrow}', element(:uArr).to_latex)
|
179
|
-
#~ assert_equal( '??', element(:uArr).to_context)
|
180
|
-
assert_equal( '\ensuremath{\Uparrow}', element(:Uparrow).to_latex)
|
181
|
-
#~ assert_equal( '??', element(:Uparrow).to_context)
|
182
|
-
assert_equal( '<', element(:lt).to_html)
|
183
|
-
assert_equal( '<', element(:'<').to_html)
|
184
|
-
assert_equal( '\ensuremath{<}', element(:lt).to_latex)
|
185
|
-
#~ assert_equal( '??', element(:lt).to_context)
|
186
|
-
assert_equal( '\ensuremath{<}', element(:'<').to_latex)
|
187
|
-
#~ assert_equal( '??', element(:'<').to_context)
|
188
|
-
assert_equal( '>', element(:gt).to_html)
|
189
|
-
assert_equal( '>', element(:'>').to_html)
|
190
|
-
assert_equal( '\ensuremath{>}', element(:gt).to_latex)
|
191
|
-
#~ assert_equal( '??', element(:gt).to_context)
|
192
|
-
assert_equal( '\ensuremath{>}', element(:'>').to_latex)
|
193
|
-
#~ assert_equal( '??', element(:'>').to_context)
|
194
|
-
assert_equal( '∞', element(:infin).to_html)
|
195
|
-
assert_equal( '∞', element(:infty).to_html)
|
196
|
-
assert_equal( '\ensuremath{\infty}', element(:infin).to_latex)
|
197
|
-
#~ assert_equal( '??', element(:infin).to_context)
|
198
|
-
assert_equal( '\ensuremath{\infty}', element(:infty).to_latex)
|
199
|
-
#~ assert_equal( '??', element(:infty).to_context)
|
200
|
-
assert_equal( '÷', element(:divide).to_html)
|
201
|
-
assert_equal( '\ensuremath{\div}', element(:divide).to_latex)
|
202
|
-
#~ assert_equal( '??', element(:divide).to_context)
|
203
|
-
assert_equal( '¥', element(:yen).to_html)
|
204
|
-
assert_equal( '∼', element(:sim).to_html)
|
205
|
-
assert_equal( '\ensuremath{\sim}', element(:sim).to_latex)
|
206
|
-
#~ assert_equal( '??', element(:sim).to_context)
|
207
|
-
assert_equal( '¦', element(:brvbar).to_html)
|
208
|
-
assert_equal( '|', element(:brvbar).to_latex)
|
209
|
-
#~ assert_equal( '??', element(:brvbar).to_context)
|
210
|
-
assert_equal( '5€', element(:euros,{},5).to_html)
|
211
|
-
assert_equal( '\euros{5}', element(:euros,{},5).to_latex)
|
212
|
-
#~ assert_equal( '??', element(:euros,{},5).to_context)
|
213
|
-
assert_equal( '¬', element(:neg).to_html)
|
214
|
-
assert_equal( '¬', element(:not).to_html)
|
215
|
-
assert_equal( '\ensuremath{\neg}', element(:neg).to_latex)
|
216
|
-
#~ assert_equal( '??', element(:neg).to_context)
|
217
|
-
assert_equal( '\ensuremath{\neg}', element(:not).to_latex)
|
218
|
-
#~ assert_equal( '??', element(:not).to_context)
|
219
|
-
assert_equal( '×', element(:times).to_html)
|
220
|
-
assert_equal( '\ensuremath{\times}', element(:times).to_latex)
|
221
|
-
#~ assert_equal( '??', element(:times).to_context)
|
222
|
-
assert_equal( '⊗', element(:otimes).to_html)
|
223
|
-
assert_equal( '\ensuremath{\otimes}', element(:otimes).to_latex)
|
224
|
-
#~ assert_equal( '??', element(:otimes).to_context)
|
225
|
-
assert_equal( '∅', element(:empty).to_html)
|
226
|
-
assert_equal( '\ensuremath{\emptyset}', element(:empty).to_latex)
|
227
|
-
#~ assert_equal( '??', element(:empty).to_context)
|
228
|
-
assert_equal( '_', element(:'_').to_html)
|
229
|
-
assert_equal( '_', element(:underscore).to_html)
|
230
|
-
assert_equal( '\_', element(:'_').to_latex)
|
231
|
-
#~ assert_equal( '??', element(:'_').to_context)
|
232
|
-
assert_equal( '\_', element(:underscore).to_latex)
|
233
|
-
#~ assert_equal( '??', element(:underscore).to_context)
|
234
|
-
assert_equal( '•', element(:bullet).to_html)
|
235
|
-
assert_equal( '\ensuremath{\bullet}', element(:bullet).to_latex)
|
236
|
-
#~ assert_equal( '??', element(:bullet).to_context)
|
237
|
-
assert_equal( '–', element(:'--').to_html)
|
238
|
-
assert_equal( '–', element(:ndash).to_html)
|
239
|
-
assert_equal( '--', element(:'--').to_latex)
|
240
|
-
#~ assert_equal( '??', element(:'??').to_context)
|
241
|
-
assert_equal( '--', element(:ndash).to_latex)
|
242
|
-
#~ assert_equal( '??', element(:ndash).to_context)
|
243
|
-
assert_equal( '—', element(:'---').to_html)
|
244
|
-
assert_equal( '—', element(:mdash).to_html)
|
245
|
-
assert_equal( '---', element(:'---').to_latex)
|
246
|
-
#~ assert_equal( '??', element(:'??').to_context)
|
247
|
-
assert_equal( '---', element(:mdash).to_latex)
|
248
|
-
#~ assert_equal( '??', element(:mdash).to_context)
|
249
|
-
assert_equal( '†', element(:dagger).to_html)
|
250
|
-
assert_equal( '\dag', element(:dagger).to_latex)
|
251
|
-
#~ assert_equal( '??', element(:dagger).to_context)
|
84
|
+
def test_is_a()
|
85
|
+
|
86
|
+
newline = element(:br)
|
87
|
+
assert_true( newline.is_a?(Element) )
|
88
|
+
assert_true( newline.is_a?(:br) )
|
89
|
+
assert_true( newline.is_a?(:newline) )
|
90
|
+
|
91
|
+
assert_false( newline.is_a?(:zeilenumbruch) )
|
92
|
+
assert_false( newline.is_a?(Symbol) )
|
93
|
+
assert_false( newline.is_a?(Array) )
|
94
|
+
|
95
|
+
#Standard behaviour: TypeError: class or module required
|
96
|
+
assert_false( newline.to_html(@opt).is_a?(:newline) )
|
97
|
+
assert_false( '<br />'.is_a?(:newline) )
|
98
|
+
|
252
99
|
end
|
100
|
+
|
253
101
|
def test_section()
|
254
102
|
#~ log = Log4r::Logger.new( 'section_logger')
|
255
103
|
#~ log.level = Log4r::ERROR
|
@@ -266,14 +114,14 @@ class Test_elements < Test::Unit::TestCase
|
|
266
114
|
element(:h2, {}, 'Abschnitt 2.1' ).cr,
|
267
115
|
element(:p, {}, 'Text zu Abschnitt 2.1' ).cr
|
268
116
|
]
|
269
|
-
assert_equal_filecontent( "expected/test_section.html", text.to_doc(:html))
|
270
|
-
assert_equal_filecontent( "expected/test_section.latex", text.to_doc(:latex))
|
117
|
+
assert_equal_filecontent( "expected/test_section.html", text.to_doc(:html, @opt))
|
118
|
+
assert_equal_filecontent( "expected/test_section.latex", text.to_doc(:latex, @opt))
|
271
119
|
$log.warn('test_section: to_context')
|
272
|
-
#~ assert_equal_filecontent( "expected/test_section.context", text.to_doc(:context))
|
120
|
+
#~ assert_equal_filecontent( "expected/test_section.context", text.to_doc(:context, @opt))
|
273
121
|
$log.warn('test_section: to_creole')
|
274
|
-
#~ assert_equal_filecontent( "expected/test_section.creole", text.to_doc(:creole))
|
275
|
-
assert_equal_filecontent( "expected/test_section.wiki", text.to_doc(:wiki))
|
276
|
-
assert_equal_filecontent( "expected/test_section.text", text.to_doc(:text))
|
122
|
+
#~ assert_equal_filecontent( "expected/test_section.creole", text.to_doc(:creole, @opt))
|
123
|
+
assert_equal_filecontent( "expected/test_section.wiki", text.to_doc(:wiki,@opt))
|
124
|
+
assert_equal_filecontent( "expected/test_section.text", text.to_doc(:text, @opt))
|
277
125
|
end
|
278
126
|
def test_href()
|
279
127
|
#~ log = Log4r::Logger.new( 'section_logger')
|
@@ -290,59 +138,67 @@ class Test_elements < Test::Unit::TestCase
|
|
290
138
|
element(:a, {:href=>'#ilink'}, 'target.'),
|
291
139
|
] ).cr,
|
292
140
|
]
|
293
|
-
assert_equal_filecontent( "expected/test_href.html", text.to_doc(:html))
|
294
|
-
assert_equal_filecontent( "expected/test_href.latex", text.to_doc(:latex))
|
141
|
+
assert_equal_filecontent( "expected/test_href.html", text.to_doc(:html, @opt))
|
142
|
+
assert_equal_filecontent( "expected/test_href.latex", text.to_doc(:latex, @opt))
|
295
143
|
$log.warn('test_href: to_context')
|
296
|
-
#~ assert_equal_filecontent( "expected/test_href.context", text.to_doc(:context))
|
144
|
+
#~ assert_equal_filecontent( "expected/test_href.context", text.to_doc(:context, @opt))
|
297
145
|
$log.warn('test_href: to_creole')
|
298
|
-
#~ assert_equal_filecontent( "expected/test_href.creole", text.to_doc(:creole))
|
299
|
-
#~ assert_equal_filecontent( "expected/test_href.wiki", text.to_doc(:wiki))
|
300
|
-
assert_equal_filecontent( "expected/test_href.text", text.to_doc(:text)) #not good
|
146
|
+
#~ assert_equal_filecontent( "expected/test_href.creole", text.to_doc(:creole, @opt))
|
147
|
+
#~ assert_equal_filecontent( "expected/test_href.wiki", text.to_doc(:wiki,@opt))
|
148
|
+
assert_equal_filecontent( "expected/test_href.text", text.to_doc(:text, @opt)) #not good
|
301
149
|
end
|
302
150
|
end #Test_elements
|
303
151
|
|
304
152
|
class Test_lists < Test::Unit::TestCase
|
153
|
+
def setup()
|
154
|
+
#Avoid warnings about missing logger in to_doc
|
155
|
+
@opt = { :log => DOCGENERATOR_DEFAULT_LOGGER } #unless defined? @opt
|
156
|
+
end
|
305
157
|
def test_itemize
|
306
158
|
ul = element(:ul, {}, [
|
307
159
|
element(:li, {}, 'Listpunkt 1'),
|
308
160
|
])
|
309
|
-
assert_equal_filecontent( "expected/test_itemize.html", ul.to_doc(:html))
|
310
|
-
assert_equal_filecontent( "expected/test_itemize.latex", ul.to_doc(:latex))
|
311
|
-
assert_equal_filecontent( "expected/test_itemize.context", ul.to_doc(:context))
|
161
|
+
assert_equal_filecontent( "expected/test_itemize.html", ul.to_doc(:html, @opt))
|
162
|
+
assert_equal_filecontent( "expected/test_itemize.latex", ul.to_doc(:latex, @opt))
|
163
|
+
assert_equal_filecontent( "expected/test_itemize.context", ul.to_doc(:context, @opt))
|
312
164
|
$log.warn('test_itemize: to_creole')
|
313
|
-
#~ assert_equal_filecontent( "expected/test_itemize.creole", ul.to_doc(:creole))
|
314
|
-
assert_equal_filecontent( "expected/test_itemize.wiki", ul.to_doc(:wiki))
|
315
|
-
assert_equal_filecontent( "expected/test_itemize.text", ul.to_doc(:text))
|
165
|
+
#~ assert_equal_filecontent( "expected/test_itemize.creole", ul.to_doc(:creole, @opt))
|
166
|
+
assert_equal_filecontent( "expected/test_itemize.wiki", ul.to_doc(:wiki,@opt))
|
167
|
+
assert_equal_filecontent( "expected/test_itemize.text", ul.to_doc(:text, @opt))
|
316
168
|
end
|
317
169
|
def test_enumerate
|
318
170
|
ol = element(:ol, {}, [
|
319
171
|
element(:li, {}, 'Listpunkt 1'),
|
320
172
|
])
|
321
|
-
assert_equal_filecontent( "expected/test_enumerate.html", ol.to_doc(:html))
|
322
|
-
assert_equal_filecontent( "expected/test_enumerate.latex", ol.to_doc(:latex))
|
323
|
-
assert_equal_filecontent( "expected/test_enumerate.context", ol.to_doc(:context))
|
173
|
+
assert_equal_filecontent( "expected/test_enumerate.html", ol.to_doc(:html, @opt))
|
174
|
+
assert_equal_filecontent( "expected/test_enumerate.latex", ol.to_doc(:latex, @opt))
|
175
|
+
assert_equal_filecontent( "expected/test_enumerate.context", ol.to_doc(:context, @opt))
|
324
176
|
$log.warn('test_enumerate: to_creole')
|
325
|
-
#~ assert_equal_filecontent( "expected/test_enumerate.creole", ol.to_doc(:creole))
|
326
|
-
assert_equal_filecontent( "expected/test_enumerate.wiki", ol.to_doc(:wiki))
|
327
|
-
assert_equal_filecontent( "expected/test_enumerate.text", ol.to_doc(:text))
|
177
|
+
#~ assert_equal_filecontent( "expected/test_enumerate.creole", ol.to_doc(:creole, @opt))
|
178
|
+
assert_equal_filecontent( "expected/test_enumerate.wiki", ol.to_doc(:wiki,@opt))
|
179
|
+
assert_equal_filecontent( "expected/test_enumerate.text", ol.to_doc(:text, @opt))
|
328
180
|
end
|
329
181
|
def test_description
|
330
182
|
description = element(:description, {}, [
|
331
183
|
element(:dt, {}, 'Top 1'),
|
332
184
|
element(:dd, {}, 'Listpunkt 1'),
|
333
185
|
])
|
334
|
-
assert_equal_filecontent( "expected/test_description.html", description.to_doc(:html))
|
335
|
-
assert_equal_filecontent( "expected/test_description.latex", description.to_doc(:latex))
|
186
|
+
assert_equal_filecontent( "expected/test_description.html", description.to_doc(:html, @opt))
|
187
|
+
assert_equal_filecontent( "expected/test_description.latex", description.to_doc(:latex, @opt))
|
336
188
|
$log.warn('test_description: to_context')
|
337
|
-
#~ assert_equal_filecontent( "expected/test_description.context", description.to_doc(:context))
|
189
|
+
#~ assert_equal_filecontent( "expected/test_description.context", description.to_doc(:context, @opt))
|
338
190
|
$log.warn('test_description: to_creole')
|
339
|
-
#~ assert_equal_filecontent( "expected/test_description.creole", description.to_doc(:creole))
|
340
|
-
assert_equal_filecontent( "expected/test_description.wiki", description.to_doc(:wiki))
|
341
|
-
assert_equal_filecontent( "expected/test_description.text", description.to_doc(:text))
|
191
|
+
#~ assert_equal_filecontent( "expected/test_description.creole", description.to_doc(:creole, @opt))
|
192
|
+
assert_equal_filecontent( "expected/test_description.wiki", description.to_doc(:wiki,@opt))
|
193
|
+
assert_equal_filecontent( "expected/test_description.text", description.to_doc(:text, @opt))
|
342
194
|
end
|
343
195
|
end #Test_lists
|
344
196
|
|
345
197
|
class Test_footnotes < Test::Unit::TestCase
|
198
|
+
def setup()
|
199
|
+
#Avoid warnings about missing logger in to_doc
|
200
|
+
@opt = { :log => DOCGENERATOR_DEFAULT_LOGGER } #unless defined? @opt
|
201
|
+
end
|
346
202
|
def test_footnote
|
347
203
|
footnotegroup = Footnotegroup.new()
|
348
204
|
#~ footnotegroup = nil
|
@@ -357,14 +213,14 @@ class Test_footnotes < Test::Unit::TestCase
|
|
357
213
|
element(:h2, {}, 'Footnotes' ).cr,
|
358
214
|
footnotegroup,
|
359
215
|
]
|
360
|
-
assert_equal_filecontent( "expected/test_footnote.html", text.to_doc(:html))
|
361
|
-
assert_equal_filecontent( "expected/test_footnote.latex", text.to_doc(:latex))
|
216
|
+
assert_equal_filecontent( "expected/test_footnote.html", text.to_doc(:html, @opt))
|
217
|
+
assert_equal_filecontent( "expected/test_footnote.latex", text.to_doc(:latex, @opt))
|
362
218
|
$log.warn('test_footnote: to_context')
|
363
|
-
#~ assert_equal_filecontent( "expected/test_footnote.context", text.to_doc(:context))
|
219
|
+
#~ assert_equal_filecontent( "expected/test_footnote.context", text.to_doc(:context, @opt))
|
364
220
|
$log.warn('test_footnote: to_creole')
|
365
|
-
#~ assert_equal_filecontent( "expected/test_footnote.creole", text.to_doc(:creole))
|
366
|
-
#~ assert_equal_filecontent( "expected/test_footnote.wiki", text.to_doc(:wiki))
|
367
|
-
#~ assert_equal_filecontent( "expected/test_footnote.text", text.to_doc(:text))
|
221
|
+
#~ assert_equal_filecontent( "expected/test_footnote.creole", text.to_doc(:creole, @opt))
|
222
|
+
#~ assert_equal_filecontent( "expected/test_footnote.wiki", text.to_doc(:wiki,@opt))
|
223
|
+
#~ assert_equal_filecontent( "expected/test_footnote.text", text.to_doc(:text, @opt))
|
368
224
|
end #test_footnote
|
369
225
|
def test_footnote_group
|
370
226
|
footnotegroup = Footnotegroup.new()
|
@@ -383,18 +239,22 @@ class Test_footnotes < Test::Unit::TestCase
|
|
383
239
|
element(:h3, {}, 'Footnotes of group 1' ).cr,
|
384
240
|
footnotegroup2,
|
385
241
|
]
|
386
|
-
assert_equal_filecontent( "expected/test_footnote_group.html", text.to_doc(:html))
|
387
|
-
assert_equal_filecontent( "expected/test_footnote_group.latex", text.to_doc(:latex))
|
242
|
+
assert_equal_filecontent( "expected/test_footnote_group.html", text.to_doc(:html, @opt))
|
243
|
+
assert_equal_filecontent( "expected/test_footnote_group.latex", text.to_doc(:latex, @opt))
|
388
244
|
$log.warn('test_footnote_group: to_context')
|
389
|
-
#~ assert_equal_filecontent( "expected/test_footnote_group.context", text.to_doc(:context))
|
245
|
+
#~ assert_equal_filecontent( "expected/test_footnote_group.context", text.to_doc(:context, @opt))
|
390
246
|
$log.warn('test_footnote_group: to_creole')
|
391
|
-
#~ assert_equal_filecontent( "expected/test_footnote_group.creole", text.to_doc(:creole))
|
392
|
-
#~ assert_equal_filecontent( "expected/test_footnote_group.wiki", text.to_doc(:wiki))
|
393
|
-
#~ assert_equal_filecontent( "expected/test_footnote_group.text", text.to_doc(:text))
|
247
|
+
#~ assert_equal_filecontent( "expected/test_footnote_group.creole", text.to_doc(:creole, @opt))
|
248
|
+
#~ assert_equal_filecontent( "expected/test_footnote_group.wiki", text.to_doc(:wiki,@opt))
|
249
|
+
#~ assert_equal_filecontent( "expected/test_footnote_group.text", text.to_doc(:text, @opt))
|
394
250
|
end #test_footnote
|
395
251
|
end #Test_footnotes
|
396
252
|
|
397
253
|
class Test_tabular < Test::Unit::TestCase
|
254
|
+
def setup()
|
255
|
+
#Avoid warnings about missing logger in to_doc
|
256
|
+
@opt = { :log => DOCGENERATOR_DEFAULT_LOGGER } #unless defined? @opt
|
257
|
+
end
|
398
258
|
def mk_tabular( columns, lines )
|
399
259
|
|
400
260
|
tab = element(:tabular, {
|
@@ -425,23 +285,23 @@ class Test_tabular < Test::Unit::TestCase
|
|
425
285
|
end
|
426
286
|
def test_tabular()
|
427
287
|
text = mk_tabular( Array('A'..'D'), Array(1..5) )
|
428
|
-
assert_equal_filecontent( "expected/test_tabular.html", text.to_doc(:html))
|
288
|
+
assert_equal_filecontent( "expected/test_tabular.html", text.to_doc(:html, @opt))
|
429
289
|
#The line ends will be \\\\
|
430
290
|
#In usage in documents, it's converted into \\.
|
431
291
|
#
|
432
292
|
#~ doc = Document.new()
|
433
|
-
#~ doc.body << text.to_doc(:latex)
|
293
|
+
#~ doc.body << text.to_doc(:latex, @opt)
|
434
294
|
#~ doc.save('Test.tex') #\\ is ok
|
435
295
|
#
|
436
296
|
#~ $fixmes << "tabular/latex: tablines line 229 ../lib/docgenerator_tabular.rb#229"
|
437
|
-
assert_equal_filecontent( "expected/test_tabular.latex", text.to_doc(:latex))
|
297
|
+
assert_equal_filecontent( "expected/test_tabular.latex", text.to_doc(:latex, @opt))
|
438
298
|
$log.warn('test_tabular: to_context')
|
439
|
-
#~ assert_equal_filecontent( "expected/test_tabular.context", text.to_doc(:context))
|
299
|
+
#~ assert_equal_filecontent( "expected/test_tabular.context", text.to_doc(:context, @opt))
|
440
300
|
$log.warn('test_tabular: to_creole')
|
441
|
-
#~ assert_equal_filecontent( "expected/test_tabular.creole", text.to_doc(:creole))
|
442
|
-
assert_equal_filecontent( "expected/test_tabular.wiki", text.to_doc(:wiki))
|
301
|
+
#~ assert_equal_filecontent( "expected/test_tabular.creole", text.to_doc(:creole, @opt))
|
302
|
+
assert_equal_filecontent( "expected/test_tabular.wiki", text.to_doc(:wiki,@opt))
|
443
303
|
$log.warn("text-output for tables")
|
444
|
-
#~ assert_equal_filecontent( "expected/test_tabular.text", text.to_doc(:text))
|
304
|
+
#~ assert_equal_filecontent( "expected/test_tabular.text", text.to_doc(:text, @opt))
|
445
305
|
end
|
446
306
|
def test_tabular_doc()
|
447
307
|
doc = Document.new()
|
@@ -451,7 +311,7 @@ class Test_tabular < Test::Unit::TestCase
|
|
451
311
|
#~ doc.log.outputters = Log4r::StdoutOutputter.new('test_section')
|
452
312
|
#~ doc.log.level = Log4r::INFO
|
453
313
|
|
454
|
-
#~ assert_equal_filecontent( "expected/test_tabular_doc.html", text.to_doc(:html))
|
314
|
+
#~ assert_equal_filecontent( "expected/test_tabular_doc.html", text.to_doc(:html, @opt))
|
455
315
|
|
456
316
|
#The row ends in tabulars are \\.
|
457
317
|
#When used in documents, \\ is converted into \.
|
@@ -459,45 +319,52 @@ class Test_tabular < Test::Unit::TestCase
|
|
459
319
|
assert_equal_filecontent( "expected/test_tabular_doc.latex", doc.to_doc(:latex,
|
460
320
|
{ :log => doc.log, :template=> DocumentTemplate[:article], :filename => 'test'}
|
461
321
|
) )
|
462
|
-
#~ assert_equal_filecontent( "expected/test_tabular_doc.wiki", text.to_doc(:wiki))
|
463
|
-
#~ assert_equal_filecontent( "expected/test_tabular_doc.text", text.to_doc(:text))
|
322
|
+
#~ assert_equal_filecontent( "expected/test_tabular_doc.wiki", text.to_doc(:wiki,@opt))
|
323
|
+
#~ assert_equal_filecontent( "expected/test_tabular_doc.text", text.to_doc(:text, @opt))
|
464
324
|
end
|
465
325
|
end
|
466
326
|
|
467
327
|
|
468
328
|
class Test_Verbatim < Test::Unit::TestCase
|
469
|
-
|
329
|
+
def setup()
|
330
|
+
#Avoid warnings about missing logger in to_doc
|
331
|
+
@opt = { :log => DOCGENERATOR_DEFAULT_LOGGER } #unless defined? @opt
|
332
|
+
end
|
333
|
+
def test_verbatim()
|
470
334
|
text = element(:verbatim,{}, <<verb
|
471
335
|
Verbatim text
|
472
336
|
second line
|
473
337
|
verb
|
474
338
|
)
|
475
|
-
assert_equal_filecontent( "expected/test_verbatim.html", text.to_doc(:html))
|
476
|
-
assert_equal_filecontent( "expected/test_verbatim.latex", text.to_doc(:latex))
|
339
|
+
assert_equal_filecontent( "expected/test_verbatim.html", text.to_doc(:html, @opt))
|
340
|
+
assert_equal_filecontent( "expected/test_verbatim.latex", text.to_doc(:latex, @opt))
|
477
341
|
$log.warn('test_verbatim: to_context')
|
478
|
-
#~ assert_equal_filecontent( "expected/test_verbatim.context", text.to_doc(:context))
|
342
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.context", text.to_doc(:context, @opt))
|
479
343
|
$log.warn('test_verbatim: to_creole/to_wiki')
|
480
|
-
#~ assert_equal_filecontent( "expected/test_verbatim.creole", text.to_doc(:creole))
|
481
|
-
#~ assert_equal_filecontent( "expected/test_verbatim.wiki", text.to_doc(:wiki))
|
344
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.creole", text.to_doc(:creole, @opt))
|
345
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.wiki", text.to_doc(:wiki,@opt))
|
482
346
|
$log.warn("text-output for verbatim")
|
483
|
-
#~ assert_equal_filecontent( "expected/test_verbatim.text", text.to_doc(:text))
|
347
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.text", text.to_doc(:text, @opt))
|
484
348
|
end
|
485
349
|
def test_verbatim_array()
|
486
350
|
text = element(:verbatim,{}, %w{Verbatim text second line})
|
487
|
-
assert_equal_filecontent( "expected/test_verbatim_array.html", text.to_doc(:html))
|
488
|
-
assert_equal_filecontent( "expected/test_verbatim_array.latex", text.to_doc(:latex))
|
351
|
+
assert_equal_filecontent( "expected/test_verbatim_array.html", text.to_doc(:html, @opt))
|
352
|
+
assert_equal_filecontent( "expected/test_verbatim_array.latex", text.to_doc(:latex, @opt))
|
489
353
|
$log.warn('test_verbatim_array: to_context')
|
490
|
-
#~ assert_equal_filecontent( "expected/test_verbatim.context", text.to_doc(:context))
|
354
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.context", text.to_doc(:context, @opt))
|
491
355
|
$log.warn('test_verbatim_array: to_creole/to_wiki')
|
492
|
-
#~ assert_equal_filecontent( "expected/test_verbatim.creole", text.to_doc(:creole))
|
493
|
-
#~ assert_equal_filecontent( "expected/test_verbatim.wiki", text.to_doc(:wiki))
|
356
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.creole", text.to_doc(:creole, @opt))
|
357
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.wiki", text.to_doc(:wiki,@opt))
|
494
358
|
$log.warn("text-output for verbatim_array")
|
495
|
-
#~ assert_equal_filecontent( "expected/test_verbatim.text", text.to_doc(:text))
|
359
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.text", text.to_doc(:text, @opt))
|
496
360
|
end
|
497
361
|
end #Test_Verbatim
|
498
362
|
|
499
363
|
class Test_CSS < Test::Unit::TestCase
|
500
|
-
|
364
|
+
def setup()
|
365
|
+
#Avoid warnings about missing logger in to_doc
|
366
|
+
@opt = { :log => DOCGENERATOR_DEFAULT_LOGGER } #unless defined? @opt
|
367
|
+
end
|
501
368
|
def test_html_css()
|
502
369
|
text = [
|
503
370
|
element(:div,{}, [ 'Block 1',
|
@@ -510,34 +377,32 @@ class Test_CSS < Test::Unit::TestCase
|
|
510
377
|
'Ende Block 1',
|
511
378
|
]).cr
|
512
379
|
]
|
513
|
-
assert_equal_filecontent( "expected/test_html_css.html", text.to_doc(:html))
|
380
|
+
assert_equal_filecontent( "expected/test_html_css.html", text.to_doc(:html, @opt))
|
514
381
|
end
|
515
382
|
def test_css()
|
516
383
|
css = CSS.new(
|
517
384
|
:color => 'red',
|
518
385
|
:background_color => 'blue'
|
519
386
|
)
|
520
|
-
assert_equal_filecontent( "expected/test_css.css", css.to_html)
|
387
|
+
assert_equal_filecontent( "expected/test_css.css", css.to_html(@opt))
|
521
388
|
css[:float] = 'right'
|
522
|
-
assert_equal_filecontent( "expected/test_css2.css", css.to_html)
|
389
|
+
assert_equal_filecontent( "expected/test_css2.css", css.to_html(@opt))
|
523
390
|
end
|
524
391
|
#The data for CSS are checked, warnings and error are returned.
|
525
392
|
def test_css_error()
|
526
|
-
|
527
|
-
|
528
|
-
assert_equal('', get_temporary_logger(templogfile))
|
393
|
+
css = CSS.new( :color => 'red', :log => $log_array)
|
394
|
+
assert_equal('', $log_array_outputter.flush.join)
|
529
395
|
|
530
|
-
templogfile = set_temporary_logger()
|
531
396
|
css[:color] = 'black'
|
532
|
-
assert_equal(" WARN docgenerator: CSS: Overwrite :color\n",
|
397
|
+
assert_equal(" WARN docgenerator: CSS: Overwrite :color\n", $log_array_outputter.flush.join)
|
533
398
|
|
534
|
-
templogfile = set_temporary_logger()
|
535
399
|
css[:background_color] = 'nocolor'
|
536
|
-
assert_equal("ERROR docgenerator: CSS: nocolor not allowed for background-color\n",
|
400
|
+
assert_equal("ERROR docgenerator: CSS: nocolor not allowed for background-color\n", $log_array_outputter.flush.join)
|
537
401
|
|
538
|
-
|
402
|
+
#logger must be reset to clear result for the test.
|
403
|
+
css = CSS.new( :color => 'red', :log => $log_array)
|
539
404
|
css[:nonsense] = 'not valid'
|
540
|
-
assert_equal("ERROR docgenerator: CSS: Undefined key :nonsense\n",
|
405
|
+
assert_equal("ERROR docgenerator: CSS: Undefined key :nonsense\n", $log_array_outputter.flush.join)
|
541
406
|
|
542
407
|
end
|
543
408
|
def test_css_collection_anonym
|
@@ -546,7 +411,7 @@ class Test_CSS < Test::Unit::TestCase
|
|
546
411
|
:font_size => 'xx-small',
|
547
412
|
:font_weight => 'normal'
|
548
413
|
))
|
549
|
-
assert_equal_filecontent( "expected/css_collection_anonym.html", test.style.to_html)
|
414
|
+
assert_equal_filecontent( "expected/css_collection_anonym.html", test.style.to_html(@opt))
|
550
415
|
end
|
551
416
|
def test_css_collection
|
552
417
|
CSS_collection.new(:test, 'CSS to test')
|
@@ -554,10 +419,10 @@ class Test_CSS < Test::Unit::TestCase
|
|
554
419
|
:font_size => 'xx-small',
|
555
420
|
:font_weight => 'normal'
|
556
421
|
))
|
557
|
-
assert_equal_filecontent( "expected/css_collection.html", CSS_collection[:test].style.to_html)
|
422
|
+
assert_equal_filecontent( "expected/css_collection.html", CSS_collection[:test].style.to_html(@opt))
|
558
423
|
end
|
559
424
|
def test_css_collection_toc
|
560
|
-
assert_equal_filecontent( "expected/toc_css.css", CSS_collection[:toc].style.to_html)
|
425
|
+
assert_equal_filecontent( "expected/toc_css.css", CSS_collection[:toc].style.to_html(@opt))
|
561
426
|
end
|
562
427
|
end
|
563
428
|
|
@@ -566,7 +431,10 @@ end
|
|
566
431
|
#- The <<prefix>> is replaced by Document.save.
|
567
432
|
#- With <<prefix>> we get always differences (timestamp)
|
568
433
|
class Test_document < Test::Unit::TestCase
|
569
|
-
|
434
|
+
def setup()
|
435
|
+
#Avoid warnings about missing logger in to_doc
|
436
|
+
@opt = { :log => DOCGENERATOR_DEFAULT_LOGGER } #unless defined? @opt
|
437
|
+
end
|
570
438
|
def test_document()
|
571
439
|
doc = Document.new(
|
572
440
|
:title => 'Testdokument',
|
@@ -641,7 +509,10 @@ class Test_document < Test::Unit::TestCase
|
|
641
509
|
end
|
642
510
|
end #Test_document < Test::Unit::TestCase
|
643
511
|
class Test_document_toc < Test::Unit::TestCase
|
644
|
-
|
512
|
+
def setup()
|
513
|
+
#Avoid warnings about missing logger in to_doc
|
514
|
+
@opt = { :log => DOCGENERATOR_DEFAULT_LOGGER } #unless defined? @opt
|
515
|
+
end
|
645
516
|
def test_document_toc()
|
646
517
|
doc = Document.new(
|
647
518
|
:title => 'Testdokument for toc-command'
|
@@ -661,14 +532,14 @@ class Test_document_toc < Test::Unit::TestCase
|
|
661
532
|
element(:h1, {:id=>'sect3'}, 'Abschnitt 3' ).cr,
|
662
533
|
]
|
663
534
|
|
664
|
-
assert_equal_filecontent( "expected/test_document_toc_single.html", doc.toc( :tocfilename => 'test.html/').to_doc(:html))
|
665
|
-
assert_equal_filecontent( "expected/test_document_toc_single.latex", doc.toc().to_doc(:latex))
|
535
|
+
assert_equal_filecontent( "expected/test_document_toc_single.html", doc.toc( :tocfilename => 'test.html/').to_doc(:html, @opt))
|
536
|
+
assert_equal_filecontent( "expected/test_document_toc_single.latex", doc.toc().to_doc(:latex, @opt))
|
666
537
|
$log.warn('test_document_toc_single: to_context')
|
667
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_single.context", doc.toc().to_doc(:context))
|
538
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_single.context", doc.toc().to_doc(:context, @opt))
|
668
539
|
$log.warn('test_document_toc_single: to_creole')
|
669
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_single.creole", doc.toc().to_doc(:creole))
|
540
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_single.creole", doc.toc().to_doc(:creole, @opt))
|
670
541
|
#Normaly, the standard tableofcontents is used
|
671
|
-
assert_equal( "\\tableofcontents ", element(:tableofcontents).to_doc(:latex))
|
542
|
+
assert_equal( "\\tableofcontents ", element(:tableofcontents).to_doc(:latex, @opt))
|
672
543
|
|
673
544
|
{
|
674
545
|
:html => :html,
|
@@ -691,21 +562,21 @@ class Test_document_toc < Test::Unit::TestCase
|
|
691
562
|
|
692
563
|
#Test with pre and post
|
693
564
|
prepost = { :pre => 'Pretext', :post => 'Posttext' }
|
694
|
-
assert_equal_filecontent( "expected/test_document_toc_single_pre.html", doc.toc( prepost).to_doc(:html))
|
695
|
-
assert_equal_filecontent( "expected/test_document_toc_single_pre.latex", doc.toc(prepost).to_doc(:latex))
|
565
|
+
assert_equal_filecontent( "expected/test_document_toc_single_pre.html", doc.toc( prepost).to_doc(:html, @opt))
|
566
|
+
assert_equal_filecontent( "expected/test_document_toc_single_pre.latex", doc.toc(prepost).to_doc(:latex, @opt))
|
696
567
|
$log.warn('test_document_toc_single_pre: to_context')
|
697
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_single_pre.context", doc.toc(prepost).to_doc(:context))
|
568
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_single_pre.context", doc.toc(prepost).to_doc(:context, @opt))
|
698
569
|
$log.warn('test_document_toc_single_pre: to_creole')
|
699
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_single_pre.creole", doc.toc(prepost).to_doc(:creole))
|
570
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_single_pre.creole", doc.toc(prepost).to_doc(:creole, @opt))
|
700
571
|
|
701
572
|
testel = element(:ul,{},[element(:li,{},'1'),element(:li,{},'2')])
|
702
573
|
prepost = { :pre => testel , :post => testel }
|
703
|
-
assert_equal_filecontent( "expected/test_document_toc_single_pre2.html", doc.toc( prepost).to_doc(:html))
|
704
|
-
assert_equal_filecontent( "expected/test_document_toc_single_pre2.latex", doc.toc(prepost).to_doc(:latex))
|
574
|
+
assert_equal_filecontent( "expected/test_document_toc_single_pre2.html", doc.toc( prepost).to_doc(:html, @opt))
|
575
|
+
assert_equal_filecontent( "expected/test_document_toc_single_pre2.latex", doc.toc(prepost).to_doc(:latex, @opt))
|
705
576
|
$log.warn('test_document_toc_single_pre2: to_context')
|
706
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_single_pre2.context", doc.toc(prepost).to_doc(:context))
|
577
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_single_pre2.context", doc.toc(prepost).to_doc(:context, @opt))
|
707
578
|
$log.warn('test_document_toc_single_pre2: to_creole')
|
708
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_single_pre2.creole", doc.toc(prepost).to_doc(:creole))
|
579
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_single_pre2.creole", doc.toc(prepost).to_doc(:creole, @opt))
|
709
580
|
end
|
710
581
|
def test_document_toc_deep()
|
711
582
|
doc = Document.new(
|
@@ -725,26 +596,26 @@ class Test_document_toc < Test::Unit::TestCase
|
|
725
596
|
element(:h4, {}, 'Abschnitt 2.1.1.1' ).cr,
|
726
597
|
element(:h5, {}, 'Abschnitt 2.1.1.1.1' ).cr, ]
|
727
598
|
|
728
|
-
assert_equal_filecontent( "expected/test_document_toc_deep.html", doc.toc().to_doc(:html))
|
729
|
-
assert_equal_filecontent( "expected/test_document_toc_deep.latex", doc.toc().to_doc(:latex))
|
599
|
+
assert_equal_filecontent( "expected/test_document_toc_deep.html", doc.toc().to_doc(:html, @opt))
|
600
|
+
assert_equal_filecontent( "expected/test_document_toc_deep.latex", doc.toc().to_doc(:latex, @opt))
|
730
601
|
$log.warn('test_document_toc_deep: to_context')
|
731
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_deep.context", doc.toc().to_doc(:context))
|
602
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep.context", doc.toc().to_doc(:context, @opt))
|
732
603
|
$log.warn('test_document_toc_deep: to_creole')
|
733
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_deep.creole", doc.toc().to_doc(:creole))
|
604
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep.creole", doc.toc().to_doc(:creole, @opt))
|
734
605
|
|
735
|
-
assert_equal_filecontent( "expected/test_document_toc_deep_1.html", doc.toc(:level=>1).to_doc(:html))
|
736
|
-
assert_equal_filecontent( "expected/test_document_toc_deep_1.latex", doc.toc(:level=>1).to_doc(:latex))
|
606
|
+
assert_equal_filecontent( "expected/test_document_toc_deep_1.html", doc.toc(:level=>1).to_doc(:html, @opt))
|
607
|
+
assert_equal_filecontent( "expected/test_document_toc_deep_1.latex", doc.toc(:level=>1).to_doc(:latex, @opt))
|
737
608
|
$log.warn('test_document_toc_deep_1: to_context')
|
738
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_deep_1.context", doc.toc(:level=>1).to_doc(:context))
|
609
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep_1.context", doc.toc(:level=>1).to_doc(:context, @opt))
|
739
610
|
$log.warn('test_document_toc_deep_1: to_creole')
|
740
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_deep_1.creole", doc.toc(:level=>1).to_doc(:creole))
|
611
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep_1.creole", doc.toc(:level=>1).to_doc(:creole, @opt))
|
741
612
|
|
742
|
-
assert_equal_filecontent( "expected/test_document_toc_deep_4.html", doc.toc(:level=>4).to_doc(:html))
|
743
|
-
assert_equal_filecontent( "expected/test_document_toc_deep_4.latex", doc.toc(:level=>4).to_doc(:latex))
|
613
|
+
assert_equal_filecontent( "expected/test_document_toc_deep_4.html", doc.toc(:level=>4).to_doc(:html, @opt))
|
614
|
+
assert_equal_filecontent( "expected/test_document_toc_deep_4.latex", doc.toc(:level=>4).to_doc(:latex, @opt))
|
744
615
|
$log.warn('test_document_toc_deep_4: to_context')
|
745
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_deep_4.context", doc.toc(:level=>4).to_doc(:context))
|
616
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep_4.context", doc.toc(:level=>4).to_doc(:context, @opt))
|
746
617
|
$log.warn('test_document_toc_deep_4: to_creole')
|
747
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_deep_4.creole", doc.toc(:level=>4).to_doc(:creole))
|
618
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep_4.creole", doc.toc(:level=>4).to_doc(:creole, @opt))
|
748
619
|
|
749
620
|
end
|
750
621
|
def test_document_toc_deep_err()
|
@@ -770,28 +641,31 @@ class Test_document_toc < Test::Unit::TestCase
|
|
770
641
|
element(:h4, {}, 'Abschnitt 3.1.1.1' ).cr,
|
771
642
|
]
|
772
643
|
|
773
|
-
|
774
|
-
assert_equal_filecontent( "expected/test_document_toc_deep_err.html", doc.toc(:level=>4, :log =>
|
775
|
-
assert_equal_filecontent( "expected/test_document_toc_deep_err.log",
|
644
|
+
$log_array.level = Log4r::WARN
|
645
|
+
assert_equal_filecontent( "expected/test_document_toc_deep_err.html", doc.toc(:level=>4, :log => $log_array).to_doc(:html, @opt))
|
646
|
+
assert_equal_filecontent( "expected/test_document_toc_deep_err.log", $log_array_outputter.flush.join)
|
647
|
+
$log_array.level = Log4r::DEBUG #back again.
|
776
648
|
|
777
|
-
assert_equal_filecontent( "expected/test_document_toc_deep_err.latex", doc.toc().to_doc(:latex))
|
649
|
+
assert_equal_filecontent( "expected/test_document_toc_deep_err.latex", doc.toc().to_doc(:latex, @opt))
|
778
650
|
$log.warn('test_document_toc_deep_err: to_context')
|
779
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_deep_err.context", doc.toc().to_doc(:context))
|
651
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep_err.context", doc.toc().to_doc(:context, @opt))
|
780
652
|
$log.warn('test_document_toc_deep_err: to_creole')
|
781
|
-
#~ assert_equal_filecontent( "expected/test_document_toc_deep_err.creole", doc.toc().to_doc(:creole))
|
653
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep_err.creole", doc.toc().to_doc(:creole, @opt))
|
782
654
|
|
783
655
|
end
|
784
656
|
|
785
657
|
end
|
786
658
|
|
787
659
|
class Test_usepackage < Test::Unit::TestCase
|
788
|
-
|
660
|
+
def setup()
|
661
|
+
#Avoid warnings about missing logger in to_doc
|
662
|
+
@opt = { :log => DOCGENERATOR_DEFAULT_LOGGER } #unless defined? @opt
|
663
|
+
end
|
789
664
|
#
|
790
665
|
#If an unknown package is requested, you get an information.
|
791
666
|
def test_usepackage_unknown()
|
792
|
-
|
793
|
-
|
794
|
-
assert_equal_filecontent( "expected/test_document_usepackage_undefined.log", get_temporary_logger(templogfile))
|
667
|
+
element(:usepackage,{:log => $log_array },'undefined package')
|
668
|
+
assert_equal_filecontent( "expected/test_document_usepackage_undefined.log", $log_array_outputter.flush.join)
|
795
669
|
end
|
796
670
|
#Known packages 'require' new ruby packages.
|
797
671
|
def test_usepackage_pdfpages()
|
@@ -803,10 +677,10 @@ class Test_usepackage < Test::Unit::TestCase
|
|
803
677
|
req_diff = $" - old_required
|
804
678
|
assert_equal( 1, req_diff.size )
|
805
679
|
#Ruby 1.9 has full path, Ruby 1.8 only require-parameter
|
806
|
-
assert_match( %r{packages/
|
680
|
+
assert_match( %r{docgenerator/packages/pdfpages.rb}, req_diff.first )
|
807
681
|
|
808
|
-
assert_equal( '\usepackage{pdfpages}', usepackage_element.to_latex)
|
809
|
-
assert_equal( '', usepackage_element.to_html)
|
682
|
+
assert_equal( '\usepackage{pdfpages}', usepackage_element.to_latex(@opt))
|
683
|
+
assert_equal( '', usepackage_element.to_html(@opt))
|
810
684
|
|
811
685
|
end #test_usepackage_pdfpages()
|
812
686
|
end
|