docgenerator 1.0.4 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. data/lib/creole/creole2doc.rb +777 -0
  2. data/lib/creole/creole_inclusion_and_plugins.rb +236 -0
  3. data/lib/creole/creole_placeholder.rb +74 -0
  4. data/lib/creole/creole_tabular.rb +170 -0
  5. data/lib/docgenerator.rb +15 -6
  6. data/lib/docgenerator_attribute.rb +2 -2
  7. data/lib/docgenerator_characters.rb +20 -4
  8. data/lib/docgenerator_document.rb +132 -42
  9. data/lib/docgenerator_element.rb +531 -524
  10. data/lib/docgenerator_elements.rb +408 -399
  11. data/lib/docgenerator_environments.rb +28 -2
  12. data/lib/docgenerator_footnote.rb +72 -79
  13. data/lib/docgenerator_sections.rb +1 -1
  14. data/lib/docgenerator_tabular.rb +8 -3
  15. data/lib/packages/docgenerator_beamer.rb +253 -0
  16. data/lib/packages/docgenerator_scrlettr2.rb +53 -9
  17. data/lib/templates/docgenerator_template_css.rb +4 -0
  18. data/lib/wiki2doc/wiki2docgenerator.rb +1087 -970
  19. data/lib/yaml2presentation/yaml2presentation.rb +1091 -0
  20. data/self_docgenerator.rb +8 -6
  21. data/unittest/Red_Flower.jpg +0 -0
  22. data/unittest/creole1.0test.txt +128 -0
  23. data/unittest/expected/beamer_01_doc.html +1 -1
  24. data/unittest/expected/beamer_02_doc.html +1 -1
  25. data/unittest/expected/beamer_doc_html_overview_with_detailpic_and_text_doc.html +34 -0
  26. data/unittest/expected/beamer_doc_html_overview_with_detailpic_doc.html +34 -0
  27. data/unittest/expected/beamer_doc_key_doc.html +1 -1
  28. data/unittest/expected/beamer_doc_note_doc.html +1 -1
  29. data/unittest/expected/beamer_doc_pic_bottom_doc.html +1 -1
  30. data/unittest/expected/beamer_doc_pic_doc.html +1 -1
  31. data/unittest/expected/beamer_doc_pic_left_doc.html +1 -1
  32. data/unittest/expected/beamer_doc_pic_right_doc.html +1 -1
  33. data/unittest/expected/beamer_doc_pic_top_doc.html +1 -1
  34. data/unittest/expected/test_footnote.html +2 -2
  35. data/unittest/expected/test_footnote.latex +1 -1
  36. data/unittest/expected/test_footnote_group.html +3 -3
  37. data/unittest/expected/test_footnote_group.latex +2 -2
  38. data/unittest/expected_creole/test_creole.html +3 -0
  39. data/unittest/expected_creole/test_creole_characters_all.html +10 -0
  40. data/unittest/expected_creole/test_creole_characters_all.latex +20 -0
  41. data/unittest/expected_creole/test_creole_characters_special.html +10 -0
  42. data/unittest/expected_creole/test_creole_characters_special.latex +18 -0
  43. data/unittest/expected_creole/test_creole_countdown.html +3 -0
  44. data/unittest/expected_creole/test_creole_countdown.latex +4 -0
  45. data/unittest/expected_creole/test_creole_creole1.0test.html +182 -0
  46. data/unittest/expected_creole/test_creole_creole1.0test.latex +253 -0
  47. data/unittest/expected_creole/test_creole_creole1.0test.text +160 -0
  48. data/unittest/expected_creole/test_creole_footnotes.html +9 -0
  49. data/unittest/expected_creole/test_creole_footnotes.latex +14 -0
  50. data/unittest/expected_creole/test_creole_footnotes_label.html +9 -0
  51. data/unittest/expected_creole/test_creole_headings.html +17 -0
  52. data/unittest/expected_creole/test_creole_headings.latex +19 -0
  53. data/unittest/expected_creole/test_creole_headings.text +48 -0
  54. data/unittest/expected_creole/test_creole_headings.wiki +37 -0
  55. data/unittest/expected_creole/test_creole_hr.html +7 -0
  56. data/unittest/expected_creole/test_creole_hr.latex +9 -0
  57. data/unittest/expected_creole/test_creole_hr.text +4 -0
  58. data/unittest/expected_creole/test_creole_inline.html +3 -0
  59. data/unittest/expected_creole/test_creole_inline.latex +4 -0
  60. data/unittest/expected_creole/test_creole_inline.text +2 -0
  61. data/unittest/expected_creole/test_creole_inline_ruby.html +12 -0
  62. data/unittest/expected_creole/test_creole_inline_ruby.latex +20 -0
  63. data/unittest/expected_creole/test_creole_inline_ruby_raw.html +6 -0
  64. data/unittest/expected_creole/test_creole_inline_ruby_raw.latex +8 -0
  65. data/unittest/expected_creole/test_creole_input.normsource +23 -0
  66. data/unittest/expected_creole/test_creole_label.html +12 -0
  67. data/unittest/expected_creole/test_creole_label.latex +15 -0
  68. data/unittest/expected_creole/test_creole_line_break.html +6 -0
  69. data/unittest/expected_creole/test_creole_line_break.latex +8 -0
  70. data/unittest/expected_creole/test_creole_links_explicit_internal.html +6 -0
  71. data/unittest/expected_creole/test_creole_links_explicit_internal.text +4 -0
  72. data/unittest/expected_creole/test_creole_links_explicit_with_em.html +3 -0
  73. data/unittest/expected_creole/test_creole_links_explicit_with_em.latex +4 -0
  74. data/unittest/expected_creole/test_creole_links_explicit_with_em.text +2 -0
  75. data/unittest/expected_creole/test_creole_links_external.html +6 -0
  76. data/unittest/expected_creole/test_creole_links_external.latex +8 -0
  77. data/unittest/expected_creole/test_creole_links_external.text +4 -0
  78. data/unittest/expected_creole/test_creole_links_external_implicit.html +9 -0
  79. data/unittest/expected_creole/test_creole_links_external_implicit.latex +12 -0
  80. data/unittest/expected_creole/test_creole_links_external_implicit.text +6 -0
  81. data/unittest/expected_creole/test_creole_links_file.html +6 -0
  82. data/unittest/expected_creole/test_creole_links_file.latex +8 -0
  83. data/unittest/expected_creole/test_creole_links_file.text +4 -0
  84. data/unittest/expected_creole/test_creole_list_ol.html +12 -0
  85. data/unittest/expected_creole/test_creole_list_ol.latex +22 -0
  86. data/unittest/expected_creole/test_creole_list_ol_after_ul.html +12 -0
  87. data/unittest/expected_creole/test_creole_list_ol_after_ul.latex +20 -0
  88. data/unittest/expected_creole/test_creole_list_ol_after_ul.text +6 -0
  89. data/unittest/expected_creole/test_creole_list_ol_ul.html +15 -0
  90. data/unittest/expected_creole/test_creole_list_ol_ul.latex +26 -0
  91. data/unittest/expected_creole/test_creole_list_ul.html +22 -0
  92. data/unittest/expected_creole/test_creole_list_ul.latex +40 -0
  93. data/unittest/expected_creole/test_creole_list_ul.normsource +83 -0
  94. data/unittest/expected_creole/test_creole_list_ul_too_much.html +24 -0
  95. data/unittest/expected_creole/test_creole_list_ul_too_much.latex +44 -0
  96. data/unittest/expected_creole/test_creole_newline.html +9 -0
  97. data/unittest/expected_creole/test_creole_newline.latex +11 -0
  98. data/unittest/expected_creole/test_creole_newline.text +7 -0
  99. data/unittest/expected_creole/test_creole_paragraphs.html +6 -0
  100. data/unittest/expected_creole/test_creole_paragraphs.latex +8 -0
  101. data/unittest/expected_creole/test_creole_paragraphs.normsource +27 -0
  102. data/unittest/expected_creole/test_creole_paragraphs.text +4 -0
  103. data/unittest/expected_creole/test_creole_paragraphs.wiki +4 -0
  104. data/unittest/expected_creole/test_creole_paragraphs_wrap.html +5 -0
  105. data/unittest/expected_creole/test_creole_paragraphs_wrap.latex +6 -0
  106. data/unittest/expected_creole/test_creole_paragraphs_wrap.text +4 -0
  107. data/unittest/expected_creole/test_creole_paragraphs_wrap.wiki +4 -0
  108. data/unittest/expected_creole/test_creole_paragraphs_wrap0.html +9 -0
  109. data/unittest/expected_creole/test_creole_paragraphs_wrap0.latex +11 -0
  110. data/unittest/expected_creole/test_creole_paragraphs_wrap0.text +7 -0
  111. data/unittest/expected_creole/test_creole_paragraphs_wrap0.wiki +7 -0
  112. data/unittest/expected_creole/test_creole_paragraphs_wrap60.html +5 -0
  113. data/unittest/expected_creole/test_creole_paragraphs_wrap60.latex +6 -0
  114. data/unittest/expected_creole/test_creole_paragraphs_wrap60.text +4 -0
  115. data/unittest/expected_creole/test_creole_paragraphs_wrap60.wiki +4 -0
  116. data/unittest/expected_creole/test_creole_picture_link.html +6 -0
  117. data/unittest/expected_creole/test_creole_pictures.html +10 -0
  118. data/unittest/expected_creole/test_creole_pictures.latex +13 -0
  119. data/unittest/expected_creole/test_creole_pictures_css.html +3 -0
  120. data/unittest/expected_creole/test_creole_pictures_css.latex +4 -0
  121. data/unittest/expected_creole/test_creole_pictures_imgclass.html +6 -0
  122. data/unittest/expected_creole/test_creole_pictures_imgclass.latex +8 -0
  123. data/unittest/expected_creole/test_creole_placeholders_html.html +7 -0
  124. data/unittest/expected_creole/test_creole_placeholders_html.latex +8 -0
  125. data/unittest/expected_creole/test_creole_placeholders_html.text +4 -0
  126. data/unittest/expected_creole/test_creole_placeholders_latex.html +6 -0
  127. data/unittest/expected_creole/test_creole_placeholders_latex.latex +9 -0
  128. data/unittest/expected_creole/test_creole_placeholders_latex.text +4 -0
  129. data/unittest/expected_creole/test_creole_tabular.html +20 -0
  130. data/unittest/expected_creole/test_creole_tabular.latex +22 -0
  131. data/unittest/expected_creole/test_creole_tabular_creole.html +18 -0
  132. data/unittest/expected_creole/test_creole_tabular_creole.latex +19 -0
  133. data/unittest/expected_creole/test_creole_tabular_css.html +20 -0
  134. data/unittest/expected_creole/test_creole_tabular_css.latex +22 -0
  135. data/unittest/expected_creole/test_creole_toc.html +11 -0
  136. data/unittest/expected_creole/test_creole_toc.latex +22 -0
  137. data/unittest/expected_creole/test_creole_toc.text +4 -0
  138. data/unittest/expected_creole/test_creole_toc_text.html +5 -0
  139. data/unittest/expected_creole/test_creole_toc_text.latex +5 -0
  140. data/unittest/expected_creole/test_creole_ul_multiple_line.html +7 -0
  141. data/unittest/expected_creole/test_creole_ul_multiple_line.latex +14 -0
  142. data/unittest/expected_creole/test_creole_ul_with_blank.html +11 -0
  143. data/unittest/expected_creole/test_creole_ul_with_blank.latex +20 -0
  144. data/unittest/expected_creole/test_creole_ul_with_bold.creole +0 -0
  145. data/unittest/expected_creole/test_creole_ul_with_bold.html +11 -0
  146. data/unittest/expected_creole/test_creole_ul_with_bold.latex +18 -0
  147. data/unittest/expected_creole/test_creole_ul_with_bold.text +7 -0
  148. data/unittest/expected_creole/test_creole_verbatim.html +25 -0
  149. data/unittest/expected_creole/test_creole_verbatim.latex +33 -0
  150. data/unittest/expected_creole/test_creole_verbatim.text +17 -0
  151. data/unittest/expected_creole/test_creole_verbatim_inline.html +6 -0
  152. data/unittest/expected_creole/test_creole_verbatim_inline.latex +8 -0
  153. data/unittest/expected_creole/test_creole_verbatim_inline_at_start.html +6 -0
  154. data/unittest/expected_creole/test_creole_verbatim_inline_at_start.latex +8 -0
  155. data/unittest/expected_privat/test_creole_test_document.html +6 -0
  156. data/unittest/{expected → expected_wiki}/test_wiki.html +0 -0
  157. data/unittest/{expected → expected_wiki}/test_wiki.latex +0 -0
  158. data/unittest/{expected → expected_wiki}/test_wiki.text +0 -0
  159. data/unittest/{expected → expected_wiki}/test_wiki.wiki +0 -0
  160. data/unittest/{expected → expected_wiki}/test_wiki_amazon.html +0 -0
  161. data/unittest/{expected → expected_wiki}/test_wiki_description.html +0 -0
  162. data/unittest/{expected → expected_wiki}/test_wiki_description.latex +0 -0
  163. data/unittest/{expected → expected_wiki}/test_wiki_description.text +0 -0
  164. data/unittest/{expected → expected_wiki}/test_wiki_description.wiki +0 -0
  165. data/unittest/expected_wiki/test_wiki_footnote.html +8 -0
  166. data/unittest/expected_wiki/test_wiki_footnote.latex +17 -0
  167. data/unittest/{expected → expected_wiki}/test_wiki_footnote.text +2 -4
  168. data/unittest/expected_wiki/test_wiki_footnote.wiki +10 -0
  169. data/unittest/expected_wiki/test_wiki_footnote_2.html +8 -0
  170. data/unittest/expected_wiki/test_wiki_footnote_groupid.html +21 -0
  171. data/unittest/{expected → expected_wiki}/test_wiki_html_code.html +0 -0
  172. data/unittest/{expected → expected_wiki}/test_wiki_html_code.latex +0 -0
  173. data/unittest/{expected → expected_wiki}/test_wiki_html_code.text +0 -0
  174. data/unittest/{expected → expected_wiki}/test_wiki_html_code.wiki +0 -0
  175. data/unittest/{expected → expected_wiki}/test_wiki_inline.html +0 -0
  176. data/unittest/{expected → expected_wiki}/test_wiki_inline.latex +0 -0
  177. data/unittest/{expected → expected_wiki}/test_wiki_inline.text +0 -0
  178. data/unittest/{expected → expected_wiki}/test_wiki_inline.wiki +0 -0
  179. data/unittest/{expected → expected_wiki}/test_wiki_label.html +0 -0
  180. data/unittest/{expected → expected_wiki}/test_wiki_link.html +0 -0
  181. data/unittest/{expected → expected_wiki}/test_wiki_link.latex +0 -0
  182. data/unittest/{expected → expected_wiki}/test_wiki_link.log +0 -0
  183. data/unittest/{expected → expected_wiki}/test_wiki_link.wiki +0 -0
  184. data/unittest/{expected → expected_wiki}/test_wiki_list_ol.html +0 -0
  185. data/unittest/{expected → expected_wiki}/test_wiki_list_ol.latex +0 -0
  186. data/unittest/{expected → expected_wiki}/test_wiki_list_ol.text +0 -0
  187. data/unittest/{expected → expected_wiki}/test_wiki_list_ol.wiki +0 -0
  188. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_after_ul.html +0 -0
  189. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_after_ul.latex +0 -0
  190. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_after_ul.text +0 -0
  191. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_after_ul.wiki +0 -0
  192. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_ul.html +0 -0
  193. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_ul.latex +0 -0
  194. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_ul.text +0 -0
  195. data/unittest/{expected → expected_wiki}/test_wiki_list_ol_ul.wiki +0 -0
  196. data/unittest/{expected → expected_wiki}/test_wiki_list_ul.html +0 -0
  197. data/unittest/{expected → expected_wiki}/test_wiki_list_ul.latex +0 -0
  198. data/unittest/{expected → expected_wiki}/test_wiki_list_ul.text +0 -0
  199. data/unittest/{expected → expected_wiki}/test_wiki_list_ul.wiki +0 -0
  200. data/unittest/{expected → expected_wiki}/test_wiki_list_ul_too_much.html +0 -0
  201. data/unittest/{expected → expected_wiki}/test_wiki_list_ul_too_much.latex +0 -0
  202. data/unittest/{expected → expected_wiki}/test_wiki_list_ul_too_much.text +0 -0
  203. data/unittest/{expected → expected_wiki}/test_wiki_list_ul_too_much.wiki +0 -0
  204. data/unittest/{expected → expected_wiki}/test_wiki_picture.html +0 -0
  205. data/unittest/{expected → expected_wiki}/test_wiki_picture.latex +0 -0
  206. data/unittest/{expected → expected_wiki}/test_wiki_picture_thumb.html +0 -0
  207. data/unittest/{expected → expected_wiki}/test_wiki_tab1.html +0 -0
  208. data/unittest/{expected → expected_wiki}/test_wiki_tab1.latex +0 -0
  209. data/unittest/{expected → expected_wiki}/test_wiki_tab1.wiki +0 -0
  210. data/unittest/{expected → expected_wiki}/test_wiki_textformatting.html +0 -0
  211. data/unittest/{expected → expected_wiki}/test_wiki_textformatting.latex +0 -0
  212. data/unittest/{expected → expected_wiki}/test_wiki_textformatting.text +0 -0
  213. data/unittest/{expected → expected_wiki}/test_wiki_textformatting.wiki +0 -0
  214. data/unittest/{expected → expected_wiki}/test_wiki_toc.html +0 -0
  215. data/unittest/{expected → expected_wiki}/test_wiki_toc.latex +0 -0
  216. data/unittest/{expected → expected_wiki}/test_wiki_toc.text +0 -0
  217. data/unittest/{expected → expected_wiki}/test_wiki_toc.wiki +0 -0
  218. data/unittest/{expected → expected_wiki}/test_wiki_ul_multiple_line.html +0 -0
  219. data/unittest/{expected → expected_wiki}/test_wiki_ul_multiple_line.latex +0 -0
  220. data/unittest/{expected → expected_wiki}/test_wiki_ul_multiple_line.text +0 -0
  221. data/unittest/{expected → expected_wiki}/test_wiki_ul_multiple_line.wiki +0 -0
  222. data/unittest/test_docgenerator.rb +1 -2
  223. data/unittest/unittest_creole2doc.rb +1024 -0
  224. data/unittest/unittest_docgenerator.rb +17 -8
  225. data/unittest/unittest_wiki2doc.rb +92 -88
  226. data/unittest/unittest_yaml2pres.rb +336 -0
  227. metadata +202 -70
  228. data/unittest/expected/test_wiki_footnote.html +0 -8
  229. data/unittest/expected/test_wiki_footnote.latex +0 -15
  230. data/unittest/expected/test_wiki_footnote.wiki +0 -12
  231. data/unittest/expected/test_wiki_footnote_groupid.html +0 -21
