docgenerator-creole 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/examples/creole_example.rb +76 -0
- data/examples/creole_example_footnote.rb +66 -0
- data/examples/creole_example_new_plugin.rb +51 -0
- data/examples/creole_example_placeholder.rb +77 -0
- data/examples/creole_example_rail.rb +155 -0
- data/examples/creole_example_rubycode.rb +144 -0
- data/examples/creole_example_struktex.rb +170 -0
- data/examples/creole_example_tabular.rb +96 -0
- data/examples/creole_example_tikz.rb +47 -0
- data/lib/docgenerator-creole.rb +5 -0
- data/lib/docgenerator/creole.rb +15 -0
- data/lib/docgenerator/creole/base.rb +170 -0
- data/lib/docgenerator/creole/characters.rb +131 -0
- data/lib/docgenerator/creole/creole.rb +708 -0
- data/lib/docgenerator/creole/document.rb +91 -0
- data/lib/docgenerator/creole/inclusion_and_plugins.rb +91 -0
- data/lib/docgenerator/creole/inclusions.rb +148 -0
- data/lib/docgenerator/creole/placeholder.rb +242 -0
- data/lib/docgenerator/creole/plugins.rb +230 -0
- data/lib/docgenerator/creole/plugins/index.rb +61 -0
- data/lib/docgenerator/creole/plugins/rail.rb +179 -0
- data/lib/docgenerator/creole/plugins/rubycode4creole.rb +136 -0
- data/lib/docgenerator/creole/plugins/struktex.rb +60 -0
- data/lib/docgenerator/creole/plugins/tikz.rb +93 -0
- data/lib/docgenerator/creole/plugins/todonotes.rb +77 -0
- data/lib/docgenerator/creole/tabular.rb +405 -0
- data/readme.rdoc +44 -0
- data/unittest/Red_Flower.jpg +0 -0
- data/unittest/expected_creole/test_creole.html +3 -0
- data/unittest/expected_creole/test_creole_characters_all.creole +28 -0
- data/unittest/expected_creole/test_creole_characters_all.html +18 -0
- data/unittest/expected_creole/test_creole_characters_all.latex +36 -0
- data/unittest/expected_creole/test_creole_characters_special.html +10 -0
- data/unittest/expected_creole/test_creole_characters_special.latex +18 -0
- 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_countdown.html +3 -0
- data/unittest/expected_creole/test_creole_countdown.latex +4 -0
- data/unittest/expected_creole/test_creole_creole1.0test.html +182 -0
- data/unittest/expected_creole/test_creole_creole1.0test.latex +253 -0
- data/unittest/expected_creole/test_creole_creole1.0test.text +160 -0
- data/unittest/expected_creole/test_creole_footnotes.html +9 -0
- data/unittest/expected_creole/test_creole_footnotes.latex +14 -0
- data/unittest/expected_creole/test_creole_footnotes_groupid.html +15 -0
- data/unittest/expected_creole/test_creole_footnotes_label.html +9 -0
- data/unittest/expected_creole/test_creole_headings.html +17 -0
- data/unittest/expected_creole/test_creole_headings.latex +19 -0
- data/unittest/expected_creole/test_creole_headings.text +48 -0
- data/unittest/expected_creole/test_creole_headings.wiki +37 -0
- data/unittest/expected_creole/test_creole_hr.html +7 -0
- data/unittest/expected_creole/test_creole_hr.latex +9 -0
- data/unittest/expected_creole/test_creole_hr.text +4 -0
- 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_inline.html +3 -0
- data/unittest/expected_creole/test_creole_inline.latex +4 -0
- data/unittest/expected_creole/test_creole_inline.text +2 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.html +7 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.latex +9 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.text +5 -0
- data/unittest/expected_creole/test_creole_inline_ruby.html +12 -0
- data/unittest/expected_creole/test_creole_inline_ruby.latex +20 -0
- data/unittest/expected_creole/test_creole_inline_ruby_raw.html +6 -0
- data/unittest/expected_creole/test_creole_inline_ruby_raw.latex +8 -0
- data/unittest/expected_creole/test_creole_input.normsource +22 -0
- data/unittest/expected_creole/test_creole_input.normsource_1.8 +23 -0
- 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_label.html +12 -0
- data/unittest/expected_creole/test_creole_label.latex +15 -0
- data/unittest/expected_creole/test_creole_line_break.html +6 -0
- data/unittest/expected_creole/test_creole_line_break.latex +8 -0
- data/unittest/expected_creole/test_creole_links_explicit_internal.html +6 -0
- data/unittest/expected_creole/test_creole_links_explicit_internal.text +4 -0
- data/unittest/expected_creole/test_creole_links_explicit_with_em.html +3 -0
- data/unittest/expected_creole/test_creole_links_explicit_with_em.latex +4 -0
- data/unittest/expected_creole/test_creole_links_explicit_with_em.text +2 -0
- data/unittest/expected_creole/test_creole_links_external.html +6 -0
- data/unittest/expected_creole/test_creole_links_external.latex +8 -0
- data/unittest/expected_creole/test_creole_links_external.text +4 -0
- data/unittest/expected_creole/test_creole_links_external_implicit.html +9 -0
- data/unittest/expected_creole/test_creole_links_external_implicit.latex +12 -0
- data/unittest/expected_creole/test_creole_links_external_implicit.text +6 -0
- data/unittest/expected_creole/test_creole_links_file.html +6 -0
- data/unittest/expected_creole/test_creole_links_file.latex +8 -0
- data/unittest/expected_creole/test_creole_links_file.text +4 -0
- 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_ol.html +12 -0
- data/unittest/expected_creole/test_creole_list_ol.latex +22 -0
- data/unittest/expected_creole/test_creole_list_ol_after_ul.html +12 -0
- data/unittest/expected_creole/test_creole_list_ol_after_ul.latex +20 -0
- data/unittest/expected_creole/test_creole_list_ol_after_ul.text +6 -0
- data/unittest/expected_creole/test_creole_list_ol_ul.html +15 -0
- data/unittest/expected_creole/test_creole_list_ol_ul.latex +26 -0
- data/unittest/expected_creole/test_creole_list_ul.html +22 -0
- data/unittest/expected_creole/test_creole_list_ul.latex +40 -0
- data/unittest/expected_creole/test_creole_list_ul.normsource +85 -0
- data/unittest/expected_creole/test_creole_list_ul.normsource_1.8 +83 -0
- data/unittest/expected_creole/test_creole_list_ul_too_much.html +24 -0
- data/unittest/expected_creole/test_creole_list_ul_too_much.latex +44 -0
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.html +6 -0
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.latex +12 -0
- 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_newline.html +9 -0
- data/unittest/expected_creole/test_creole_newline.latex +11 -0
- data/unittest/expected_creole/test_creole_newline.text +7 -0
- data/unittest/expected_creole/test_creole_paragraphs.html +6 -0
- data/unittest/expected_creole/test_creole_paragraphs.latex +8 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource +26 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource_1.8 +27 -0
- data/unittest/expected_creole/test_creole_paragraphs.text +4 -0
- data/unittest/expected_creole/test_creole_paragraphs.wiki +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap.html +5 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap.latex +6 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap.text +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap.wiki +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap0.html +9 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap0.latex +11 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap0.text +7 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap0.wiki +7 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap60.html +5 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap60.latex +6 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap60.text +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap60.wiki +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.html +5 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.latex +6 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.text +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.wiki +4 -0
- data/unittest/expected_creole/test_creole_picture_link.html +6 -0
- data/unittest/expected_creole/test_creole_pictures.html +10 -0
- data/unittest/expected_creole/test_creole_pictures.latex +13 -0
- data/unittest/expected_creole/test_creole_pictures_css.html +6 -0
- data/unittest/expected_creole/test_creole_pictures_css.latex +8 -0
- data/unittest/expected_creole/test_creole_pictures_imgclass.html +6 -0
- data/unittest/expected_creole/test_creole_pictures_imgclass.latex +8 -0
- 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_placeholders_html.html +7 -0
- data/unittest/expected_creole/test_creole_placeholders_html.latex +8 -0
- data/unittest/expected_creole/test_creole_placeholders_html.text +4 -0
- data/unittest/expected_creole/test_creole_placeholders_latex.html +6 -0
- data/unittest/expected_creole/test_creole_placeholders_latex.latex +9 -0
- data/unittest/expected_creole/test_creole_placeholders_latex.text +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.creole +22 -0
- data/unittest/expected_creole/test_creole_tabular.html +20 -0
- data/unittest/expected_creole/test_creole_tabular.latex +22 -0
- data/unittest/expected_creole/test_creole_tabular_creole.creole +21 -0
- data/unittest/expected_creole/test_creole_tabular_creole.html +20 -0
- data/unittest/expected_creole/test_creole_tabular_creole.latex +21 -0
- data/unittest/expected_creole/test_creole_tabular_css.creole +24 -0
- data/unittest/expected_creole/test_creole_tabular_css.html +20 -0
- data/unittest/expected_creole/test_creole_tabular_css.latex +22 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.creole +16 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.html +14 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.latex +16 -0
- data/unittest/expected_creole/test_creole_tabular_row_parameters.latex +22 -0
- data/unittest/expected_creole/test_creole_tabular_with_cell_option.creole +21 -0
- data/unittest/expected_creole/test_creole_tabular_with_cell_option.html +20 -0
- data/unittest/expected_creole/test_creole_toc.html +13 -0
- data/unittest/expected_creole/test_creole_toc.latex +22 -0
- data/unittest/expected_creole/test_creole_toc.text +4 -0
- 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_toc_text.html +5 -0
- data/unittest/expected_creole/test_creole_toc_text.latex +5 -0
- data/unittest/expected_creole/test_creole_ul_multiple_line.html +7 -0
- data/unittest/expected_creole/test_creole_ul_multiple_line.latex +14 -0
- data/unittest/expected_creole/test_creole_ul_with_blank.html +11 -0
- data/unittest/expected_creole/test_creole_ul_with_blank.latex +20 -0
- data/unittest/expected_creole/test_creole_ul_with_bold.creole +0 -0
- data/unittest/expected_creole/test_creole_ul_with_bold.html +11 -0
- data/unittest/expected_creole/test_creole_ul_with_bold.latex +18 -0
- data/unittest/expected_creole/test_creole_ul_with_bold.text +7 -0
- data/unittest/expected_creole/test_creole_verbatim.html +25 -0
- data/unittest/expected_creole/test_creole_verbatim.latex +33 -0
- data/unittest/expected_creole/test_creole_verbatim.text +17 -0
- data/unittest/expected_creole/test_creole_verbatim_inline.html +6 -0
- data/unittest/expected_creole/test_creole_verbatim_inline.latex +8 -0
- data/unittest/expected_creole/test_creole_verbatim_inline_at_start.html +6 -0
- data/unittest/expected_creole/test_creole_verbatim_inline_at_start.latex +8 -0
- 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/unittest_creole.rb +1379 -0
- data/unittest/unittest_creole_placeholders.rb +161 -0
- data/unittest/unittest_creole_plugin_rail.rb +148 -0
- data/unittest/unittest_creole_plugin_rubycode4doc.rb +123 -0
- data/unittest/unittest_creole_plugin_struktex.rb +26 -0
- data/unittest/unittest_creole_tabular.rb +212 -0
- metadata +529 -0
@@ -0,0 +1,161 @@
|
|
1
|
+
if $0 == __FILE__
|
2
|
+
$:.unshift("../lib")
|
3
|
+
$:.unshift('../../docgenerator/lib')
|
4
|
+
end
|
5
|
+
|
6
|
+
gem 'minitest-filecontent'
|
7
|
+
require 'minitest/filecontent.rb'
|
8
|
+
|
9
|
+
require 'docgenerator-creole.rb'
|
10
|
+
require 'docgenerator/creole/plugins/rail.rb'
|
11
|
+
require 'docgenerator/creole/plugins/struktex.rb'
|
12
|
+
require 'docgenerator/creole/plugins/todonotes.rb'
|
13
|
+
require 'docgenerator/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
|
+
*todonotes
|
37
|
+
|
38
|
+
placeholder mit parameter (siehe creole_rail)
|
39
|
+
|
40
|
+
Bug:
|
41
|
+
http://... am Ende ohne folgenden Text wird falsch erkannt.
|
42
|
+
--> test_creole_links_implicit_end()
|
43
|
+
missingtests
|
44
|
+
|
45
|
+
class Test_creole_placeholder_interface < MiniTest::Test
|
46
|
+
def test_creole_placeholders()
|
47
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
48
|
+
==Titel 1==
|
49
|
+
Text
|
50
|
+
creole
|
51
|
+
)
|
52
|
+
assert_equal( Docgenerator::Creole::Placeholders::Collection, creole.placeholders)
|
53
|
+
assert_equal( Docgenerator::Creole::Placeholders::Dummy, Docgenerator::Creole::Placeholders::Collection[:undefined])
|
54
|
+
assert_equal( Docgenerator::Creole::Placeholders::Creole_html, Docgenerator::Creole::Placeholders::Collection['html'])
|
55
|
+
#~ assert_instance_of( Dummy_placeholder, Creole::Placeholders[:undefined])
|
56
|
+
end #test_creole_placeholders
|
57
|
+
|
58
|
+
=begin
|
59
|
+
Define test for each placeholder.
|
60
|
+
=end
|
61
|
+
Docgenerator::Creole::Placeholders::Collection.each{|key,placeholder_class|
|
62
|
+
code = <<-xx
|
63
|
+
def test_#{placeholder_class.to_s.gsub(/::/, '_')}()
|
64
|
+
do_interfacetest('#{key}', #{placeholder_class})
|
65
|
+
end
|
66
|
+
xx
|
67
|
+
class_eval(code)
|
68
|
+
}
|
69
|
+
=begin rdoc
|
70
|
+
Test, if the interface for a placeholder follows the main definition.
|
71
|
+
|
72
|
+
=end
|
73
|
+
def do_interfacetest(key,placeholder_class)
|
74
|
+
assert_equal( placeholder_class, Docgenerator::Creole::Placeholders[key])
|
75
|
+
assert_equal( placeholder_class, Docgenerator::Creole::Placeholders::Collection[key])
|
76
|
+
assert_equal( placeholder_class, Docgenerator::Creole::Creole.new.placeholders[key])
|
77
|
+
|
78
|
+
creation_successful= false
|
79
|
+
#Check with no parameter
|
80
|
+
begin
|
81
|
+
placeholder = placeholder_class.new( Docgenerator::Creole::Creole.new )
|
82
|
+
rescue Docgenerator::Creole::Placeholder::ParameterError
|
83
|
+
#Docgenerator::Creole_placeholder::ParameterError is an accepted error
|
84
|
+
#Happens if this placeholder needs a parameter.
|
85
|
+
else
|
86
|
+
creation_successful= true
|
87
|
+
#Check inheritance.
|
88
|
+
assert_kind_of( Docgenerator::Creole::Placeholder, placeholder)
|
89
|
+
end
|
90
|
+
|
91
|
+
parameter = case key
|
92
|
+
when "structogramm"; 'Title;120;45' #
|
93
|
+
else; 'dummy'
|
94
|
+
end
|
95
|
+
|
96
|
+
#Check with 1 parameter
|
97
|
+
begin
|
98
|
+
placeholder = placeholder_class.new( Docgenerator::Creole::Creole.new, parameter )
|
99
|
+
rescue Docgenerator::Creole::Placeholder::ParameterError
|
100
|
+
#Docgenerator::Creole_placeholder::ParameterError is an accepted error
|
101
|
+
#Happens if this placeholder needs a specific parameter.
|
102
|
+
else
|
103
|
+
creation_successful= true
|
104
|
+
#Check inheritance.
|
105
|
+
assert_kind_of( Docgenerator::Creole::Placeholder, placeholder)
|
106
|
+
end
|
107
|
+
|
108
|
+
#Check 2 parameters: Actual no placeholder with 2 parameters exists
|
109
|
+
assert_raises(ArgumentError, "Interface error for class #{placeholder_class}"){
|
110
|
+
placeholder = placeholder_class.new( Docgenerator::Creole::Creole.new, 'a', 'b' )
|
111
|
+
#Check inheritance.
|
112
|
+
assert_kind_of( Docgenerator::Creole::Placeholder, placeholder)
|
113
|
+
}
|
114
|
+
|
115
|
+
assert(creation_successful, "Placeholder %s can't be created" % key.inspect)
|
116
|
+
|
117
|
+
end #do_interfacetest(key,placeholder_class)
|
118
|
+
|
119
|
+
end #class Test_creole_placeholder_interface
|
120
|
+
|
121
|
+
class Test_creole_placeholders_html < MiniTest::Test
|
122
|
+
def test_creole_placeholders_html()
|
123
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
124
|
+
before
|
125
|
+
<<<html
|
126
|
+
<em>this is only for HTML</em>
|
127
|
+
>>>
|
128
|
+
after
|
129
|
+
creole
|
130
|
+
)
|
131
|
+
#Really like this? Or should there be no paragraph?
|
132
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.html", creole.to_doc(:html, OPT))
|
133
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.latex", creole.to_doc(:latex, OPT))
|
134
|
+
$log.warn('test_creole_placeholders_html: to_context')
|
135
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.context", creole.to_doc(:context))
|
136
|
+
$log.warn('test_creole_placeholders_html: to wiki/creole')
|
137
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.creole", creole.to_doc(:creole))
|
138
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.text", creole.to_doc(:text, OPT))
|
139
|
+
end #test_creole_placeholders_html
|
140
|
+
end #class Test_creole_placeholders_html
|
141
|
+
class Test_creole_placeholders_latex < MiniTest::Test
|
142
|
+
def test_creole_placeholders_latex()
|
143
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
144
|
+
before
|
145
|
+
<<<latex
|
146
|
+
\\textbf{this is only for latex}
|
147
|
+
>>>
|
148
|
+
after
|
149
|
+
creole
|
150
|
+
)
|
151
|
+
#Really like this? Or should there be no paragraph?
|
152
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.html", creole.to_doc(:html, OPT))
|
153
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.latex", creole.to_doc(:latex, OPT))
|
154
|
+
$log.warn('test_creole_placeholders_latex: to_context')
|
155
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_context.context", creole.to_doc(:context))
|
156
|
+
$log.warn('test_creole_placeholders_latex: to wiki/creole')
|
157
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.creole", creole.to_doc(:creole))
|
158
|
+
assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.text", creole.to_doc(:text, OPT))
|
159
|
+
end #test_creole_placeholders_latex
|
160
|
+
end #Test_creole_placeholders
|
161
|
+
|
@@ -0,0 +1,148 @@
|
|
1
|
+
gem 'minitest-filecontent'
|
2
|
+
require 'minitest/filecontent.rb'
|
3
|
+
|
4
|
+
|
5
|
+
if $0 == __FILE__
|
6
|
+
$:.unshift("../lib")
|
7
|
+
$:.unshift('../../docgenerator/lib')
|
8
|
+
end
|
9
|
+
require 'docgenerator-creole.rb'
|
10
|
+
require 'docgenerator/creole/plugins/rail.rb'
|
11
|
+
|
12
|
+
#~ $log = Log4r::Logger.new( 'test rail', Log4r::WARN )
|
13
|
+
#~ $log.outputters = Log4r::StdoutOutputter.new('test rail')
|
14
|
+
#~ $log.level = Log4r::INFO
|
15
|
+
|
16
|
+
#~ $log.info("Remark: Known errors/problems and missing checks are logged.")
|
17
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::DEBUG
|
18
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::INFO
|
19
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::WARN
|
20
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::ERROR
|
21
|
+
|
22
|
+
#~ include Log4r
|
23
|
+
|
24
|
+
#~ class Test_rail < MiniTest::Test
|
25
|
+
#~ def test_rail()
|
26
|
+
#~ block = Rail_diagramm.new('block', <<-RAIL
|
27
|
+
#~ ( lbrace | 'begin' )
|
28
|
+
#~ ( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] )
|
29
|
+
#~ comm
|
30
|
+
#~ ( rbrace | 'end' )
|
31
|
+
#~ RAIL
|
32
|
+
#~ )
|
33
|
+
#~ assert_equal_filecontent( "expected_rail/rail_.rail", text.to_doc(:tex))
|
34
|
+
#~ end
|
35
|
+
#~ end #Test_rail
|
36
|
+
|
37
|
+
class Test_creole_rail < MiniTest::Test
|
38
|
+
#~ def test_document_placeholder()
|
39
|
+
#~ doc = Docgenerator::Creole::Creole_document.new(
|
40
|
+
#~ :title => 'Rail-Diagramms in Creole'
|
41
|
+
#~ )
|
42
|
+
#~ assert_nothing_raised(){
|
43
|
+
#~ doc << <<DATA
|
44
|
+
#~ <<<rail|id
|
45
|
+
#~ A
|
46
|
+
#~ >>>
|
47
|
+
#~ DATA
|
48
|
+
#~ }
|
49
|
+
#~ end
|
50
|
+
def test_document_placeholder_missing_id()
|
51
|
+
doc = Docgenerator::Creole::Creole_document.new(
|
52
|
+
:title => 'Rail-Diagramms in Creole'
|
53
|
+
)
|
54
|
+
assert_raises( Docgenerator::Creole::Placeholder::ParameterError ){
|
55
|
+
doc << <<DATA
|
56
|
+
<<<rail
|
57
|
+
A
|
58
|
+
>>>
|
59
|
+
DATA
|
60
|
+
}
|
61
|
+
end
|
62
|
+
def test_document_placeholder_wrong_id()
|
63
|
+
doc = Docgenerator::Creole::Creole_document.new(
|
64
|
+
:title => 'Rail-Diagramms in Creole'
|
65
|
+
)
|
66
|
+
assert_raises( Docgenerator::Creole::Placeholder::ParameterError ){
|
67
|
+
doc << <<DATA
|
68
|
+
<<<rail|id-with-minus
|
69
|
+
A
|
70
|
+
>>>
|
71
|
+
DATA
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_document_placeholder_in_wiki()
|
76
|
+
doc = Docgenerator::Creole::Creole_document.new(
|
77
|
+
:title => 'Rail-Diagramms in Creole'
|
78
|
+
)
|
79
|
+
doc.doc.head << Docgenerator::Creole::Rail::Rail_diagramm::TEX_PACKAGE_RAIL
|
80
|
+
#~ doc.doc.head << element(:latexonly,{}, [
|
81
|
+
#~ Rail_diagramm::RAIL_ALIAS,
|
82
|
+
#~ '\railterm{lowcharacter,uppercharacter}',
|
83
|
+
#~ ])
|
84
|
+
|
85
|
+
doc << <<DATA
|
86
|
+
=Rail-Diagramms
|
87
|
+
==Via Placeholder
|
88
|
+
<<<rail|test
|
89
|
+
[1] (
|
90
|
+
( '[' string ']' )
|
91
|
+
? body[2--6] + '|'
|
92
|
+
)
|
93
|
+
| [2] body[3--6] '*' body[5--6]
|
94
|
+
| [2] body[3--6] '+' body[5--6]
|
95
|
+
| [3] ( body[4--5] + )
|
96
|
+
| [4] body[5] '?'
|
97
|
+
| [5] identifier ( '[' string ']' ) ?
|
98
|
+
| [5] quote string quote
|
99
|
+
| [5] dquote string dquote
|
100
|
+
| [5] '(' body[1--6] ')'
|
101
|
+
| [5] cr
|
102
|
+
| [6]
|
103
|
+
;
|
104
|
+
>>>
|
105
|
+
DATA
|
106
|
+
#~ doc.runtex = :pdflatex
|
107
|
+
assert_equal_filecontent( "expected_creole_rail/test_rail_creole_placeholder.tex", doc.doc.to_latex({
|
108
|
+
:template=> Docgenerator::DocumentTemplate[:article],
|
109
|
+
:filename => 'xx',
|
110
|
+
:log => doc.doc.log
|
111
|
+
}))
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
def test_document_object()
|
116
|
+
$block = Docgenerator::Creole::Rail::Rail_diagramm.new('block', <<-RAIL
|
117
|
+
( lbrace | 'begin' )
|
118
|
+
( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] )
|
119
|
+
comm
|
120
|
+
( rbrace | 'end' )
|
121
|
+
RAIL
|
122
|
+
)
|
123
|
+
doc = Docgenerator::Creole::Creole_document.new(
|
124
|
+
:title => 'Rail-Diagramms in Creole'
|
125
|
+
)
|
126
|
+
doc.doc.head << Docgenerator::Creole::Rail::Rail_diagramm::TEX_PACKAGE_RAIL
|
127
|
+
#~ doc.doc.head << element(:latexonly,{}, [
|
128
|
+
#~ Rail_diagramm::RAIL_ALIAS,
|
129
|
+
#~ '\railterm{lowcharacter,uppercharacter}',
|
130
|
+
#~ ])
|
131
|
+
|
132
|
+
doc << <<DATA
|
133
|
+
=Rail-Diagramms
|
134
|
+
==Via Ruby-object
|
135
|
+
<<ruby_raw|$block.to_latex>>
|
136
|
+
DATA
|
137
|
+
#~ doc.runtex = :pdflatex
|
138
|
+
assert_equal_filecontent( "expected_creole_rail/test_rail_creole_object.tex", doc.doc.to_latex({
|
139
|
+
:template=> Docgenerator::DocumentTemplate[:article],
|
140
|
+
:filename => 'xx',
|
141
|
+
:log => doc.doc.log
|
142
|
+
}))
|
143
|
+
end
|
144
|
+
end #Test_rail
|
145
|
+
|
146
|
+
#~ assert_equal_filecontent( "expected_rail/rail_.rail", text.to_doc(:tex))
|
147
|
+
|
148
|
+
__END__
|
@@ -0,0 +1,123 @@
|
|
1
|
+
#~ require '../test_docgenerator.rb'
|
2
|
+
gem 'minitest-filecontent'
|
3
|
+
require 'minitest/filecontent.rb'
|
4
|
+
|
5
|
+
if $0 == __FILE__
|
6
|
+
$:.unshift("../lib")
|
7
|
+
$:.unshift("../../docgenerator/lib")
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'docgenerator/packages/rubycode4doc'
|
11
|
+
require 'docgenerator/creole'
|
12
|
+
require 'docgenerator/creole/plugins/rubycode4creole'
|
13
|
+
|
14
|
+
#~ DOCGENERATOR_LOGGER.level = Log4r::DEBUG
|
15
|
+
#Avoid warnings about missing logger in to_doc
|
16
|
+
OPT = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER } unless defined? OPT
|
17
|
+
|
18
|
+
class Test_rubycode4doc_creole < MiniTest::Test
|
19
|
+
#This is integrated in Creole
|
20
|
+
def test_creole_inline_ruby()
|
21
|
+
wiki = Docgenerator::Creole::Creole.new()
|
22
|
+
wiki << <<wiki
|
23
|
+
*1 + 1 = <<ruby|1+1>>
|
24
|
+
*1 + 1 = <<ruby_raw|1+1>>
|
25
|
+
wiki
|
26
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_inline_ruby.html", wiki.to_html(OPT))
|
27
|
+
end
|
28
|
+
#
|
29
|
+
#
|
30
|
+
def test_creole_rubycode()
|
31
|
+
wiki = Docgenerator::Creole::Creole.new()
|
32
|
+
wiki << <<wiki
|
33
|
+
<<<rubycode
|
34
|
+
1 + 1
|
35
|
+
>>>
|
36
|
+
wiki
|
37
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_rubycode.html", wiki.to_html(OPT))
|
38
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_rubycode.tex", wiki.to_latex(OPT))
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_creole_rubycode_output()
|
42
|
+
wiki = Docgenerator::Creole::Creole.new()
|
43
|
+
wiki << <<wiki
|
44
|
+
<<<rubycode_output
|
45
|
+
1 + 1
|
46
|
+
puts 1 + 2
|
47
|
+
>>>
|
48
|
+
wiki
|
49
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_output.html", wiki.to_html(OPT))
|
50
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_output.tex", wiki.to_latex(OPT))
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_creole_rubycode_evaluated()
|
54
|
+
wiki = Docgenerator::Creole::Creole.new()
|
55
|
+
wiki << <<wiki
|
56
|
+
<<<rubycode_evaluated
|
57
|
+
1 + 1
|
58
|
+
>>>
|
59
|
+
wiki
|
60
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_rubycode_evaluated.html", wiki.to_html(OPT))
|
61
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_rubycode_evaluated.tex", wiki.to_latex(OPT))
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_creole_rubycode_evaluated_listings()
|
65
|
+
wiki = Docgenerator::Creole::Creole.new()
|
66
|
+
wiki << <<wiki
|
67
|
+
<<<rubycode_evaluated_listings
|
68
|
+
1 + 1
|
69
|
+
>>>
|
70
|
+
wiki
|
71
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_rubycode_evaluated_listings.html", wiki.to_html(OPT))
|
72
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_rubycode_evaluated_listings.tex", wiki.to_latex(OPT))
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
def test_creole_rubycode_in_tab()
|
78
|
+
wiki = Docgenerator::Creole::Creole.new()
|
79
|
+
wiki << <<wiki
|
80
|
+
<<<rubycode_in_tab
|
81
|
+
1 + 1
|
82
|
+
>>>
|
83
|
+
wiki
|
84
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_in_tab.html", wiki.to_html(OPT))
|
85
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_in_tab.tex", wiki.to_latex(OPT))
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
#
|
90
|
+
def test_creole_rubycode_complete()
|
91
|
+
wiki = Docgenerator::Creole::Creole.new()
|
92
|
+
wiki << <<wiki
|
93
|
+
rubycode
|
94
|
+
<<<rubycode
|
95
|
+
1 + 1
|
96
|
+
>>>
|
97
|
+
----
|
98
|
+
rubycode_output
|
99
|
+
<<<rubycode_output
|
100
|
+
puts 1 + 1
|
101
|
+
>>>
|
102
|
+
----
|
103
|
+
rubycode_evaluated
|
104
|
+
<<<rubycode_evaluated
|
105
|
+
1 + 1
|
106
|
+
>>>
|
107
|
+
----
|
108
|
+
rubycode_in_tab
|
109
|
+
<<<rubycode_in_tab
|
110
|
+
1 + 1
|
111
|
+
>>>
|
112
|
+
----
|
113
|
+
<<<rubycode_evaluated_listings
|
114
|
+
1 + 1
|
115
|
+
>>>
|
116
|
+
wiki
|
117
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_complete.html", wiki.to_html(OPT))
|
118
|
+
assert_equal_filecontent( "expected_rubycode4doc/creole_complete.tex", wiki.to_latex(OPT))
|
119
|
+
end
|
120
|
+
|
121
|
+
end #class Test_rubycode4doc_creole
|
122
|
+
|
123
|
+
__END__
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
#Tests for creole/plugins//struktex.rb
|
3
|
+
#
|
4
|
+
#Check after __END__ for missing tests.
|
5
|
+
#
|
6
|
+
|
7
|
+
if $0 == __FILE__
|
8
|
+
$:.unshift("../lib")
|
9
|
+
$:.unshift("../../docgenerator/lib")
|
10
|
+
end
|
11
|
+
|
12
|
+
gem 'minitest-filecontent'
|
13
|
+
require 'minitest/filecontent.rb'
|
14
|
+
|
15
|
+
require 'docgenerator/packages/struktex.rb'
|
16
|
+
require 'docgenerator/creole'
|
17
|
+
require 'docgenerator/creole/plugins/struktex.rb'
|
18
|
+
|
19
|
+
class Test_struktex_creole < MiniTest::Test
|
20
|
+
def test_struktex_collector()
|
21
|
+
assert_equal( Docgenerator::Creole::Creole_structogramm, Docgenerator::Creole::Placeholders['structogramm'])
|
22
|
+
assert_equal( Docgenerator::Creole::Creole_structogramm, Docgenerator::Creole::Placeholders::Collection['structogramm'])
|
23
|
+
#~ assert_kind_of( Placeholder, Creole::Placeholders['structogramm'])
|
24
|
+
end
|
25
|
+
end #Test_struktex
|
26
|
+
|