docgenerator 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/examples/docgenerator_example.rb +34 -17
- data/examples/docgenerator_example_footnote.rb +82 -61
- data/examples/docgenerator_example_list.rb +24 -18
- data/examples/docgenerator_example_restrictions.rb +17 -27
- data/examples/docgenerator_example_tabular.rb +20 -20
- data/examples/docgenerator_example_tripfalls.rb +28 -20
- data/examples/results/readme +1 -0
- data/examples/results_expected/docgenerator_example.html +39 -0
- data/examples/results_expected/docgenerator_example.pdf +0 -0
- data/examples/results_expected/docgenerator_example.tex +56 -0
- data/examples/results_expected/docgenerator_example_footnote.html +40 -0
- data/examples/results_expected/docgenerator_example_footnote.pdf +0 -0
- data/examples/results_expected/docgenerator_example_footnote.tex +50 -0
- data/examples/results_expected/docgenerator_example_list.html +18 -0
- data/examples/results_expected/docgenerator_example_list.pdf +0 -0
- data/examples/results_expected/docgenerator_example_list.tex +46 -0
- data/examples/results_expected/docgenerator_example_restrictions.html +22 -0
- data/examples/results_expected/docgenerator_example_restrictions.pdf +0 -0
- data/examples/results_expected/docgenerator_example_restrictions.tex +31 -0
- data/examples/results_expected/docgenerator_example_tabular.html +37 -0
- data/examples/results_expected/docgenerator_example_tabular.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tabular.tex +41 -0
- data/examples/results_expected/docgenerator_example_tripfalls.html +27 -0
- data/examples/results_expected/docgenerator_example_tripfalls.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tripfalls.tex +31 -0
- data/lib/creole/creole2doc.rb +291 -140
- data/lib/creole/creole_inclusion_and_plugins.rb +142 -39
- data/lib/creole/creole_placeholder.rb +92 -30
- data/lib/creole/creole_tabular.rb +119 -20
- data/lib/docgenerator.rb +209 -118
- data/lib/{docgenerator_attribute.rb → docgenerator/attribute.rb} +2 -1
- data/lib/{docgenerator_characters.rb → docgenerator/characters.rb} +75 -6
- data/lib/{docgenerator_css.rb → docgenerator/css.rb} +0 -0
- data/lib/docgenerator/document.rb +588 -0
- data/lib/{docgenerator_element.rb → docgenerator/element.rb} +52 -80
- data/lib/{docgenerator_elements.rb → docgenerator/elements.rb} +43 -17
- data/lib/{docgenerator_environments.rb → docgenerator/environments.rb} +20 -6
- data/lib/{docgenerator_footnote.rb → docgenerator/footnote.rb} +22 -18
- data/lib/{docgenerator_lists.rb → docgenerator/lists.rb} +17 -1
- data/lib/{docgenerator_sections.rb → docgenerator/sections.rb} +9 -1
- data/lib/docgenerator/standard.rb +81 -0
- data/lib/{docgenerator_tabular.rb → docgenerator/tabular.rb} +9 -5
- data/lib/packages/docgenerator_listings.rb +9 -5
- data/lib/packages/docgenerator_pdfpages.rb +17 -11
- data/lib/packages/docgenerator_url.rb +0 -2
- data/lib/templates/docgenerator_template.rb +66 -29
- data/lib/templates/docgenerator_template.yaml +18 -0
- data/lib/wiki2doc/wiki2docgenerator.rb +6 -2
- data/readme.rd +132 -0
- data/unittest/expected/test_document_usepackage_undefined.log +2 -0
- data/unittest/expected/test_enumerate.context +4 -0
- data/unittest/expected/test_footnote.html +4 -4
- data/unittest/expected/test_footnote.latex +4 -4
- data/unittest/expected/test_footnote_group.html +6 -6
- data/unittest/expected/test_footnote_group.latex +6 -6
- data/unittest/expected/test_href.html +2 -2
- data/unittest/expected/test_href.latex +2 -2
- data/unittest/expected/test_href.text +2 -2
- data/unittest/expected/test_itemize.context +4 -0
- data/unittest/expected/test_runtex.stdout +3 -0
- data/unittest/expected/test_runtex_2.stdout +3 -0
- data/unittest/expected/test_section.context +20 -0
- data/unittest/expected/test_tabular.html +2 -2
- data/unittest/expected/test_verbatim.html +3 -0
- data/unittest/expected/test_verbatim.latex +4 -0
- data/unittest/expected/test_verbatim_array.html +1 -0
- data/unittest/expected/test_verbatim_array.latex +2 -0
- data/unittest/expected_creole/test_creole_characters_all.html +12 -5
- data/unittest/expected_creole/test_creole_characters_all.latex +20 -6
- data/unittest/expected_creole/test_creole_comment.context +11 -0
- data/unittest/expected_creole/test_creole_comment.creole +12 -0
- data/unittest/expected_creole/test_creole_comment.html +9 -0
- data/unittest/expected_creole/test_creole_comment.latex +11 -0
- data/unittest/expected_creole/test_creole_creole1.0test.html +3 -3
- data/unittest/expected_creole/test_creole_creole1.0test.latex +3 -3
- data/unittest/expected_creole/test_creole_creole1.0test.text +4 -4
- data/unittest/expected_creole/test_creole_ignore.html +3 -0
- data/unittest/expected_creole/test_creole_ignore.latex +4 -0
- data/unittest/expected_creole/test_creole_ignore.text +2 -0
- data/unittest/expected_creole/test_creole_input.normsource +12 -12
- data/unittest/expected_creole/test_creole_input_file_simple.html +15 -0
- data/unittest/expected_creole/test_creole_input_file_simple_readlines.html +15 -0
- data/unittest/expected_creole/test_creole_links_external_implicit.html +2 -2
- data/unittest/expected_creole/test_creole_links_external_implicit.latex +2 -2
- data/unittest/expected_creole/test_creole_links_external_implicit.text +2 -2
- data/unittest/expected_creole/test_creole_links_implicit_end.creole +4 -0
- data/unittest/expected_creole/test_creole_links_implicit_end.html +3 -0
- data/unittest/expected_creole/test_creole_links_implicit_end.latex +4 -0
- data/unittest/expected_creole/test_creole_list_ul.normsource +42 -42
- data/unittest/expected_creole/test_creole_mix_titles_list.html +10 -0
- data/unittest/expected_creole/test_creole_mix_titles_list.latex +18 -0
- data/unittest/expected_creole/test_creole_mix_titles_list.text +12 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource +15 -15
- data/unittest/expected_creole/test_creole_pictures_css.html +4 -1
- data/unittest/expected_creole/test_creole_pictures_css.latex +5 -1
- data/unittest/expected_creole/test_creole_pictures_longdesc.html +3 -0
- data/unittest/expected_creole/test_creole_pictures_width.html +3 -0
- data/unittest/expected_creole/test_creole_pictures_width.latex +4 -0
- data/unittest/expected_creole/test_creole_short_html.html +3 -0
- data/unittest/expected_creole/test_creole_short_html.latex +4 -0
- data/unittest/expected_creole/test_creole_short_html.text +2 -0
- data/unittest/expected_creole/test_creole_shy.creole +6 -0
- data/unittest/expected_creole/test_creole_shy.html +6 -0
- data/unittest/expected_creole/test_creole_shy.latex +8 -0
- data/unittest/expected_creole/test_creole_shy.text +4 -0
- data/unittest/expected_creole/test_creole_tabular_with_cell_option.html +20 -0
- data/unittest/expected_creole/test_creole_toc.html +3 -1
- data/unittest/expected_creole/test_creole_toc.latex +1 -1
- data/unittest/expected_creole/test_creole_toc.text +1 -1
- data/unittest/expected_creole/test_creole_toc_level.html +7 -0
- data/unittest/expected_creole/test_creole_toc_level.latex +10 -0
- data/unittest/expected_creole/test_creole_toc_level.text +3 -0
- data/unittest/expected_creole/test_creole_toc_level_text.html +8 -0
- data/unittest/expected_creole/test_creole_toc_level_text.latex +9 -0
- data/unittest/expected_creole/test_creole_verbatim.html +1 -1
- data/unittest/expected_creole/test_creole_verbatim.latex +1 -1
- data/unittest/expected_creole/test_creole_verbatim.text +1 -1
- data/unittest/expected_creole/test_creole_verbatim_inline.html +1 -1
- data/unittest/expected_creole/test_creole_verbatim_inline.latex +1 -1
- data/unittest/expected_wiki/test_wiki_description.html +5 -5
- data/unittest/expected_wiki/test_wiki_description.latex +5 -5
- data/unittest/expected_wiki/test_wiki_description.text +5 -5
- data/unittest/expected_wiki/test_wiki_description.wiki +5 -5
- data/unittest/test_rakefile_docgenerator.rb +43 -0
- data/unittest/unittest_creole2doc.rb +415 -27
- data/unittest/unittest_docgenerator.rb +256 -23
- data/unittest/unittest_docgenerator_runtex.rb +83 -0
- data/unittest/unittest_versions.rb +44 -0
- data/unittest/unittest_wiki2doc.rb +28 -27
- metadata +473 -106
- data/lib/docgenerator_document.rb +0 -525
- data/lib/packages/docgenerator_beamer.rb +0 -253
- data/lib/yaml2presentation/yaml2presentation.rb +0 -1091
- data/unittest/expected/beamer_01_article.tex +0 -13
- data/unittest/expected/beamer_01_attachment.tex +0 -15
- data/unittest/expected/beamer_01_doc.html +0 -13
- data/unittest/expected/beamer_01_doc.tex +0 -18
- data/unittest/expected/beamer_01_notes_only.tex +0 -13
- data/unittest/expected/beamer_01_notes_onlyslideswithnotes.tex +0 -13
- data/unittest/expected/beamer_01_notes_show.tex +0 -13
- data/unittest/expected/beamer_01_presentation.tex +0 -13
- data/unittest/expected/beamer_02_doc.html +0 -29
- data/unittest/expected/beamer_02_doc.tex +0 -34
- data/unittest/expected/beamer_block.html +0 -1
- data/unittest/expected/beamer_block.latex +0 -1
- data/unittest/expected/beamer_doc_fragile_doc.tex +0 -33
- data/unittest/expected/beamer_doc_html_overview_with_detailpic_and_text_doc.html +0 -34
- data/unittest/expected/beamer_doc_html_overview_with_detailpic_doc.html +0 -34
- data/unittest/expected/beamer_doc_key_doc.html +0 -20
- data/unittest/expected/beamer_doc_key_doc.tex +0 -29
- data/unittest/expected/beamer_doc_note_doc.html +0 -30
- data/unittest/expected/beamer_doc_note_doc.tex +0 -37
- data/unittest/expected/beamer_doc_pic_bottom_doc.html +0 -24
- data/unittest/expected/beamer_doc_pic_doc.html +0 -24
- data/unittest/expected/beamer_doc_pic_doc.tex +0 -28
- data/unittest/expected/beamer_doc_pic_left_doc.html +0 -24
- data/unittest/expected/beamer_doc_pic_left_doc.tex +0 -28
- data/unittest/expected/beamer_doc_pic_ratio_doc.tex +0 -29
- data/unittest/expected/beamer_doc_pic_right_doc.html +0 -24
- data/unittest/expected/beamer_doc_pic_right_doc.tex +0 -28
- data/unittest/expected/beamer_doc_pic_top_doc.html +0 -24
- data/unittest/expected/beamer_frame.html +0 -5
- data/unittest/expected/beamer_frame.tex +0 -11
- data/unittest/expected/beamer_frame_fragile.tex +0 -7
- data/unittest/expected/beamer_frame_id.html +0 -1
- data/unittest/expected/beamer_frame_id.tex +0 -4
- data/unittest/expected/beamer_framepic.html +0 -5
- data/unittest/expected/beamer_framepic.latex +0 -1
- data/unittest/expected/beamer_framepic_link.html +0 -5
- data/unittest/expected/beamer_framepic_link.latex +0 -1
- data/unittest/expected/beamer_frametitle.html +0 -1
- data/unittest/expected/beamer_frametitle.latex +0 -1
- data/unittest/expected/beamer_note.html +0 -1
- data/unittest/expected/beamer_note.latex +0 -1
- data/unittest/expected_privat/test_creole_test_document.html +0 -6
- data/unittest/expected_wiki/test_wiki_amazon.html +0 -10
- data/unittest/expected_wiki/test_wiki_link.log +0 -3
- data/unittest/test_docgenerator.rb +0 -107
- data/unittest/unittest_yaml2pres.rb +0 -336
|
@@ -1,9 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
$:.unshift('C:/usr/Script/more_unit_test/lib')
|
|
4
|
+
require 'more_unit_test/assert_equal_filecontent.rb'
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
if $0 == __FILE__
|
|
7
|
+
$:.unshift("../lib")
|
|
8
|
+
end
|
|
9
|
+
require 'docgenerator'
|
|
10
|
+
|
|
11
|
+
#~ Element::SUPPORTED_TARGETS << :context
|
|
12
|
+
#~ Element::SUPPORTED_TARGETS << :creole
|
|
4
13
|
#~ DOCGENERATOR_LOGGER.level = Log4r::DEBUG
|
|
5
14
|
#~ DOCGENERATOR_LOGGER.level = Log4r::ERROR
|
|
6
15
|
|
|
16
|
+
$log = Log4r::Logger.new('Unittest docgenerator', Log4r::ERROR )
|
|
17
|
+
#~ $log = Log4r::Logger.new('Unittest docgenerator', Log4r::WARN)
|
|
18
|
+
#~ $log = Log4r::Logger.new('Unittest docgenerator', Log4r::INFO)
|
|
19
|
+
$log.outputters = Log4r::StdoutOutputter.new('log_stdout')
|
|
20
|
+
|
|
21
|
+
require 'tempfile' #needed to get logger.data
|
|
22
|
+
#
|
|
23
|
+
#Two methods to catch and check logger content.
|
|
24
|
+
module Temp_Logger
|
|
25
|
+
#Redirect Logger data to temporary file
|
|
26
|
+
def set_temporary_logger( level = Log4r::WARN )
|
|
27
|
+
templogfile = Tempfile.new("xxx_warn.log")
|
|
28
|
+
@loglevel = DOCGENERATOR_LOGGER.level
|
|
29
|
+
@outputter = DOCGENERATOR_LOGGER.outputters.first
|
|
30
|
+
DOCGENERATOR_LOGGER.level = level
|
|
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
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
7
48
|
class Test_elements < Test::Unit::TestCase
|
|
8
49
|
include Temp_Logger
|
|
9
50
|
def test_generell_settings()
|
|
@@ -41,118 +82,173 @@ class Test_elements < Test::Unit::TestCase
|
|
|
41
82
|
assert_equal( ' ', element(:space).to_html)
|
|
42
83
|
assert_equal( ' ', element(:ensp).to_html)
|
|
43
84
|
assert_equal( '~', element(:space).to_latex)
|
|
85
|
+
#~ assert_equal( '??', element(:space).to_context)
|
|
44
86
|
assert_equal( '~', element(:ensp).to_latex)
|
|
87
|
+
#~ assert_equal( '??', element(:ensp).to_context)
|
|
45
88
|
assert_equal( ' ', element(:bigspace).to_html)
|
|
46
89
|
assert_equal( ' ', element(:emsp).to_html)
|
|
47
90
|
assert_equal( '~~', element(:bigspace).to_latex)
|
|
91
|
+
#~ assert_equal( '??', element(:bigspace).to_context)
|
|
48
92
|
assert_equal( '~~', element(:emsp).to_latex)
|
|
93
|
+
#~ assert_equal( '??', element(:emsp).to_context)
|
|
49
94
|
assert_equal( ' ', element(:nbsp).to_html)
|
|
50
95
|
assert_equal( '~', element(:nbsp).to_latex)
|
|
96
|
+
#~ assert_equal( '??', element(:nbsp).to_context)
|
|
51
97
|
assert_equal( '€', element(:euro).to_html)
|
|
52
98
|
assert_equal( '\euro', element(:euro).to_latex)
|
|
99
|
+
#~ assert_equal( '??', element(:euro).to_context)
|
|
53
100
|
assert_equal( '%', element(:percent).to_html)
|
|
54
101
|
assert_equal( '%', element(:'%').to_html)
|
|
55
102
|
assert_equal( '\%', element(:percent).to_latex)
|
|
103
|
+
#~ assert_equal( '??', element(:percent).to_context)
|
|
56
104
|
assert_equal( '\%', element(:'%').to_latex)
|
|
105
|
+
#~ assert_equal( '??', element(:'%').to_context)
|
|
57
106
|
assert_equal( '^', element(:'^').to_html)
|
|
58
107
|
assert_equal( '\hat{}', element(:'^').to_latex)
|
|
108
|
+
#~ assert_equal( '??', element(:'^').to_context)
|
|
59
109
|
assert_equal( '¿', element(:iquest).to_html)
|
|
60
|
-
assert_equal( '
|
|
110
|
+
assert_equal( '¿', element(:iquest).to_latex)
|
|
111
|
+
#~ assert_equal( '??', element(:iquest).to_context)
|
|
61
112
|
assert_equal( '&', element(:ampersand).to_html)
|
|
62
113
|
assert_equal( '&', element(:'&').to_html)
|
|
63
114
|
assert_equal( '\&', element(:ampersand).to_latex)
|
|
115
|
+
#~ assert_equal( '??', element(:ampersand).to_context)
|
|
64
116
|
assert_equal( '\&', element(:'&').to_latex)
|
|
117
|
+
#~ assert_equal( '??', element(:'&').to_context)
|
|
65
118
|
assert_equal( '}', element(:rbrace).to_html)
|
|
66
119
|
assert_equal( '}', element(:'}').to_html)
|
|
67
120
|
assert_equal( '\}', element(:rbrace).to_latex)
|
|
121
|
+
#~ assert_equal( '??', element(:rbrace).to_context)
|
|
68
122
|
assert_equal( '\}', element(:'}').to_latex)
|
|
123
|
+
#~ assert_equal( '??', element(:'}').to_context)
|
|
69
124
|
assert_equal( '{', element(:lbrace).to_html)
|
|
70
125
|
assert_equal( '{', element(:'{').to_html)
|
|
71
126
|
assert_equal( '\{', element(:lbrace).to_latex)
|
|
127
|
+
#~ assert_equal( '??', element(:lbrace).to_context)
|
|
72
128
|
assert_equal( '\{', element(:'{').to_latex)
|
|
129
|
+
#~ assert_equal( '??', element(:'{').to_context)
|
|
73
130
|
assert_equal( '\\', element(:backslash).to_html)
|
|
74
131
|
assert_equal( '\ensuremath{\backslash}', element(:backslash).to_latex)
|
|
132
|
+
#~ assert_equal( '??', element(:backslash).to_context)
|
|
75
133
|
assert_equal( '√', element(:radic).to_html)
|
|
76
134
|
assert_equal( '\ensuremath{\sqrt{}}', element(:radic).to_latex)
|
|
135
|
+
#~ assert_equal( '??', element(:radic).to_context)
|
|
77
136
|
assert_equal( '→', element(:rarr).to_html)
|
|
78
137
|
assert_equal( '→', element(:rightarrow).to_html)
|
|
79
138
|
assert_equal( '→', element(:'->').to_html)
|
|
80
139
|
assert_equal( '->', element(:'->').to_text)
|
|
81
140
|
assert_equal( '\ensuremath{\rightarrow}', element(:rarr).to_latex)
|
|
141
|
+
#~ assert_equal( '??', element(:rarr).to_context)
|
|
82
142
|
assert_equal( '\ensuremath{\rightarrow}', element(:rightarrow).to_latex)
|
|
143
|
+
#~ assert_equal( '??', element(:rightarrow).to_context)
|
|
83
144
|
assert_equal( '\ensuremath{\rightarrow}', element(:'->').to_latex)
|
|
145
|
+
#~ assert_equal( '??', element(:'->').to_context)
|
|
84
146
|
assert_equal( '⇒', element(:rArr).to_html)
|
|
85
147
|
assert_equal( '⇒', element(:Rightarrow).to_html)
|
|
86
148
|
assert_equal( '⇒', element(:'=>').to_html)
|
|
87
149
|
assert_equal( '=>', element(:'=>').to_text)
|
|
88
150
|
assert_equal( '\ensuremath{\Rightarrow}', element(:rArr).to_latex)
|
|
151
|
+
#~ assert_equal( '??', element(:rArr).to_context)
|
|
89
152
|
assert_equal( '\ensuremath{\Rightarrow}', element(:Rightarrow).to_latex)
|
|
153
|
+
#~ assert_equal( '??', element(:Rightarrow).to_context)
|
|
90
154
|
assert_equal( '\ensuremath{\Rightarrow}', element(:'=>').to_latex)
|
|
155
|
+
#~ assert_equal( '??', element(:'=>').to_context)
|
|
91
156
|
assert_equal( '←', element(:larr).to_html)
|
|
92
157
|
assert_equal( '←', element(:leftarrow).to_html)
|
|
93
158
|
assert_equal( '←', element(:'<-').to_html)
|
|
94
159
|
assert_equal( '<-', element(:'<-').to_text)
|
|
95
160
|
assert_equal( '\ensuremath{\leftarrow}', element(:larr).to_latex)
|
|
161
|
+
#~ assert_equal( '??', element(:larr).to_context)
|
|
96
162
|
assert_equal( '\ensuremath{\leftarrow}', element(:leftarrow).to_latex)
|
|
163
|
+
#~ assert_equal( '??', element(:leftarrow).to_context)
|
|
97
164
|
assert_equal( '\ensuremath{\leftarrow}', element(:'<-').to_latex)
|
|
165
|
+
#~ assert_equal( '??', element(:'<-').to_context)
|
|
98
166
|
assert_equal( '⇐', element(:lArr).to_html)
|
|
99
167
|
assert_equal( '⇐', element(:Leftarrow).to_html)
|
|
100
168
|
assert_equal( '⇐', element(:'<=').to_html)
|
|
101
169
|
assert_equal( '<=', element(:'<=').to_text)
|
|
102
170
|
assert_equal( '\ensuremath{\Lefttarrow}', element(:lArr).to_latex)
|
|
171
|
+
#~ assert_equal( '??', element(:lArr).to_context)
|
|
103
172
|
assert_equal( '\ensuremath{\Lefttarrow}', element(:Leftarrow).to_latex)
|
|
173
|
+
#~ assert_equal( '??', element(:Leftarrow).to_context)
|
|
104
174
|
assert_equal( '\ensuremath{\Lefttarrow}', element(:'<=').to_latex)
|
|
175
|
+
#~ assert_equal( '??', element(:'<=').to_context)
|
|
105
176
|
assert_equal( '⇑', element(:uArr).to_html)
|
|
106
177
|
assert_equal( '⇑', element(:Uparrow).to_html)
|
|
107
178
|
assert_equal( '\ensuremath{\Uparrow}', element(:uArr).to_latex)
|
|
179
|
+
#~ assert_equal( '??', element(:uArr).to_context)
|
|
108
180
|
assert_equal( '\ensuremath{\Uparrow}', element(:Uparrow).to_latex)
|
|
181
|
+
#~ assert_equal( '??', element(:Uparrow).to_context)
|
|
109
182
|
assert_equal( '<', element(:lt).to_html)
|
|
110
183
|
assert_equal( '<', element(:'<').to_html)
|
|
111
184
|
assert_equal( '\ensuremath{<}', element(:lt).to_latex)
|
|
185
|
+
#~ assert_equal( '??', element(:lt).to_context)
|
|
112
186
|
assert_equal( '\ensuremath{<}', element(:'<').to_latex)
|
|
187
|
+
#~ assert_equal( '??', element(:'<').to_context)
|
|
113
188
|
assert_equal( '>', element(:gt).to_html)
|
|
114
189
|
assert_equal( '>', element(:'>').to_html)
|
|
115
190
|
assert_equal( '\ensuremath{>}', element(:gt).to_latex)
|
|
191
|
+
#~ assert_equal( '??', element(:gt).to_context)
|
|
116
192
|
assert_equal( '\ensuremath{>}', element(:'>').to_latex)
|
|
193
|
+
#~ assert_equal( '??', element(:'>').to_context)
|
|
117
194
|
assert_equal( '∞', element(:infin).to_html)
|
|
118
195
|
assert_equal( '∞', element(:infty).to_html)
|
|
119
196
|
assert_equal( '\ensuremath{\infty}', element(:infin).to_latex)
|
|
197
|
+
#~ assert_equal( '??', element(:infin).to_context)
|
|
120
198
|
assert_equal( '\ensuremath{\infty}', element(:infty).to_latex)
|
|
199
|
+
#~ assert_equal( '??', element(:infty).to_context)
|
|
121
200
|
assert_equal( '÷', element(:divide).to_html)
|
|
122
201
|
assert_equal( '\ensuremath{\div}', element(:divide).to_latex)
|
|
202
|
+
#~ assert_equal( '??', element(:divide).to_context)
|
|
123
203
|
assert_equal( '¥', element(:yen).to_html)
|
|
124
204
|
assert_equal( '∼', element(:sim).to_html)
|
|
125
205
|
assert_equal( '\ensuremath{\sim}', element(:sim).to_latex)
|
|
206
|
+
#~ assert_equal( '??', element(:sim).to_context)
|
|
126
207
|
assert_equal( '¦', element(:brvbar).to_html)
|
|
127
208
|
assert_equal( '|', element(:brvbar).to_latex)
|
|
209
|
+
#~ assert_equal( '??', element(:brvbar).to_context)
|
|
128
210
|
assert_equal( '5€', element(:euros,{},5).to_html)
|
|
129
211
|
assert_equal( '\euros{5}', element(:euros,{},5).to_latex)
|
|
212
|
+
#~ assert_equal( '??', element(:euros,{},5).to_context)
|
|
130
213
|
assert_equal( '¬', element(:neg).to_html)
|
|
131
214
|
assert_equal( '¬', element(:not).to_html)
|
|
132
215
|
assert_equal( '\ensuremath{\neg}', element(:neg).to_latex)
|
|
216
|
+
#~ assert_equal( '??', element(:neg).to_context)
|
|
133
217
|
assert_equal( '\ensuremath{\neg}', element(:not).to_latex)
|
|
218
|
+
#~ assert_equal( '??', element(:not).to_context)
|
|
134
219
|
assert_equal( '×', element(:times).to_html)
|
|
135
220
|
assert_equal( '\ensuremath{\times}', element(:times).to_latex)
|
|
221
|
+
#~ assert_equal( '??', element(:times).to_context)
|
|
136
222
|
assert_equal( '⊗', element(:otimes).to_html)
|
|
137
223
|
assert_equal( '\ensuremath{\otimes}', element(:otimes).to_latex)
|
|
224
|
+
#~ assert_equal( '??', element(:otimes).to_context)
|
|
138
225
|
assert_equal( '∅', element(:empty).to_html)
|
|
139
226
|
assert_equal( '\ensuremath{\emptyset}', element(:empty).to_latex)
|
|
227
|
+
#~ assert_equal( '??', element(:empty).to_context)
|
|
140
228
|
assert_equal( '_', element(:'_').to_html)
|
|
141
229
|
assert_equal( '_', element(:underscore).to_html)
|
|
142
230
|
assert_equal( '\_', element(:'_').to_latex)
|
|
231
|
+
#~ assert_equal( '??', element(:'_').to_context)
|
|
143
232
|
assert_equal( '\_', element(:underscore).to_latex)
|
|
233
|
+
#~ assert_equal( '??', element(:underscore).to_context)
|
|
144
234
|
assert_equal( '•', element(:bullet).to_html)
|
|
145
235
|
assert_equal( '\ensuremath{\bullet}', element(:bullet).to_latex)
|
|
236
|
+
#~ assert_equal( '??', element(:bullet).to_context)
|
|
146
237
|
assert_equal( '–', element(:'--').to_html)
|
|
147
238
|
assert_equal( '–', element(:ndash).to_html)
|
|
148
239
|
assert_equal( '--', element(:'--').to_latex)
|
|
240
|
+
#~ assert_equal( '??', element(:'??').to_context)
|
|
149
241
|
assert_equal( '--', element(:ndash).to_latex)
|
|
242
|
+
#~ assert_equal( '??', element(:ndash).to_context)
|
|
150
243
|
assert_equal( '—', element(:'---').to_html)
|
|
151
244
|
assert_equal( '—', element(:mdash).to_html)
|
|
152
245
|
assert_equal( '---', element(:'---').to_latex)
|
|
246
|
+
#~ assert_equal( '??', element(:'??').to_context)
|
|
153
247
|
assert_equal( '---', element(:mdash).to_latex)
|
|
248
|
+
#~ assert_equal( '??', element(:mdash).to_context)
|
|
154
249
|
assert_equal( '†', element(:dagger).to_html)
|
|
155
250
|
assert_equal( '\dag', element(:dagger).to_latex)
|
|
251
|
+
#~ assert_equal( '??', element(:dagger).to_context)
|
|
156
252
|
end
|
|
157
253
|
def test_section()
|
|
158
254
|
#~ log = Log4r::Logger.new( 'section_logger')
|
|
@@ -172,6 +268,10 @@ class Test_elements < Test::Unit::TestCase
|
|
|
172
268
|
]
|
|
173
269
|
assert_equal_filecontent( "expected/test_section.html", text.to_doc(:html))
|
|
174
270
|
assert_equal_filecontent( "expected/test_section.latex", text.to_doc(:latex))
|
|
271
|
+
$log.warn('test_section: to_context')
|
|
272
|
+
#~ assert_equal_filecontent( "expected/test_section.context", text.to_doc(:context))
|
|
273
|
+
$log.warn('test_section: to_creole')
|
|
274
|
+
#~ assert_equal_filecontent( "expected/test_section.creole", text.to_doc(:creole))
|
|
175
275
|
assert_equal_filecontent( "expected/test_section.wiki", text.to_doc(:wiki))
|
|
176
276
|
assert_equal_filecontent( "expected/test_section.text", text.to_doc(:text))
|
|
177
277
|
end
|
|
@@ -182,16 +282,20 @@ class Test_elements < Test::Unit::TestCase
|
|
|
182
282
|
#~ log.outputters = Log4r::StdoutOutputter.new('test_section')
|
|
183
283
|
|
|
184
284
|
text = [
|
|
185
|
-
element(:p, {}, [ '
|
|
186
|
-
element(:label, { :name => 'ilink'}, '
|
|
187
|
-
'
|
|
285
|
+
element(:p, {}, [ 'Now a ',
|
|
286
|
+
element(:label, { :name => 'ilink'}, 'target'),
|
|
287
|
+
' for a link',
|
|
188
288
|
] ).cr,
|
|
189
|
-
element(:p, {}, [ '
|
|
190
|
-
element(:a, {:href=>'#ilink'}, '
|
|
289
|
+
element(:p, {}, [ 'And here the text link to ',
|
|
290
|
+
element(:a, {:href=>'#ilink'}, 'target.'),
|
|
191
291
|
] ).cr,
|
|
192
292
|
]
|
|
193
293
|
assert_equal_filecontent( "expected/test_href.html", text.to_doc(:html))
|
|
194
294
|
assert_equal_filecontent( "expected/test_href.latex", text.to_doc(:latex))
|
|
295
|
+
$log.warn('test_href: to_context')
|
|
296
|
+
#~ assert_equal_filecontent( "expected/test_href.context", text.to_doc(:context))
|
|
297
|
+
$log.warn('test_href: to_creole')
|
|
298
|
+
#~ assert_equal_filecontent( "expected/test_href.creole", text.to_doc(:creole))
|
|
195
299
|
#~ assert_equal_filecontent( "expected/test_href.wiki", text.to_doc(:wiki))
|
|
196
300
|
assert_equal_filecontent( "expected/test_href.text", text.to_doc(:text)) #not good
|
|
197
301
|
end
|
|
@@ -204,6 +308,9 @@ class Test_lists < Test::Unit::TestCase
|
|
|
204
308
|
])
|
|
205
309
|
assert_equal_filecontent( "expected/test_itemize.html", ul.to_doc(:html))
|
|
206
310
|
assert_equal_filecontent( "expected/test_itemize.latex", ul.to_doc(:latex))
|
|
311
|
+
assert_equal_filecontent( "expected/test_itemize.context", ul.to_doc(:context))
|
|
312
|
+
$log.warn('test_itemize: to_creole')
|
|
313
|
+
#~ assert_equal_filecontent( "expected/test_itemize.creole", ul.to_doc(:creole))
|
|
207
314
|
assert_equal_filecontent( "expected/test_itemize.wiki", ul.to_doc(:wiki))
|
|
208
315
|
assert_equal_filecontent( "expected/test_itemize.text", ul.to_doc(:text))
|
|
209
316
|
end
|
|
@@ -213,6 +320,9 @@ class Test_lists < Test::Unit::TestCase
|
|
|
213
320
|
])
|
|
214
321
|
assert_equal_filecontent( "expected/test_enumerate.html", ol.to_doc(:html))
|
|
215
322
|
assert_equal_filecontent( "expected/test_enumerate.latex", ol.to_doc(:latex))
|
|
323
|
+
assert_equal_filecontent( "expected/test_enumerate.context", ol.to_doc(:context))
|
|
324
|
+
$log.warn('test_enumerate: to_creole')
|
|
325
|
+
#~ assert_equal_filecontent( "expected/test_enumerate.creole", ol.to_doc(:creole))
|
|
216
326
|
assert_equal_filecontent( "expected/test_enumerate.wiki", ol.to_doc(:wiki))
|
|
217
327
|
assert_equal_filecontent( "expected/test_enumerate.text", ol.to_doc(:text))
|
|
218
328
|
end
|
|
@@ -223,6 +333,10 @@ class Test_lists < Test::Unit::TestCase
|
|
|
223
333
|
])
|
|
224
334
|
assert_equal_filecontent( "expected/test_description.html", description.to_doc(:html))
|
|
225
335
|
assert_equal_filecontent( "expected/test_description.latex", description.to_doc(:latex))
|
|
336
|
+
$log.warn('test_description: to_context')
|
|
337
|
+
#~ assert_equal_filecontent( "expected/test_description.context", description.to_doc(:context))
|
|
338
|
+
$log.warn('test_description: to_creole')
|
|
339
|
+
#~ assert_equal_filecontent( "expected/test_description.creole", description.to_doc(:creole))
|
|
226
340
|
assert_equal_filecontent( "expected/test_description.wiki", description.to_doc(:wiki))
|
|
227
341
|
assert_equal_filecontent( "expected/test_description.text", description.to_doc(:text))
|
|
228
342
|
end
|
|
@@ -233,18 +347,22 @@ class Test_footnotes < Test::Unit::TestCase
|
|
|
233
347
|
footnotegroup = Footnotegroup.new()
|
|
234
348
|
#~ footnotegroup = nil
|
|
235
349
|
text = [
|
|
236
|
-
element(:h1, {}, '
|
|
350
|
+
element(:h1, {}, 'Section 1' ).cr,
|
|
237
351
|
element(:par, {}, [
|
|
238
|
-
'Text
|
|
239
|
-
element(:footnote,{ :group => footnotegroup }, '
|
|
240
|
-
'
|
|
352
|
+
'Text in section 1',
|
|
353
|
+
element(:footnote,{ :group => footnotegroup }, 'Footnote one'),
|
|
354
|
+
'More Text',
|
|
241
355
|
]
|
|
242
356
|
).cr,
|
|
243
|
-
element(:h2, {}, '
|
|
357
|
+
element(:h2, {}, 'Footnotes' ).cr,
|
|
244
358
|
footnotegroup,
|
|
245
359
|
]
|
|
246
360
|
assert_equal_filecontent( "expected/test_footnote.html", text.to_doc(:html))
|
|
247
361
|
assert_equal_filecontent( "expected/test_footnote.latex", text.to_doc(:latex))
|
|
362
|
+
$log.warn('test_footnote: to_context')
|
|
363
|
+
#~ assert_equal_filecontent( "expected/test_footnote.context", text.to_doc(:context))
|
|
364
|
+
$log.warn('test_footnote: to_creole')
|
|
365
|
+
#~ assert_equal_filecontent( "expected/test_footnote.creole", text.to_doc(:creole))
|
|
248
366
|
#~ assert_equal_filecontent( "expected/test_footnote.wiki", text.to_doc(:wiki))
|
|
249
367
|
#~ assert_equal_filecontent( "expected/test_footnote.text", text.to_doc(:text))
|
|
250
368
|
end #test_footnote
|
|
@@ -252,21 +370,25 @@ class Test_footnotes < Test::Unit::TestCase
|
|
|
252
370
|
footnotegroup = Footnotegroup.new()
|
|
253
371
|
footnotegroup2 = Footnotegroup.new('g2')
|
|
254
372
|
text = [
|
|
255
|
-
element(:h1, {}, '
|
|
373
|
+
element(:h1, {}, 'Section 1' ).cr,
|
|
256
374
|
element(:par, {}, [
|
|
257
|
-
'Text
|
|
258
|
-
element(:footnote,{ :group => footnotegroup2 }, '
|
|
259
|
-
'
|
|
260
|
-
element(:footnote,{ :group => footnotegroup}, '
|
|
375
|
+
'Text in section 1',
|
|
376
|
+
element(:footnote,{ :group => footnotegroup2 }, 'Footnote one (g1)'),
|
|
377
|
+
'More Text',
|
|
378
|
+
element(:footnote,{ :group => footnotegroup}, 'Again a footnote'),
|
|
261
379
|
]
|
|
262
380
|
).cr,
|
|
263
|
-
element(:h2, {}, '
|
|
381
|
+
element(:h2, {}, 'Footnotes' ).cr,
|
|
264
382
|
footnotegroup,
|
|
265
|
-
element(:h3, {}, '
|
|
383
|
+
element(:h3, {}, 'Footnotes of group 1' ).cr,
|
|
266
384
|
footnotegroup2,
|
|
267
385
|
]
|
|
268
386
|
assert_equal_filecontent( "expected/test_footnote_group.html", text.to_doc(:html))
|
|
269
387
|
assert_equal_filecontent( "expected/test_footnote_group.latex", text.to_doc(:latex))
|
|
388
|
+
$log.warn('test_footnote_group: to_context')
|
|
389
|
+
#~ assert_equal_filecontent( "expected/test_footnote_group.context", text.to_doc(:context))
|
|
390
|
+
$log.warn('test_footnote_group: to_creole')
|
|
391
|
+
#~ assert_equal_filecontent( "expected/test_footnote_group.creole", text.to_doc(:creole))
|
|
270
392
|
#~ assert_equal_filecontent( "expected/test_footnote_group.wiki", text.to_doc(:wiki))
|
|
271
393
|
#~ assert_equal_filecontent( "expected/test_footnote_group.text", text.to_doc(:text))
|
|
272
394
|
end #test_footnote
|
|
@@ -313,8 +435,12 @@ class Test_tabular < Test::Unit::TestCase
|
|
|
313
435
|
#
|
|
314
436
|
#~ $fixmes << "tabular/latex: tablines line 229 ../lib/docgenerator_tabular.rb#229"
|
|
315
437
|
assert_equal_filecontent( "expected/test_tabular.latex", text.to_doc(:latex))
|
|
438
|
+
$log.warn('test_tabular: to_context')
|
|
439
|
+
#~ assert_equal_filecontent( "expected/test_tabular.context", text.to_doc(:context))
|
|
440
|
+
$log.warn('test_tabular: to_creole')
|
|
441
|
+
#~ assert_equal_filecontent( "expected/test_tabular.creole", text.to_doc(:creole))
|
|
316
442
|
assert_equal_filecontent( "expected/test_tabular.wiki", text.to_doc(:wiki))
|
|
317
|
-
$
|
|
443
|
+
$log.warn("text-output for tables")
|
|
318
444
|
#~ assert_equal_filecontent( "expected/test_tabular.text", text.to_doc(:text))
|
|
319
445
|
end
|
|
320
446
|
def test_tabular_doc()
|
|
@@ -339,6 +465,37 @@ class Test_tabular < Test::Unit::TestCase
|
|
|
339
465
|
end
|
|
340
466
|
|
|
341
467
|
|
|
468
|
+
class Test_Verbatim < Test::Unit::TestCase
|
|
469
|
+
def test_verbatim()
|
|
470
|
+
text = element(:verbatim,{}, <<verb
|
|
471
|
+
Verbatim text
|
|
472
|
+
second line
|
|
473
|
+
verb
|
|
474
|
+
)
|
|
475
|
+
assert_equal_filecontent( "expected/test_verbatim.html", text.to_doc(:html))
|
|
476
|
+
assert_equal_filecontent( "expected/test_verbatim.latex", text.to_doc(:latex))
|
|
477
|
+
$log.warn('test_verbatim: to_context')
|
|
478
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.context", text.to_doc(:context))
|
|
479
|
+
$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))
|
|
482
|
+
$log.warn("text-output for verbatim")
|
|
483
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.text", text.to_doc(:text))
|
|
484
|
+
end
|
|
485
|
+
def test_verbatim_array()
|
|
486
|
+
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))
|
|
489
|
+
$log.warn('test_verbatim_array: to_context')
|
|
490
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.context", text.to_doc(:context))
|
|
491
|
+
$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))
|
|
494
|
+
$log.warn("text-output for verbatim_array")
|
|
495
|
+
#~ assert_equal_filecontent( "expected/test_verbatim.text", text.to_doc(:text))
|
|
496
|
+
end
|
|
497
|
+
end #Test_Verbatim
|
|
498
|
+
|
|
342
499
|
class Test_CSS < Test::Unit::TestCase
|
|
343
500
|
include Temp_Logger
|
|
344
501
|
def test_html_css()
|
|
@@ -422,13 +579,23 @@ class Test_document < Test::Unit::TestCase
|
|
|
422
579
|
#~ doc.save('test_document.html')
|
|
423
580
|
assert_instance_of( Log4r::Logger, doc.log)
|
|
424
581
|
assert_not_same( DOCGENERATOR_LOGGER, doc.log)
|
|
582
|
+
|
|
583
|
+
$log.warn('test_document: to_context')
|
|
584
|
+
$log.warn('test_document: to_creole')
|
|
425
585
|
{
|
|
426
586
|
:html => :html,
|
|
427
587
|
:article => :latex,
|
|
588
|
+
#~ :context => :context,
|
|
428
589
|
:wiki => :wiki,
|
|
590
|
+
#~ :creole => :creole,
|
|
429
591
|
:text => :text,
|
|
430
592
|
}.each{|template, target|
|
|
431
593
|
filename = "test_document_#{template}.#{target}"
|
|
594
|
+
case target
|
|
595
|
+
when :text, :wiki, :creole
|
|
596
|
+
$log.warn('test_document: Supress errors for author, keywords... fixme')
|
|
597
|
+
doc.log.level = Log4r::FATAL
|
|
598
|
+
end
|
|
432
599
|
assert_equal_filecontent( "expected/#{filename}",
|
|
433
600
|
doc.to_doc(target, {
|
|
434
601
|
:template=> DocumentTemplate[template],
|
|
@@ -458,6 +625,11 @@ class Test_document < Test::Unit::TestCase
|
|
|
458
625
|
:text => :text,
|
|
459
626
|
}.each{|template, target|
|
|
460
627
|
filename = "test_document_replacement_#{template}.#{target}"
|
|
628
|
+
case target
|
|
629
|
+
when :text, :wiki
|
|
630
|
+
# Supress errors for author, keywords... fixme
|
|
631
|
+
doc.log.level = Log4r::FATAL
|
|
632
|
+
end
|
|
461
633
|
assert_equal_filecontent( "expected/#{filename}",
|
|
462
634
|
doc.to_doc(target, {
|
|
463
635
|
:template=> DocumentTemplate[template],
|
|
@@ -488,16 +660,22 @@ class Test_document_toc < Test::Unit::TestCase
|
|
|
488
660
|
element(:p, {}, 'Text zu Abschnitt 2.1' ).cr,
|
|
489
661
|
element(:h1, {:id=>'sect3'}, 'Abschnitt 3' ).cr,
|
|
490
662
|
]
|
|
491
|
-
|
|
663
|
+
|
|
492
664
|
assert_equal_filecontent( "expected/test_document_toc_single.html", doc.toc( :tocfilename => 'test.html/').to_doc(:html))
|
|
493
665
|
assert_equal_filecontent( "expected/test_document_toc_single.latex", doc.toc().to_doc(:latex))
|
|
666
|
+
$log.warn('test_document_toc_single: to_context')
|
|
667
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_single.context", doc.toc().to_doc(:context))
|
|
668
|
+
$log.warn('test_document_toc_single: to_creole')
|
|
669
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_single.creole", doc.toc().to_doc(:creole))
|
|
494
670
|
#Normaly, the standard tableofcontents is used
|
|
495
671
|
assert_equal( "\\tableofcontents ", element(:tableofcontents).to_doc(:latex))
|
|
496
672
|
|
|
497
673
|
{
|
|
498
674
|
:html => :html,
|
|
499
675
|
:article => :latex,
|
|
676
|
+
#~ :context => :context,
|
|
500
677
|
#~ :wiki => :wiki,
|
|
678
|
+
#~ :creole => :creole,
|
|
501
679
|
#~ :text => :text,
|
|
502
680
|
}.each{|template, target|
|
|
503
681
|
filename = "test_document_toc_#{template}.#{target}"
|
|
@@ -515,11 +693,19 @@ class Test_document_toc < Test::Unit::TestCase
|
|
|
515
693
|
prepost = { :pre => 'Pretext', :post => 'Posttext' }
|
|
516
694
|
assert_equal_filecontent( "expected/test_document_toc_single_pre.html", doc.toc( prepost).to_doc(:html))
|
|
517
695
|
assert_equal_filecontent( "expected/test_document_toc_single_pre.latex", doc.toc(prepost).to_doc(:latex))
|
|
696
|
+
$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))
|
|
698
|
+
$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))
|
|
518
700
|
|
|
519
701
|
testel = element(:ul,{},[element(:li,{},'1'),element(:li,{},'2')])
|
|
520
702
|
prepost = { :pre => testel , :post => testel }
|
|
521
703
|
assert_equal_filecontent( "expected/test_document_toc_single_pre2.html", doc.toc( prepost).to_doc(:html))
|
|
522
704
|
assert_equal_filecontent( "expected/test_document_toc_single_pre2.latex", doc.toc(prepost).to_doc(:latex))
|
|
705
|
+
$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))
|
|
707
|
+
$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))
|
|
523
709
|
end
|
|
524
710
|
def test_document_toc_deep()
|
|
525
711
|
doc = Document.new(
|
|
@@ -541,12 +727,24 @@ class Test_document_toc < Test::Unit::TestCase
|
|
|
541
727
|
|
|
542
728
|
assert_equal_filecontent( "expected/test_document_toc_deep.html", doc.toc().to_doc(:html))
|
|
543
729
|
assert_equal_filecontent( "expected/test_document_toc_deep.latex", doc.toc().to_doc(:latex))
|
|
730
|
+
$log.warn('test_document_toc_deep: to_context')
|
|
731
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep.context", doc.toc().to_doc(:context))
|
|
732
|
+
$log.warn('test_document_toc_deep: to_creole')
|
|
733
|
+
#~ assert_equal_filecontent( "expected/test_document_toc_deep.creole", doc.toc().to_doc(:creole))
|
|
544
734
|
|
|
545
735
|
assert_equal_filecontent( "expected/test_document_toc_deep_1.html", doc.toc(:level=>1).to_doc(:html))
|
|
546
736
|
assert_equal_filecontent( "expected/test_document_toc_deep_1.latex", doc.toc(:level=>1).to_doc(:latex))
|
|
737
|
+
$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))
|
|
739
|
+
$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))
|
|
547
741
|
|
|
548
742
|
assert_equal_filecontent( "expected/test_document_toc_deep_4.html", doc.toc(:level=>4).to_doc(:html))
|
|
549
743
|
assert_equal_filecontent( "expected/test_document_toc_deep_4.latex", doc.toc(:level=>4).to_doc(:latex))
|
|
744
|
+
$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))
|
|
746
|
+
$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))
|
|
550
748
|
|
|
551
749
|
end
|
|
552
750
|
def test_document_toc_deep_err()
|
|
@@ -554,6 +752,9 @@ class Test_document_toc < Test::Unit::TestCase
|
|
|
554
752
|
:title => 'Testdokument for toc-command'
|
|
555
753
|
)
|
|
556
754
|
|
|
755
|
+
# Supress WARN Doc: Toc: Jump over section level 1 () // fixme
|
|
756
|
+
doc.log.level = Log4r::ERROR
|
|
757
|
+
|
|
557
758
|
doc.body << [
|
|
558
759
|
element(:tableofcontents, {:as_list => true }).cr,
|
|
559
760
|
#What happens if there are missing levels
|
|
@@ -562,22 +763,54 @@ class Test_document_toc < Test::Unit::TestCase
|
|
|
562
763
|
element(:h3, {}, 'Abschnitt 1.1.1' ).cr,
|
|
563
764
|
element(:h4, {}, 'Abschnitt 1.1.1.1' ).cr,
|
|
564
765
|
element(:h1, {}, 'Abschnitt 2' ).cr,
|
|
565
|
-
# element(:h2, {}, 'Abschnitt 2.1' ).cr, #Jump over one levels
|
|
766
|
+
# element(:h2, {}, 'Abschnitt 2.1' ).cr, #Jump over one levels
|
|
566
767
|
element(:h3, {}, 'Abschnitt 2.1.1' ).cr,
|
|
567
768
|
element(:h4, {}, 'Abschnitt 2.1.1.1' ).cr,
|
|
568
769
|
element(:h1, {}, 'Abschnitt 3' ).cr, #Jump over two levels
|
|
569
770
|
element(:h4, {}, 'Abschnitt 3.1.1.1' ).cr,
|
|
570
771
|
]
|
|
772
|
+
|
|
571
773
|
templogfile = set_temporary_logger()
|
|
572
774
|
assert_equal_filecontent( "expected/test_document_toc_deep_err.html", doc.toc(:level=>4, :log => DOCGENERATOR_LOGGER).to_doc(:html))
|
|
573
775
|
assert_equal_filecontent( "expected/test_document_toc_deep_err.log", get_temporary_logger(templogfile))
|
|
574
776
|
|
|
575
777
|
assert_equal_filecontent( "expected/test_document_toc_deep_err.latex", doc.toc().to_doc(:latex))
|
|
778
|
+
$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))
|
|
780
|
+
$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))
|
|
576
782
|
|
|
577
783
|
end
|
|
578
784
|
|
|
579
785
|
end
|
|
580
786
|
|
|
787
|
+
class Test_usepackage < Test::Unit::TestCase
|
|
788
|
+
include Temp_Logger
|
|
789
|
+
#
|
|
790
|
+
#If an unknown package is requested, you get an information.
|
|
791
|
+
def test_usepackage_unknown()
|
|
792
|
+
templogfile = set_temporary_logger(Log4r::DEBUG)
|
|
793
|
+
element(:usepackage,{},'undefined package')
|
|
794
|
+
assert_equal_filecontent( "expected/test_document_usepackage_undefined.log", get_temporary_logger(templogfile))
|
|
795
|
+
end
|
|
796
|
+
#Known packages 'require' new ruby packages.
|
|
797
|
+
def test_usepackage_pdfpages()
|
|
798
|
+
|
|
799
|
+
DOCGENERATOR_LOGGER.level = Log4r::FATAL
|
|
800
|
+
old_required = $".dup #Get old require list
|
|
801
|
+
usepackage_element = element(:usepackage,{},'pdfpages')
|
|
802
|
+
#Now a new require should be done
|
|
803
|
+
req_diff = $" - old_required
|
|
804
|
+
assert_equal( 1, req_diff.size )
|
|
805
|
+
#Ruby 1.9 has full path, Ruby 1.8 only require-parameter
|
|
806
|
+
assert_match( %r{packages/docgenerator_pdfpages.rb}, req_diff.first )
|
|
807
|
+
|
|
808
|
+
assert_equal( '\usepackage{pdfpages}', usepackage_element.to_latex)
|
|
809
|
+
assert_equal( '', usepackage_element.to_html)
|
|
810
|
+
|
|
811
|
+
end #test_usepackage_pdfpages()
|
|
812
|
+
end
|
|
813
|
+
|
|
581
814
|
#~ class Test_Element < Test::Unit::TestCase
|
|
582
815
|
#~ def test_add_output()
|
|
583
816
|
#~ cmd = <<'cmd'
|