@@ -0,0 +1,1024 @@
1
+ require 'test_docgenerator.rb'
2
+ Dir.chdir('../lib/creole/'){
3
+ require 'creole2doc.rb'
4
+ }
5
+ #~ require 'creole/creole2doc.rb'
6
+
7
+ <<missingtests
8
+ see Text and
9
+ description
10
+ labels
11
+
12
+ amazon/affiliate -> privat
13
+
14
+ <<ruby>>
15
+
16
+ erweitern:
17
+ *tabulars
18
+ *Creole_creoletab
19
+ *csv-tabs
20
+
21
+ *picture: zus. optionen (css...)
22
+
23
+ Creole_document
24
+ missingtests
25
+
26
+ class Creole
27
+ #Access to the options.
28
+ attr_reader :options
29
+ end
30
+
31
+ require 'yaml'
32
+ require 'log4r'
33
+ #
34
+ #Warn -> report missing important test
35
+ #Info -> report missing test
36
+
37
+ $log = Log4r::Logger.new('Unittest creole', Log4r::ERROR)
38
+ #~ $log = Log4r::Logger.new('Unittest creole', Log4r::WARN)
39
+ #~ $log = Log4r::Logger.new('Unittest creole', Log4r::INFO)
40
+ $log.outputters = Log4r::StdoutOutputter.new('log_stdout')
41
+
42
+ #Logger to catch unwanted messages
43
+ $tmplog = Log4r::Logger.new('Creole', Log4r::FATAL)
44
+
45
+ class Test_creole_basics < Test::Unit::TestCase
46
+ #Test some basic definitions.
47
+ def test_creole_initialize()
48
+ creole = Creole.new(
49
+ :content => 'test'
50
+ )
51
+ assert_instance_of( Log4r::Logger, creole.log)
52
+ assert_equal( Log4r::INFO, creole.log.level, "Default Level of Default-Logger (creole.log) changed:")
53
+ assert_instance_of( Log4r::StdoutOutputter, creole.log.outputters.first)
54
+ #~ assert_equal( Log4r::DEBUG, creole.log.outputters.first.level)
55
+ assert_equal( creole.options[:wrap_at], 75 )
56
+ end
57
+ # Get some content and check the content.
58
+ def test_creole_input_string()
59
+ source = <<creole
60
+ Text,
61
+ more Text.
62
+ And some more text.
63
+
64
+ A new paragraph.
65
+ creole
66
+ creole = Creole.new(:content => source )
67
+ assert_equal( [source], creole.source)
68
+ assert_equal_filecontent( "expected_creole/test_creole_input.normsource", creole.normsource.to_yaml)
69
+
70
+ creole = Creole.new(:content => source )
71
+ creole = Creole.new()
72
+ creole << source
73
+ creole << source
74
+ assert_equal( [source, source], creole.source)
75
+ end
76
+ #
77
+ #Check for open File-handles
78
+ def test_creole_input_file()
79
+ creole1 = Creole.new( :content => File.readlines('creole1.0test.txt').to_s )
80
+ creole2 = nil
81
+ File.open('creole1.0test.txt'){|filehandle|
82
+ creole2 = Creole.new( :content => filehandle )
83
+ }
84
+ assert_equal( creole1.source, creole2.source)
85
+ end
86
+ #
87
+ #Test for filehandle, if the file is a Rubyscript (Take only parts after __END__)
88
+ def test_creole_input_file_rb()
89
+ creole1 = Creole.new( :name => 'input_file_rb/DATA', :content => DATA )
90
+ creole2 = nil
91
+ File.open(__FILE__){|filehandle|
92
+ #~ $log.warn('Test Filehandle auf ruby nicht m�glich (Test $0 == input.path)')
93
+ #Modify $0 temporary to allow test with condition $0 == input.path
94
+ $0 = "xxxx#{__FILE__}"
95
+ creole2 = Creole.new( :name => 'input_file_rb', :content => filehandle, :log => $tmplog )
96
+ $0 = __FILE__
97
+ }
98
+ assert_equal( creole1.source, creole2.source)
99
+ end
100
+ #
101
+ #This testcases are taken from http://www.wikicreole.org/wiki/Creole1.0TestCases
102
+ def test_creole_creole1_0test()
103
+ $log.info('Testcases uncomplete creole1.0test.txt')
104
+ creole = Creole.new(
105
+ :name => 'creole_creole1_0test',
106
+ :content => File.readlines('creole1.0test.txt').to_s,
107
+ :log => $tmplog #catch warning for [[links]]
108
+ )
109
+ assert_equal_filecontent( "expected_creole/test_creole_creole1.0test.html", creole.to_doc(:html))
110
+ assert_equal_filecontent( "expected_creole/test_creole_creole1.0test.latex", creole.to_doc(:latex))
111
+ $log.info('test_creole_creole1_0test: uncomplete to_creole')
112
+ #~ assert_equal_filecontent( "expected_creole/test_creole_creole1.0test.creole", creole.to_doc(:creole))
113
+ assert_equal_filecontent( "expected_creole/test_creole_creole1.0test.text", creole.to_doc(:text))
114
+ end
115
+ end #Test_creole_basics
116
+
117
+ class Test_creole_paragraphs < Test::Unit::TestCase
118
+
119
+ def test_creole_paragraphs()
120
+ source = <<creole
121
+ This is some text,
122
+ followed by more Text.
123
+ And some more text.
124
+
125
+ And now a new paragraph with some other text.
126
+
127
+ creole
128
+ creole = Creole.new(:content => source )
129
+ assert_equal( [source], creole.source)
130
+
131
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs.html", creole.to_doc(:html))
132
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs.latex", creole.to_doc(:latex))
133
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs.wiki", creole.to_doc(:wiki))
134
+ $log.info('test_creole_paragraphs: uncomplete to_creole')
135
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs.text", creole.to_doc(:text))
136
+
137
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs.normsource", creole.normsource.to_yaml)
138
+ end
139
+ def test_creole_paragraphs_wrap()
140
+ creole = Creole.new(:content => <<creole
141
+ And now a line which is a bit longer then 80 characters in the input line. Creole should split it at position 75 or a bit later (depending on the word length at position 75).
142
+ creole
143
+ )
144
+
145
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap.html", creole.to_doc(:html))
146
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap.latex", creole.to_doc(:latex))
147
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap.wiki", creole.to_doc(:wiki))
148
+ $log.info('test_creole_paragraphs_wrap: uncomplete to_creole')
149
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap.text", creole.to_doc(:text))
150
+ end #test_creole_paragraphs_wrap()
151
+ def test_creole_paragraphs_wrap60()
152
+
153
+ creole = Creole.new(:wrap_at => 60, :content => <<creole
154
+ And now a line which is a bit longer then 80 characters in the input line. Creole should split it at position 60 or a bit later (depending on the word length at position 60).
155
+ creole
156
+ )
157
+
158
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap60.html", creole.to_doc(:html))
159
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap60.latex", creole.to_doc(:latex))
160
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap60.wiki", creole.to_doc(:wiki))
161
+ $log.info('test_creole_paragraphs_wrap: uncomplete to_creole')
162
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap60.text", creole.to_doc(:text))
163
+ end #test_creole_paragraphs_wrap60()
164
+
165
+ def test_creole_paragraphs_wrap0()
166
+
167
+ creole = Creole.new(:wrap_at => 0, :content => <<creole
168
+ And now a line which is a bit longer then 80 characters in the input line. Creole should not split it, because we defined split_at to 0.
169
+
170
+ And now a line which is a bit longer then 80 characters in the input line.
171
+ Creole should not split it, because we defined split_at to 0.
172
+ creole
173
+ )
174
+
175
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap0.html", creole.to_doc(:html))
176
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap0.latex", creole.to_doc(:latex))
177
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap0.wiki", creole.to_doc(:wiki))
178
+ $log.info('test_creole_paragraphs_wrap: uncomplete to_creole')
179
+ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap0.text", creole.to_doc(:text))
180
+ end
181
+ end #Test_creole_paragraphs < Test::Unit::TestCase
182
+
183
+ class Test_creole_headings < Test::Unit::TestCase
184
+
185
+ def test_creole_headings()
186
+ creole = Creole.new(:content => <<creole
187
+ = Top-level heading (1)
188
+ == This a test for creole 0.1 (2)
189
+ === This is a Subheading (3)
190
+ ==== Subsub (4)
191
+ ===== Subsubsub (5)
192
+
193
+ The ending equal signs should not be displayed:
194
+
195
+ = Top-level heading (1) =
196
+ == This a test for creole 0.1 (2) ==
197
+ === This is a Subheading (3) ===
198
+ ==== Subsub (4) ====
199
+ ===== Subsubsub (5) =====
200
+
201
+
202
+ = **not** //parsed// =
203
+ The content is not parsed.
204
+ creole
205
+ )
206
+
207
+ assert_equal_filecontent( "expected_creole/test_creole_headings.html", creole.to_doc(:html))
208
+ assert_equal_filecontent( "expected_creole/test_creole_headings.latex", creole.to_doc(:latex))
209
+ assert_equal_filecontent( "expected_creole/test_creole_headings.wiki", creole.to_doc(:wiki))
210
+ $log.info('test_creole_paragraphs: uncomplete to_creole')
211
+ assert_equal_filecontent( "expected_creole/test_creole_headings.text", creole.to_doc(:text))
212
+ end #test_creole_headings
213
+ #
214
+ #Modification of standard: Labels for headings.
215
+ #
216
+ #Including the definition of a label tor the toc.
217
+ def test_creole_label()
218
+ creole = Creole.new(:content => <<creole
219
+ ==Titel 1==
220
+ Text
221
+ ===Titel 2===
222
+ Text unter Titel 2
223
+ ===[2b]Titel 2b===
224
+ Text unter Titel 2b.
225
+ creole
226
+ )
227
+ #Check the manual label
228
+ assert_equal_filecontent( "expected_creole/test_creole_label.html", creole.to_doc(:html))
229
+ assert_equal_filecontent( "expected_creole/test_creole_label.latex", creole.to_doc(:latex))
230
+ $log.info('test_creole_label: uncomplete text/to_creole')
231
+ #~ assert_equal_filecontent( "expected_creole/test_creole_label.creole", creole.to_doc(:creole))
232
+ #~ assert_equal_filecontent( "expected_creole/test_creole_label.text", creole.to_doc(:text))
233
+
234
+ end
235
+ end #Test_creole_headings < Test::Unit::TestCase
236
+
237
+ class Test_creole_toc < Test::Unit::TestCase
238
+ def test_creole_toc()
239
+ creole = Creole.new(
240
+ :name => 'toc',
241
+ :content => <<creole
242
+ =one
243
+ =two
244
+ ==two-one
245
+ =[drei]three
246
+ ==three-one
247
+ creole
248
+ )
249
+ assert_equal_filecontent( "expected_creole/test_creole_toc.html", creole.toc.to_doc(:html))
250
+ assert_equal_filecontent( "expected_creole/test_creole_toc_text.html", creole.to_doc(:html))
251
+ assert_equal_filecontent( "expected_creole/test_creole_toc.latex", creole.toc.to_doc(:latex))
252
+ assert_equal_filecontent( "expected_creole/test_creole_toc_text.latex", creole.to_doc(:latex))
253
+ $log.warn('test_creole_toc: to wiki/creole')
254
+ #~ assert_equal_filecontent( "expected_creole/test_creole_toc.creole", creole.to_doc(:creole))
255
+ assert_equal_filecontent( "expected_creole/test_creole_toc.text", creole.toc.to_doc(:text))
256
+ end #test_creole_toc
257
+ end #Test_creole_toc
258
+
259
+ class Test_creole_paragraph2 < Test::Unit::TestCase
260
+ def test_creole_newline()
261
+ creole = Creole.new(
262
+ :name => 'newline',
263
+ :content => <<'creole'
264
+ You can format an address by simply forcing linebreaks:
265
+
266
+ My contact dates:\\
267
+ Pone: xyz\\
268
+ Fax: +45\\
269
+ Mobile: abc
270
+
271
+ creole
272
+ )
273
+ assert_equal_filecontent( "expected_creole/test_creole_newline.html", creole.to_doc(:html))
274
+ assert_equal_filecontent( "expected_creole/test_creole_newline.latex", creole.to_doc(:latex))
275
+ $log.warn('test_creole_newline: to wiki/creole')
276
+ #~ assert_equal_filecontent( "expected_creole/test_creole_newline.creole", creole.to_doc(:creole))
277
+ assert_equal_filecontent( "expected_creole/test_creole_newline.text", creole.to_doc(:text))
278
+ end #test_creole_newline
279
+ def test_creole_hr()
280
+ creole = Creole.new(
281
+ :name => 'hr',
282
+ :content => <<creole
283
+
284
+ You can use this to draw a line to separate the page:
285
+ ----
286
+ This is after the horizontal line
287
+ creole
288
+ )
289
+ assert_equal_filecontent( "expected_creole/test_creole_hr.html", creole.to_doc(:html))
290
+ assert_equal_filecontent( "expected_creole/test_creole_hr.latex", creole.to_doc(:latex))
291
+ $log.warn('test_creole_hr: to wiki/creole')
292
+ #~ assert_equal_filecontent( "expected_creole/test_creole_hr.creole", creole.to_doc(:creole))
293
+ assert_equal_filecontent( "expected_creole/test_creole_hr.text", creole.to_doc(:text))
294
+ end #test_creole_hr
295
+
296
+ end #Test_creole_paragraph2
297
+
298
+
299
+ class Test_creole_inline < Test::Unit::TestCase
300
+
301
+ def test_creole_inline_bold_em()
302
+ creole = Creole.new(:content => <<creole
303
+ You can make things **bold** or //italic// or **//both//** or //**both**//.
304
+ creole
305
+ )
306
+ assert_equal_filecontent( "expected_creole/test_creole_inline.html", creole.to_doc(:html))
307
+ assert_equal_filecontent( "expected_creole/test_creole_inline.latex", creole.to_doc(:latex))
308
+ $log.info('test_creole_inline_bold_em: inline to wiki/creole')
309
+ #~ assert_equal_filecontent( "expected_creole/test_creole_inline.creole", creole.to_doc(:creole))
310
+ $log.warn('test_creole_inline_bold_em: inline text with additional spaces')
311
+ assert_equal_filecontent( "expected_creole/test_creole_inline.text", creole.to_doc(:text))
312
+ end
313
+
314
+ def test_creole_inline_bold_line_break()
315
+ creole = Creole.new(:content => <<creole
316
+ Character formatting extends across line breaks: **bold,
317
+ this is still bold. This line deliberately does not end in star-star.
318
+
319
+ Not bold. Character formatting does not cross paragraph boundaries.
320
+ creole
321
+ )
322
+ assert_equal_filecontent( "expected_creole/test_creole_line_break.html", creole.to_doc(:html))
323
+ assert_equal_filecontent( "expected_creole/test_creole_line_break.latex", creole.to_doc(:latex))
324
+ $log.info('test_creole_inline_bold_line_break: inline to wiki/creole')
325
+ #~ assert_equal_filecontent( "expected_creole/test_creole_line_break.creole", creole.to_doc(:creole))
326
+ #~ assert_equal_filecontent( "expected_creole/test_creole_line_break.text", creole.to_doc(:text))
327
+ end
328
+
329
+ end #Test_creole_inline
330
+
331
+
332
+ class Test_creole_lists < Test::Unit::TestCase
333
+ def test_creole_list_ul()
334
+ creole = Creole.new(:content => <<creole
335
+ Text before
336
+ *Listentry 1
337
+ *Listentry 2
338
+ **Listentry 2.1
339
+ **Listentry 2.2
340
+ *Listentry 3
341
+ **Listentry 3.2
342
+
343
+
344
+ * You can have
345
+ multiline list items
346
+ * this is a second multiline
347
+ list item
348
+
349
+ Text afterwords
350
+ creole
351
+ )
352
+ assert_equal_filecontent( "expected_creole/test_creole_list_ul.html", creole.to_doc(:html))
353
+ assert_equal_filecontent( "expected_creole/test_creole_list_ul.latex", creole.to_doc(:latex))
354
+ $log.warn('test_creole_list_ul: list to wiki/creole')
355
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ul.creole", creole.to_doc(:creole))
356
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ul.wiki", creole.to_doc(:wiki))
357
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ul.text", creole.to_doc(:text))
358
+ assert_equal_filecontent( "expected_creole/test_creole_list_ul.normsource", creole.normsource.to_yaml)
359
+ end
360
+ #It works fine here, but LaTeX will give you an error.
361
+ def test_creole_list_ul_too_much()
362
+ creole = Creole.new(:content => <<creole
363
+ Text before
364
+ *Listentry 1
365
+ *Listentry 2
366
+ **Listentry 2.1
367
+ **Listentry 2.2
368
+ ***Listentry 2.2.1
369
+ ****Listentry 2.2.1.1
370
+ *****Listentry 2.2.1.1.1
371
+ *Listentry 3
372
+
373
+ Text afterwords
374
+ creole
375
+ )
376
+ assert_equal_filecontent( "expected_creole/test_creole_list_ul_too_much.html", creole.to_doc(:html))
377
+ assert_equal_filecontent( "expected_creole/test_creole_list_ul_too_much.latex", creole.to_doc(:latex))
378
+ $log.warn('test_creole_list_ul_too_much: list to wiki/creole')
379
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ul_too_much.creole", creole.to_doc(:creole))
380
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ul_too_much.text", creole.to_doc(:text))
381
+ end
382
+ def test_creole_list_ol()
383
+ creole = Creole.new(:content => <<creole
384
+ Text before
385
+ #Listentry 1
386
+ #Listentry 2
387
+ ##Listentry 2.1
388
+ ##Listentry 2.2
389
+ #Listentry 3
390
+ Text afterwords
391
+ creole
392
+ )
393
+ assert_equal_filecontent( "expected_creole/test_creole_list_ol.html", creole.to_doc(:html))
394
+ assert_equal_filecontent( "expected_creole/test_creole_list_ol.latex", creole.to_doc(:latex))
395
+ $log.warn('test_creole_list_ol: list to wiki/creole')
396
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ol.creole", creole.to_doc(:creole))
397
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ol.text", creole.to_doc(:text))
398
+ end #ol
399
+
400
+ def test_creole_list_ol_ul()
401
+ creole = Creole.new(:content => <<creole
402
+ Text before
403
+ #Listentry 1
404
+ #Listentry 2
405
+ #*Listentry 2.1
406
+ #*Listentry 2.2
407
+ #Listentry 3
408
+
409
+ Text afterwords
410
+ creole
411
+ )
412
+ assert_equal_filecontent( "expected_creole/test_creole_list_ol_ul.html", creole.to_doc(:html))
413
+ assert_equal_filecontent( "expected_creole/test_creole_list_ol_ul.latex", creole.to_doc(:latex))
414
+ $log.warn('test_creole_list_ol_ul: list to wiki/creole')
415
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_ul.creole", creole.to_doc(:creole))
416
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_ul.text", creole.to_doc(:text))
417
+ end
418
+
419
+ def test_creole_list_ol_after_ul()
420
+ creole = Creole.new(:content => <<creole
421
+ Text before
422
+ *Listentry 1
423
+ #Listentry 2
424
+
425
+ Text afterwords
426
+ creole
427
+ )
428
+ assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.html", creole.to_doc(:html))
429
+ assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.latex", creole.to_doc(:latex))
430
+ $log.warn('test_creole_list_ol_after_ul: list to wiki/creole')
431
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.creole", creole.to_doc(:creole))
432
+ #~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.text", creole.to_doc(:text))
433
+ end
434
+
435
+ #Line breaks will be lost.
436
+ def test_creole_ul_multiple_line()
437
+ $log.warn('test_creole_ul_multiple_line: latex: grosse textl�cken (wrap mit leerzeichen bereinigen?)')
438
+ creole = Creole.new(:content => <<creole
439
+ * vorher
440
+ * text
441
+ mehr text zum item
442
+ * nachher und vorher
443
+ * text
444
+ mehr text zum item
445
+ * nachher
446
+ creole
447
+ )
448
+ assert_equal_filecontent( "expected_creole/test_creole_ul_multiple_line.html", creole.to_doc(:html))
449
+ assert_equal_filecontent( "expected_creole/test_creole_ul_multiple_line.latex", creole.to_doc(:latex))
450
+ $log.warn('test_creole_ul_multiple_line: list to wiki/creole')
451
+ #~ assert_equal_filecontent( "expected_creole/test_creole_ul_multiple_line.creole", creole.to_doc(:creole))
452
+ #~ assert_equal_filecontent( "expected_creole/test_creole_ul_multiple_line.text", creole.to_doc(:text)) #fixme
453
+ end
454
+ def test_creole_ul_with_bold()
455
+ creole = Creole.new(:content => <<creole
456
+ You can use lists, start it at the first column for now, please...
457
+
458
+ unnumbered lists are like
459
+ * item a
460
+ * item b
461
+ * **bold item c**
462
+ Text
463
+ creole
464
+ )
465
+ assert_equal_filecontent( "expected_creole/test_creole_ul_with_bold.html", creole.to_doc(:html))
466
+ assert_equal_filecontent( "expected_creole/test_creole_ul_with_bold.latex", creole.to_doc(:latex))
467
+ $log.warn('test_creole_ul_with_bold: list to wiki/creole')
468
+ #~ assert_equal_filecontent( "expected_creole/test_creole_ul_with_bold.creole", creole.to_doc(:creole))
469
+ assert_equal_filecontent( "expected_creole/test_creole_ul_with_bold.text", creole.to_doc(:text))
470
+ end
471
+ def test_creole_ul_with_blank()
472
+ creole = Creole.new(:content => <<creole
473
+ blank space is also permitted before lists like:
474
+ * item a
475
+ * item b
476
+ * item c
477
+ ** item c.a
478
+ Text
479
+ creole
480
+ )
481
+ assert_equal_filecontent( "expected_creole/test_creole_ul_with_blank.html", creole.to_doc(:html))
482
+ assert_equal_filecontent( "expected_creole/test_creole_ul_with_blank.latex", creole.to_doc(:latex))
483
+ $log.warn('test_creole_ul_with_blank: list to wiki/creole')
484
+ #~ assert_equal_filecontent( "expected_creole/test_creole_ul_with_blank.creole", creole.to_doc(:creole))
485
+ #~ assert_equal_filecontent( "expected_creole/test_creole_ul_with_blank.text", creole.to_doc(:text))
486
+ end
487
+ end #Test_creole_List
488
+
489
+
490
+
491
+ class Test_creole_links < Test::Unit::TestCase
492
+ def test_creole_links_external_explizit()
493
+ creole = Creole.new(:content => <<creole
494
+ Here's a external link without a description: [[http://www.wikicreole.org]].
495
+
496
+ And here's a external link with a description: [[http://www.wikicreole.org|wikicreole.org]].
497
+ creole
498
+ )
499
+ assert_equal_filecontent( "expected_creole/test_creole_links_external.html", creole.to_doc(:html))
500
+ assert_equal_filecontent( "expected_creole/test_creole_links_external.latex", creole.to_doc(:latex))
501
+ $log.warn('test_creole_links_external: to wiki/creole')
502
+ #~ assert_equal_filecontent( "expected_creole/test_creole_links_external.creole", creole.to_doc(:creole))
503
+ assert_equal_filecontent( "expected_creole/test_creole_links_external.text", creole.to_doc(:text))
504
+ end #test_creole_links_external
505
+
506
+ def test_creole_links_external_implicit()
507
+ creole = Creole.new(:content => <<creole
508
+ Free links without braces should be rendered as well, like http://www.wikicreole.org/ and http://www.wikicreole.org/users/~example.
509
+
510
+ See also description: http://www.wikicreole.org/wiki/Links
511
+
512
+ In case of phrase ends with . you should use explicit links like
513
+ [[http://www.wikicreole.org/users/~example]].
514
+ creole
515
+ )
516
+ assert_equal_filecontent( "expected_creole/test_creole_links_external_implicit.html", creole.to_doc(:html))
517
+ assert_equal_filecontent( "expected_creole/test_creole_links_external_implicit.latex", creole.to_doc(:latex))
518
+ $log.warn('test_creole_links_external_implicit: to wiki/creole')
519
+ #~ assert_equal_filecontent( "expected_creole/test_creole_links_external_implicit.creole", creole.to_doc(:creole))
520
+ assert_equal_filecontent( "expected_creole/test_creole_links_external_implicit.text", creole.to_doc(:text))
521
+ end #test_creole_links_external_implicit
522
+ def test_creole_links_explicit_with_em()
523
+ creole = Creole.new(:content => <<creole
524
+ Be careful that italic links are rendered properly: //[[http://my.book.example/|My Book Title]]//
525
+ creole
526
+ )
527
+ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_with_em.html", creole.to_doc(:html))
528
+ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_with_em.latex", creole.to_doc(:latex))
529
+ $log.warn('test_creole_links_explicit_with_em: to wiki/creole')
530
+ #~ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_with_em.creole", creole.to_doc(:creole))
531
+ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_with_em.text", creole.to_doc(:text))
532
+ end #test_creole_links_explicit_with_em
533
+
534
+ def test_creole_links_file()
535
+ creole = Creole.new(:content => <<creole
536
+ [[./#{__FILE__}]]
537
+
538
+ [[./#{__FILE__}|This unittest-source]]
539
+ creole
540
+ )
541
+ assert_equal_filecontent( "expected_creole/test_creole_links_file.html", creole.to_doc(:html))
542
+ assert_equal_filecontent( "expected_creole/test_creole_links_file.latex", creole.to_doc(:latex))
543
+ $log.warn('test_creole_links_file: to wiki/creole')
544
+ #~ assert_equal_filecontent( "expected_creole/test_creole_links_file.creole", creole.to_doc(:creole))
545
+ assert_equal_filecontent( "expected_creole/test_creole_links_file.text", creole.to_doc(:text))
546
+ end #test_creole_links_file
547
+
548
+ def test_creole_links_explicit_internal()
549
+ creole = Creole.new(:content => <<creole
550
+ [[#internal]]
551
+
552
+ [[#internal|Links inside]]
553
+ creole
554
+ )
555
+ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_internal.html", creole.to_doc(:html))
556
+ $log.warn('test_creole_links_explicit_internal: to latex')
557
+ #~ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_internal.latex", creole.to_doc(:latex))
558
+ $log.warn('test_creole_links_explicit_internal: to wiki/creole')
559
+ #~ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_internal.creole", creole.to_doc(:creole))
560
+ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_internal.text", creole.to_doc(:text))
561
+ end #test_creole_links_explicit_internal
562
+
563
+ end #Test_creole_links
564
+
565
+
566
+ class Test_creole_pictures < Test::Unit::TestCase
567
+ def test_creole_pictures()
568
+ creole = Creole.new(:content => <<creole
569
+ This should be a flower with the ALT text "this is a flower" if your wiki supports ALT text on images:
570
+
571
+ {{Red_Flower.jpg}}
572
+
573
+ {{Red_Flower.jpg|here is a red flower}}
574
+ creole
575
+ )
576
+ assert_equal_filecontent( "expected_creole/test_creole_pictures.html", creole.to_doc(:html))
577
+ assert_equal_filecontent( "expected_creole/test_creole_pictures.latex", creole.to_doc(:latex))
578
+ $log.warn('test_creole_pictures: to wiki/creole')
579
+ #~ assert_equal_filecontent( "expected_creole/test_creole_pictures.creole", creole.to_doc(:creole))
580
+ $log.warn('test_creole_pictures: to text/creole')
581
+ #~ assert_equal_filecontent( "expected_creole/test_creole_pictures.text", creole.to_doc(:text))
582
+ end #test_creole_pictures
583
+ def test_creole_picture_link()
584
+ creole = Creole.new(:name => 'Creole_picture_link',
585
+ :content => <<creole
586
+ [[./#{__FILE__}|{{Red_Flower.jpg}}]] - if you click on the image, will goto "some link"
587
+
588
+ [[http://example.com/|{{Red_Flower.jpg}}]] - same as above: picture links to url
589
+ creole
590
+ )
591
+ assert_equal_filecontent( "expected_creole/test_creole_picture_link.html", creole.to_doc(:html))
592
+ #~ assert_equal_filecontent( "expected_creole/test_creole_picture_link.latex", creole.to_doc(:latex))
593
+ $log.warn('test_creole_picture_link: to wiki/creole')
594
+ #~ assert_equal_filecontent( "expected_creole/test_creole_picture_link.creole", creole.to_doc(:creole))
595
+ #~ assert_equal_filecontent( "expected_creole/test_creole_picture_link.text", creole.to_doc(:text))
596
+ end #test_creole_picture_link
597
+ def test_creole_pictures_css()
598
+ creole = Creole.new(
599
+ :name => 'pictures_css',
600
+ :content => <<creole
601
+ {{Red_Flower.jpg|red flower|css=width:50px}}
602
+ {{Red_Flower.jpg|red flower|imgcss=width:100px}}
603
+ creole
604
+ )
605
+ assert_equal_filecontent( "expected_creole/test_creole_pictures_css.html", creole.to_doc(:html))
606
+ assert_equal_filecontent( "expected_creole/test_creole_pictures_css.latex", creole.to_doc(:latex))
607
+ $log.warn('test_creole_pictures_css: to wiki/creole')
608
+ #~ assert_equal_filecontent( "expected_creole/test_creole_pictures_css.creole", creole.to_doc(:creole))
609
+ $log.warn('test_creole_pictures_css: to text/creole')
610
+ #~ assert_equal_filecontent( "expected_creole/test_creole_pictures_css.text", creole.to_doc(:text))
611
+ end #test_creole_pictures_css
612
+ def test_creole_pictures_imgclass()
613
+ creole = Creole.new(
614
+ :name => 'pictures_imgclass',
615
+ :content => <<creole
616
+ {{Red_Flower.jpg||class=test}}
617
+
618
+ {{Red_Flower.jpg||imgclass=test}}
619
+ creole
620
+ )
621
+ assert_equal_filecontent( "expected_creole/test_creole_pictures_imgclass.html", creole.to_doc(:html))
622
+ assert_equal_filecontent( "expected_creole/test_creole_pictures_imgclass.latex", creole.to_doc(:latex))
623
+ $log.warn('test_creole_pictures_imgclass: to wiki/creole')
624
+ #~ assert_equal_filecontent( "expected_creole/test_creole_pictures_imgclass.creole", creole.to_doc(:creole))
625
+ $log.warn('test_creole_pictures_imgclass: to text/creole')
626
+ #~ assert_equal_filecontent( "expected_creole/test_creole_pictures_imgclass.text", creole.to_doc(:text))
627
+ end #test_creole_pictures_imgclass
628
+
629
+ end #Test_creole_pictures
630
+
631
+
632
+ class Test_creole_verbatim < Test::Unit::TestCase
633
+ def test_creole_verbatim()
634
+ creole = Creole.new( :name => 'creole_verbatim',
635
+ :content => <<creole
636
+ You can use nowiki syntax if you would like do stuff like this:
637
+
638
+ {{{
639
+ Guitar Chord C:
640
+
641
+ ||---|---|---|
642
+ ||-0-|---|---|
643
+ ||---|---|---|
644
+ ||---|-0-|---|
645
+ ||---|---|-0-|
646
+ ||---|---|---|
647
+ }}}
648
+
649
+ before
650
+ {{{
651
+ This is some verbatim text
652
+ }}}
653
+ after
654
+
655
+ See http://www.wikicreole.org/wiki/PreformattedAndNowiki
656
+ creole
657
+ )
658
+ assert_equal_filecontent( "expected_creole/test_creole_verbatim.html", creole.to_doc(:html))
659
+ assert_equal_filecontent( "expected_creole/test_creole_verbatim.latex", creole.to_doc(:latex))
660
+ $log.warn('test_creole_verbatim: change < to &lt; ....')
661
+ $log.warn('test_creole_verbatim: to wiki/creole')
662
+ #~ assert_equal_filecontent( "expected_creole/test_creole_verbatim.creole", creole.to_doc(:creole))
663
+ assert_equal_filecontent( "expected_creole/test_creole_verbatim.text", creole.to_doc(:text))
664
+ end #test_creole_verbatim
665
+ def test_creole_verbatim_inline()
666
+ creole = Creole.new(:content => <<creole
667
+
668
+ You can also use inline nowiki {{{ in a sentence }}} like this.
669
+ See http://www.wikicreole.org/wiki/PreformattedAndNowiki
670
+
671
+ Some examples of markup are: {{{** <i>this</i> ** }}}
672
+ creole
673
+ )
674
+ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline.html", creole.to_doc(:html))
675
+ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline.latex", creole.to_doc(:latex))
676
+ $log.warn('test_creole_verbatim_inline: to wiki/creole')
677
+ #~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline.creole", creole.to_doc(:creole))
678
+ #~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline.text", creole.to_doc(:text))
679
+ end #test_creole_verbatim_inline
680
+ def test_creole_verbatim_inline_at_start()
681
+ creole = Creole.new(
682
+ :name => 'verbatim_inline_at_start',
683
+ :content => <<creole
684
+ Short verbatim can also be at the start:
685
+ {{{this is verbatim}}}
686
+
687
+ This test checks, if the differences of normal verbatim is detected.
688
+ creole
689
+ )
690
+ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline_at_start.html", creole.to_doc(:html))
691
+ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline_at_start.latex", creole.to_doc(:latex))
692
+ $log.warn('test_creole_verbatim_inline_at_start: to wiki/creole')
693
+ #~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline_at_start.creole", creole.to_doc(:creole))
694
+ $log.warn('test_creole_verbatim_inline_at_start: to text/creole')
695
+ #~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline_at_start.text", creole.to_doc(:text))
696
+ end #test_creole_verbatim_inline_at_start
697
+
698
+ end #Test_creole_verbatim
699
+
700
+ class Test_creole_placeholders < Test::Unit::TestCase
701
+ def test_creole_placeholders()
702
+ creole = Creole.new(:content => <<creole
703
+ ==Titel 1==
704
+ Text
705
+ creole
706
+ )
707
+ assert_equal( Creole::Placeholders, creole.placeholders)
708
+ assert_equal( Creole_dummy_placeholder, Creole::Placeholders[:undefined])
709
+ assert_equal( Creole_html, Creole::Placeholders['html'])
710
+ #~ assert_instance_of( Creole_dummy_placeholder, Creole::Placeholders[:undefined])
711
+ Creole::Placeholders.each{|key,placeholder_class|
712
+ assert_equal( placeholder_class, Creole::Placeholders[key])
713
+ assert_equal( placeholder_class, creole.placeholders[key])
714
+
715
+ placeholder = placeholder_class.new( Creole.new )
716
+ #Check inheratance.
717
+ assert_kind_of( Creole_placeholder, placeholder)
718
+ }
719
+ end #test_creole_placeholders
720
+ def test_creole_placeholders_html()
721
+ creole = Creole.new(:content => <<creole
722
+ before
723
+ <<<html
724
+ <em>this is only for HTML</em>
725
+ >>>
726
+ after
727
+ creole
728
+ )
729
+ #Really like this? Or should there be no paragraph?
730
+ assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.html", creole.to_doc(:html))
731
+ assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.latex", creole.to_doc(:latex))
732
+ $log.warn('test_creole_placeholders_html: to wiki/creole')
733
+ #~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.creole", creole.to_doc(:creole))
734
+ assert_equal_filecontent( "expected_creole/test_creole_placeholders_html.text", creole.to_doc(:text))
735
+ end #test_creole_placeholders_html
736
+ def test_creole_placeholders_latex()
737
+ creole = Creole.new(:content => <<creole
738
+ before
739
+ <<<latex
740
+ \\textbf{this is only for latex}
741
+ >>>
742
+ after
743
+ creole
744
+ )
745
+ #Really like this? Or should there be no paragraph?
746
+ assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.html", creole.to_doc(:html))
747
+ assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.latex", creole.to_doc(:latex))
748
+ $log.warn('test_creole_placeholders_latex: to wiki/creole')
749
+ #~ assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.creole", creole.to_doc(:creole))
750
+ assert_equal_filecontent( "expected_creole/test_creole_placeholders_latex.text", creole.to_doc(:text))
751
+ end #test_creole_placeholders_latex
752
+
753
+ end #Test_creole_placeholders
754
+
755
+ #http://www.wikicreole.org/wiki/Tables
756
+ class Test_creole_tabular < Test::Unit::TestCase
757
+ def test_creole_tabular_creole()
758
+ creole = Creole.new(
759
+ :name => 'tabular_creole',
760
+ :content => <<'creole'
761
+ Tables are done like this:
762
+ |=header col1|=header col2|
763
+ |col1|col2|
764
+ |you |can |
765
+ |also |align\\ it. |
766
+ creole
767
+ )
768
+ $log.warn('test_creole_tabular_creole: tabular inside paragraphs/list...')
769
+ $log.warn('test_creole_tabular_creole: wiki syntax inside cell ')
770
+ assert_equal_filecontent( "expected_creole/test_creole_tabular_creole.html", creole.to_doc(:html))
771
+ assert_equal_filecontent( "expected_creole/test_creole_tabular_creole.latex", creole.to_doc(:latex))
772
+ $log.warn('test_creole_tabular_creole: to wiki/creole')
773
+ #~ assert_equal_filecontent( "expected_creole/test_creole_tabular_creole.creole", creole.to_doc(:creole))
774
+ $log.warn('test_creole_tabular_creole: to text/creole')
775
+ #~ assert_equal_filecontent( "expected_creole/test_creole_tabular_creole.text", creole.to_doc(:text))
776
+ end #test_creole_tabular_creole
777
+
778
+ def test_creole_tabular()
779
+ creole = Creole.new(:content => <<creole
780
+ before
781
+ <<<tabular
782
+ |!columns=3
783
+ |!columndescription=ccc
784
+ |=1
785
+ |=2
786
+ |=3
787
+ |-
788
+ |eins
789
+ |zwei
790
+ |drei
791
+ |-
792
+ |one
793
+ |two
794
+ |three
795
+ >>>
796
+ after
797
+ creole
798
+ )
799
+ assert_equal_filecontent( "expected_creole/test_creole_tabular.html", creole.to_doc(:html))
800
+ assert_equal_filecontent( "expected_creole/test_creole_tabular.latex", creole.to_doc(:latex))
801
+ $log.warn('test_creole_tabular: to wiki/creole')
802
+ #~ assert_equal_filecontent( "expected_creole/test_creole_tabular.creole", creole.to_doc(:creole))
803
+ $log.warn('test_creole_tabular: to text/creole')
804
+ #~ assert_equal_filecontent( "expected_creole/test_creole_tabular.text", creole.to_doc(:text))
805
+ end #test_creole_tabular
806
+ def test_creole_tabular_css()
807
+ creole = Creole.new(:content => <<creole
808
+ before
809
+ <<<tabular
810
+ |!columns=3
811
+ |!columndescription=ccc
812
+ |!css=border-width: 1px
813
+ |!css=border-style: solid
814
+ |=1
815
+ |=2
816
+ |=3
817
+ |-
818
+ |eins
819
+ |zwei
820
+ |drei
821
+ |-
822
+ |one
823
+ |two
824
+ |three
825
+ >>>
826
+ after
827
+ creole
828
+ )
829
+ assert_equal_filecontent( "expected_creole/test_creole_tabular_css.html", creole.to_doc(:html))
830
+ assert_equal_filecontent( "expected_creole/test_creole_tabular_css.latex", creole.to_doc(:latex))
831
+ $log.warn('test_creole_tabular_css: to wiki/creole')
832
+ #~ assert_equal_filecontent( "expected_creole/test_creole_tabular_css.creole", creole.to_doc(:creole))
833
+ $log.warn('test_creole_tabular_css: to text/creole')
834
+ #~ assert_equal_filecontent( "expected_creole/test_creole_tabular_css.text", creole.to_doc(:text))
835
+ end #test_creole_tabular_css
836
+ end #Test_creole_tabular
837
+
838
+ class Test_creole_footnote < Test::Unit::TestCase
839
+ def test_creole_footnotes()
840
+ creole = Creole.new(
841
+ :name => 'footnotes',
842
+ :content => <<creole
843
+ <<footnote|This is a footnote>>
844
+ ----
845
+ <<footnotes>>
846
+ creole
847
+ )
848
+ assert_equal_filecontent( "expected_creole/test_creole_footnotes.html", creole.to_doc(:html))
849
+ assert_equal_filecontent( "expected_creole/test_creole_footnotes.latex", creole.to_doc(:latex))
850
+ $log.warn('test_creole_footnotes: to wiki/creole')
851
+ #~ assert_equal_filecontent( "expected_creole/test_creole_footnotes.creole", creole.to_doc(:creole))
852
+ $log.warn('test_creole_footnotes: to text/creole')
853
+ #~ assert_equal_filecontent( "expected_creole/test_creole_footnotes.text", creole.to_doc(:text))
854
+ end #test_creole_footnotes
855
+ def test_creole_footnotes_label()
856
+ creole = Creole.new(
857
+ :name => 'footnotes_label',
858
+ :content => <<creole
859
+ <<footnote|This is a footnote|label=s>>
860
+ This makes only sense in HTML
861
+ ----
862
+ <<footnotes>>
863
+ creole
864
+ )
865
+ assert_equal_filecontent( "expected_creole/test_creole_footnotes_label.html", creole.to_doc(:html))
866
+ #~ assert_equal_filecontent( "expected_creole/test_creole_footnotes_label.latex", creole.to_doc(:latex))
867
+ #~ $log.warn('test_creole_footnotes_label: to wiki/creole')
868
+ #~ assert_equal_filecontent( "expected_creole/test_creole_footnotes_label.creole", creole.to_doc(:creole))
869
+ #~ $log.warn('test_creole_footnotes_label: to text/creole')
870
+ #~ assert_equal_filecontent( "expected_creole/test_creole_footnotes_label.text", creole.to_doc(:text))
871
+ end #test_creole_footnotes_label
872
+
873
+ end #Test_creole_footnote
874
+
875
+ class Test_creole_characters < Test::Unit::TestCase
876
+ def test_creole_characters_all()
877
+ creole = Creole.new(
878
+ :name => 'characters_all',
879
+ :content => Creole::CHARACTERS.keys.map{|char| "*#{char}" }.join("\n")
880
+ )
881
+ assert_equal_filecontent( "expected_creole/test_creole_characters_all.html", creole.to_doc(:html))
882
+ assert_equal_filecontent( "expected_creole/test_creole_characters_all.latex", creole.to_doc(:latex))
883
+ $log.warn('test_creole_characters_all: to wiki/creole')
884
+ #~ assert_equal_filecontent( "expected_creole/test_creole_characters_all.creole", creole.to_doc(:creole))
885
+ $log.warn('test_creole_characters_all: to text/creole')
886
+ #~ assert_equal_filecontent( "expected_creole/test_creole_characters_all.text", creole.to_doc(:text))
887
+ end #test_creole_characters_all
888
+ def test_creole_characters_special()
889
+ creole = Creole.new(
890
+ :name => 'characters_special',
891
+ :content => <<creole
892
+ Special Characters:
893
+ *$ - Dollar
894
+ *% - Percent
895
+ *=> Rightarrow
896
+ *-> rightarrow
897
+ *_ Underscore
898
+ creole
899
+ )
900
+ assert_equal_filecontent( "expected_creole/test_creole_characters_special.html", creole.to_doc(:html))
901
+ assert_equal_filecontent( "expected_creole/test_creole_characters_special.latex", creole.to_doc(:latex))
902
+ $log.warn('test_creole_characters_special: to wiki/creole')
903
+ #~ assert_equal_filecontent( "expected_creole/test_creole_characters_special.creole", creole.to_doc(:creole))
904
+ $log.warn('test_creole_characters_special: to text/creole')
905
+ #~ assert_equal_filecontent( "expected_creole/test_creole_characters_special.text", creole.to_doc(:text))
906
+ end #test_creole_characters_special
907
+
908
+ end #Test_creole_characters
909
+
910
+ class Test_creole_inline_ruby < Test::Unit::TestCase
911
+ def self.ruby_test()
912
+ return '*hallo welt'
913
+ end
914
+ def test_creole_inline_ruby_raw()
915
+ creole = Creole.new(
916
+ :name => 'inline_ruby_raw',
917
+ :content => <<creole
918
+ The following Rubycode is added as raw text.
919
+ 1 + 1 = <<ruby_raw|1+1>>
920
+
921
+ <<ruby_raw|Test_creole_inline_ruby::ruby_test>>
922
+ creole
923
+ )
924
+ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby_raw.html", creole.to_doc(:html))
925
+ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby_raw.latex", creole.to_doc(:latex))
926
+ $log.warn('test_creole_inline_ruby_raw: to wiki/creole')
927
+ #~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby_raw.creole", creole.to_doc(:creole))
928
+ $log.warn('test_creole_inline_ruby_raw: to text/creole')
929
+ #~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby_raw.text", creole.to_doc(:text))
930
+ end #test_creole_inline_ruby_raw
931
+ def test_creole_inline_ruby()
932
+ creole = Creole.new(
933
+ :name => 'inline_ruby',
934
+ :content => <<creole
935
+ The following ruby code is added and parsed by the wiki.
936
+ *1 + 1 = <<ruby|1+1>>
937
+ <<ruby|Test_creole_inline_ruby::ruby_test>>
938
+ creole
939
+ )
940
+ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby.html", creole.to_doc(:html))
941
+ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby.latex", creole.to_doc(:latex))
942
+ $log.warn('test_creole_inline_ruby: to wiki/creole')
943
+ #~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby.creole", creole.to_doc(:creole))
944
+ $log.warn('test_creole_inline_ruby: to text/creole')
945
+ #~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby.text", creole.to_doc(:text))
946
+ end #test_creole_inline_ruby
947
+ def test_creole_countdown()
948
+ creole = Creole.new(
949
+ :name => 'countdown',
950
+ :content => <<creole
951
+ Countdown: <<ruby_raw|(1..10).to_a.reverse.join("-")>>
952
+ creole
953
+ )
954
+ assert_equal_filecontent( "expected_creole/test_creole_countdown.html", creole.to_doc(:html))
955
+ assert_equal_filecontent( "expected_creole/test_creole_countdown.latex", creole.to_doc(:latex))
956
+ $log.warn('test_creole_countdown: to wiki/creole')
957
+ #~ assert_equal_filecontent( "expected_creole/test_creole_countdown.creole", creole.to_doc(:creole))
958
+ $log.warn('test_creole_countdown: to text/creole')
959
+ #~ assert_equal_filecontent( "expected_creole/test_creole_countdown.text", creole.to_doc(:text))
960
+ end #test_creole_countdown
961
+
962
+ end #Test_creole_inline_ruby
963
+
964
+
965
+ def newtest(text, with_class = false )
966
+ code = ''
967
+ code << "class Test_creole_#{text} < Test::Unit::TestCase\n" if with_class
968
+ code << <<code
969
+ def test_creole_#{text}()
970
+ creole = Creole.new(
971
+ :name => '#{text}',
972
+ :content => <<creole
973
+ ==Titel 1==
974
+ Text
975
+ creole
976
+ )
977
+ assert_equal_filecontent( "expected_creole/test_creole_#{text}.html", creole.to_doc(:html))
978
+ assert_equal_filecontent( "expected_creole/test_creole_#{text}.latex", creole.to_doc(:latex))
979
+ $log.warn('test_creole_#{text}: to wiki/creole')
980
+ #~ assert_equal_filecontent( "expected_creole/test_creole_#{text}.creole", creole.to_doc(:creole))
981
+ assert_equal_filecontent( "expected_creole/test_creole_#{text}.text", creole.to_doc(:text))
982
+ end #test_creole_#{text}
983
+ code
984
+ code << "end #Test_creole_#{text}\n" if with_class
985
+ puts code
986
+ end
987
+ #~ newtest('links_explicit_internal')
988
+ #~ newtest('tabular', true)
989
+ #~ newtest('picture_link')
990
+ #~ newtest('verb')
991
+
992
+
993
+
994
+ __END__
995
+ = Escapes =
996
+ Normal Link: http://wikicreole.org/ - now same link, but escaped: ~http://wikicreole.org/
997
+
998
+ Normal asterisks: ~**not bold~**
999
+
1000
+ a tilde alone: ~
1001
+
1002
+ a tilde escapes itself: ~~xxx
1003
+
1004
+ --------------------------------------------
1005
+ Meine Erweiterungen
1006
+ --------------------------------------------
1007
+
1008
+ def test_creole_amazon()
1009
+ creole = Creole.new(:content => <<creole
1010
+ {{amazon|asin=B000AFEJAM}}
1011
+
1012
+ {{amazon|asin=B000AFEJAM|right}}
1013
+ creole
1014
+ )
1015
+ assert_equal_filecontent( "expected_creole/test_creole_amazon.html", creole.to_doc(:html))
1016
+ assert_equal_filecontent( "expected_creole/test_creole_amazon.latex", creole.to_doc(:latex))
1017
+ assert_equal_filecontent( "expected_creole/test_creole_amazon.creole", creole.to_doc(:creole))
1018
+ assert_equal_filecontent( "expected_creole/test_creole_amazon.text", creole.to_doc(:text))
1019
+ end
1020
+
1021
+ ---------
1022
+ neue Ideen
1023
+ #~ {{{div:css=sss
1024
+ #~ {{{p:css=sss