docgenerator-creole 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +7 -0
  2. data/examples/creole_example.rb +76 -0
  3. data/examples/creole_example_footnote.rb +66 -0
  4. data/examples/creole_example_new_plugin.rb +51 -0
  5. data/examples/creole_example_placeholder.rb +77 -0
  6. data/examples/creole_example_rail.rb +155 -0
  7. data/examples/creole_example_rubycode.rb +144 -0
  8. data/examples/creole_example_struktex.rb +170 -0
  9. data/examples/creole_example_tabular.rb +96 -0
  10. data/examples/creole_example_tikz.rb +47 -0
  11. data/lib/docgenerator-creole.rb +5 -0
  12. data/lib/docgenerator/creole.rb +15 -0
  13. data/lib/docgenerator/creole/base.rb +170 -0
  14. data/lib/docgenerator/creole/characters.rb +131 -0
  15. data/lib/docgenerator/creole/creole.rb +708 -0
  16. data/lib/docgenerator/creole/document.rb +91 -0
  17. data/lib/docgenerator/creole/inclusion_and_plugins.rb +91 -0
  18. data/lib/docgenerator/creole/inclusions.rb +148 -0
  19. data/lib/docgenerator/creole/placeholder.rb +242 -0
  20. data/lib/docgenerator/creole/plugins.rb +230 -0
  21. data/lib/docgenerator/creole/plugins/index.rb +61 -0
  22. data/lib/docgenerator/creole/plugins/rail.rb +179 -0
  23. data/lib/docgenerator/creole/plugins/rubycode4creole.rb +136 -0
  24. data/lib/docgenerator/creole/plugins/struktex.rb +60 -0
  25. data/lib/docgenerator/creole/plugins/tikz.rb +93 -0
  26. data/lib/docgenerator/creole/plugins/todonotes.rb +77 -0
  27. data/lib/docgenerator/creole/tabular.rb +405 -0
  28. data/readme.rdoc +44 -0
  29. data/unittest/Red_Flower.jpg +0 -0
  30. data/unittest/expected_creole/test_creole.html +3 -0
  31. data/unittest/expected_creole/test_creole_characters_all.creole +28 -0
  32. data/unittest/expected_creole/test_creole_characters_all.html +18 -0
  33. data/unittest/expected_creole/test_creole_characters_all.latex +36 -0
  34. data/unittest/expected_creole/test_creole_characters_special.html +10 -0
  35. data/unittest/expected_creole/test_creole_characters_special.latex +18 -0
  36. data/unittest/expected_creole/test_creole_comment.context +11 -0
  37. data/unittest/expected_creole/test_creole_comment.creole +12 -0
  38. data/unittest/expected_creole/test_creole_comment.html +9 -0
  39. data/unittest/expected_creole/test_creole_comment.latex +11 -0
  40. data/unittest/expected_creole/test_creole_countdown.html +3 -0
  41. data/unittest/expected_creole/test_creole_countdown.latex +4 -0
  42. data/unittest/expected_creole/test_creole_creole1.0test.html +182 -0
  43. data/unittest/expected_creole/test_creole_creole1.0test.latex +253 -0
  44. data/unittest/expected_creole/test_creole_creole1.0test.text +160 -0
  45. data/unittest/expected_creole/test_creole_footnotes.html +9 -0
  46. data/unittest/expected_creole/test_creole_footnotes.latex +14 -0
  47. data/unittest/expected_creole/test_creole_footnotes_groupid.html +15 -0
  48. data/unittest/expected_creole/test_creole_footnotes_label.html +9 -0
  49. data/unittest/expected_creole/test_creole_headings.html +17 -0
  50. data/unittest/expected_creole/test_creole_headings.latex +19 -0
  51. data/unittest/expected_creole/test_creole_headings.text +48 -0
  52. data/unittest/expected_creole/test_creole_headings.wiki +37 -0
  53. data/unittest/expected_creole/test_creole_hr.html +7 -0
  54. data/unittest/expected_creole/test_creole_hr.latex +9 -0
  55. data/unittest/expected_creole/test_creole_hr.text +4 -0
  56. data/unittest/expected_creole/test_creole_ignore.html +3 -0
  57. data/unittest/expected_creole/test_creole_ignore.latex +4 -0
  58. data/unittest/expected_creole/test_creole_ignore.text +2 -0
  59. data/unittest/expected_creole/test_creole_inline.html +3 -0
  60. data/unittest/expected_creole/test_creole_inline.latex +4 -0
  61. data/unittest/expected_creole/test_creole_inline.text +2 -0
  62. data/unittest/expected_creole/test_creole_inline_apostroph.html +7 -0
  63. data/unittest/expected_creole/test_creole_inline_apostroph.latex +9 -0
  64. data/unittest/expected_creole/test_creole_inline_apostroph.text +5 -0
  65. data/unittest/expected_creole/test_creole_inline_ruby.html +12 -0
  66. data/unittest/expected_creole/test_creole_inline_ruby.latex +20 -0
  67. data/unittest/expected_creole/test_creole_inline_ruby_raw.html +6 -0
  68. data/unittest/expected_creole/test_creole_inline_ruby_raw.latex +8 -0
  69. data/unittest/expected_creole/test_creole_input.normsource +22 -0
  70. data/unittest/expected_creole/test_creole_input.normsource_1.8 +23 -0
  71. data/unittest/expected_creole/test_creole_input_file_simple.html +15 -0
  72. data/unittest/expected_creole/test_creole_input_file_simple_readlines.html +15 -0
  73. data/unittest/expected_creole/test_creole_label.html +12 -0
  74. data/unittest/expected_creole/test_creole_label.latex +15 -0
  75. data/unittest/expected_creole/test_creole_line_break.html +6 -0
  76. data/unittest/expected_creole/test_creole_line_break.latex +8 -0
  77. data/unittest/expected_creole/test_creole_links_explicit_internal.html +6 -0
  78. data/unittest/expected_creole/test_creole_links_explicit_internal.text +4 -0
  79. data/unittest/expected_creole/test_creole_links_explicit_with_em.html +3 -0
  80. data/unittest/expected_creole/test_creole_links_explicit_with_em.latex +4 -0
  81. data/unittest/expected_creole/test_creole_links_explicit_with_em.text +2 -0
  82. data/unittest/expected_creole/test_creole_links_external.html +6 -0
  83. data/unittest/expected_creole/test_creole_links_external.latex +8 -0
  84. data/unittest/expected_creole/test_creole_links_external.text +4 -0
  85. data/unittest/expected_creole/test_creole_links_external_implicit.html +9 -0
  86. data/unittest/expected_creole/test_creole_links_external_implicit.latex +12 -0
  87. data/unittest/expected_creole/test_creole_links_external_implicit.text +6 -0
  88. data/unittest/expected_creole/test_creole_links_file.html +6 -0
  89. data/unittest/expected_creole/test_creole_links_file.latex +8 -0
  90. data/unittest/expected_creole/test_creole_links_file.text +4 -0
  91. data/unittest/expected_creole/test_creole_links_implicit_end.creole +4 -0
  92. data/unittest/expected_creole/test_creole_links_implicit_end.html +3 -0
  93. data/unittest/expected_creole/test_creole_links_implicit_end.latex +4 -0
  94. data/unittest/expected_creole/test_creole_list_ol.html +12 -0
  95. data/unittest/expected_creole/test_creole_list_ol.latex +22 -0
  96. data/unittest/expected_creole/test_creole_list_ol_after_ul.html +12 -0
  97. data/unittest/expected_creole/test_creole_list_ol_after_ul.latex +20 -0
  98. data/unittest/expected_creole/test_creole_list_ol_after_ul.text +6 -0
  99. data/unittest/expected_creole/test_creole_list_ol_ul.html +15 -0
  100. data/unittest/expected_creole/test_creole_list_ol_ul.latex +26 -0
  101. data/unittest/expected_creole/test_creole_list_ul.html +22 -0
  102. data/unittest/expected_creole/test_creole_list_ul.latex +40 -0
  103. data/unittest/expected_creole/test_creole_list_ul.normsource +85 -0
  104. data/unittest/expected_creole/test_creole_list_ul.normsource_1.8 +83 -0
  105. data/unittest/expected_creole/test_creole_list_ul_too_much.html +24 -0
  106. data/unittest/expected_creole/test_creole_list_ul_too_much.latex +44 -0
  107. data/unittest/expected_creole/test_creole_list_ulul_without_ul.html +6 -0
  108. data/unittest/expected_creole/test_creole_list_ulul_without_ul.latex +12 -0
  109. data/unittest/expected_creole/test_creole_mix_titles_list.html +10 -0
  110. data/unittest/expected_creole/test_creole_mix_titles_list.latex +18 -0
  111. data/unittest/expected_creole/test_creole_mix_titles_list.text +12 -0
  112. data/unittest/expected_creole/test_creole_newline.html +9 -0
  113. data/unittest/expected_creole/test_creole_newline.latex +11 -0
  114. data/unittest/expected_creole/test_creole_newline.text +7 -0
  115. data/unittest/expected_creole/test_creole_paragraphs.html +6 -0
  116. data/unittest/expected_creole/test_creole_paragraphs.latex +8 -0
  117. data/unittest/expected_creole/test_creole_paragraphs.normsource +26 -0
  118. data/unittest/expected_creole/test_creole_paragraphs.normsource_1.8 +27 -0
  119. data/unittest/expected_creole/test_creole_paragraphs.text +4 -0
  120. data/unittest/expected_creole/test_creole_paragraphs.wiki +4 -0
  121. data/unittest/expected_creole/test_creole_paragraphs_wrap.html +5 -0
  122. data/unittest/expected_creole/test_creole_paragraphs_wrap.latex +6 -0
  123. data/unittest/expected_creole/test_creole_paragraphs_wrap.text +4 -0
  124. data/unittest/expected_creole/test_creole_paragraphs_wrap.wiki +4 -0
  125. data/unittest/expected_creole/test_creole_paragraphs_wrap0.html +9 -0
  126. data/unittest/expected_creole/test_creole_paragraphs_wrap0.latex +11 -0
  127. data/unittest/expected_creole/test_creole_paragraphs_wrap0.text +7 -0
  128. data/unittest/expected_creole/test_creole_paragraphs_wrap0.wiki +7 -0
  129. data/unittest/expected_creole/test_creole_paragraphs_wrap60.html +5 -0
  130. data/unittest/expected_creole/test_creole_paragraphs_wrap60.latex +6 -0
  131. data/unittest/expected_creole/test_creole_paragraphs_wrap60.text +4 -0
  132. data/unittest/expected_creole/test_creole_paragraphs_wrap60.wiki +4 -0
  133. data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.html +5 -0
  134. data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.latex +6 -0
  135. data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.text +4 -0
  136. data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.wiki +4 -0
  137. data/unittest/expected_creole/test_creole_picture_link.html +6 -0
  138. data/unittest/expected_creole/test_creole_pictures.html +10 -0
  139. data/unittest/expected_creole/test_creole_pictures.latex +13 -0
  140. data/unittest/expected_creole/test_creole_pictures_css.html +6 -0
  141. data/unittest/expected_creole/test_creole_pictures_css.latex +8 -0
  142. data/unittest/expected_creole/test_creole_pictures_imgclass.html +6 -0
  143. data/unittest/expected_creole/test_creole_pictures_imgclass.latex +8 -0
  144. data/unittest/expected_creole/test_creole_pictures_longdesc.html +3 -0
  145. data/unittest/expected_creole/test_creole_pictures_width.html +3 -0
  146. data/unittest/expected_creole/test_creole_pictures_width.latex +4 -0
  147. data/unittest/expected_creole/test_creole_placeholders_html.html +7 -0
  148. data/unittest/expected_creole/test_creole_placeholders_html.latex +8 -0
  149. data/unittest/expected_creole/test_creole_placeholders_html.text +4 -0
  150. data/unittest/expected_creole/test_creole_placeholders_latex.html +6 -0
  151. data/unittest/expected_creole/test_creole_placeholders_latex.latex +9 -0
  152. data/unittest/expected_creole/test_creole_placeholders_latex.text +4 -0
  153. data/unittest/expected_creole/test_creole_short_html.html +3 -0
  154. data/unittest/expected_creole/test_creole_short_html.latex +4 -0
  155. data/unittest/expected_creole/test_creole_short_html.text +2 -0
  156. data/unittest/expected_creole/test_creole_shy.creole +6 -0
  157. data/unittest/expected_creole/test_creole_shy.html +6 -0
  158. data/unittest/expected_creole/test_creole_shy.latex +8 -0
  159. data/unittest/expected_creole/test_creole_shy.text +4 -0
  160. data/unittest/expected_creole/test_creole_tabular.creole +22 -0
  161. data/unittest/expected_creole/test_creole_tabular.html +20 -0
  162. data/unittest/expected_creole/test_creole_tabular.latex +22 -0
  163. data/unittest/expected_creole/test_creole_tabular_creole.creole +21 -0
  164. data/unittest/expected_creole/test_creole_tabular_creole.html +20 -0
  165. data/unittest/expected_creole/test_creole_tabular_creole.latex +21 -0
  166. data/unittest/expected_creole/test_creole_tabular_css.creole +24 -0
  167. data/unittest/expected_creole/test_creole_tabular_css.html +20 -0
  168. data/unittest/expected_creole/test_creole_tabular_css.latex +22 -0
  169. data/unittest/expected_creole/test_creole_tabular_multicols.creole +16 -0
  170. data/unittest/expected_creole/test_creole_tabular_multicols.html +14 -0
  171. data/unittest/expected_creole/test_creole_tabular_multicols.latex +16 -0
  172. data/unittest/expected_creole/test_creole_tabular_row_parameters.latex +22 -0
  173. data/unittest/expected_creole/test_creole_tabular_with_cell_option.creole +21 -0
  174. data/unittest/expected_creole/test_creole_tabular_with_cell_option.html +20 -0
  175. data/unittest/expected_creole/test_creole_toc.html +13 -0
  176. data/unittest/expected_creole/test_creole_toc.latex +22 -0
  177. data/unittest/expected_creole/test_creole_toc.text +4 -0
  178. data/unittest/expected_creole/test_creole_toc_level.html +7 -0
  179. data/unittest/expected_creole/test_creole_toc_level.latex +10 -0
  180. data/unittest/expected_creole/test_creole_toc_level.text +3 -0
  181. data/unittest/expected_creole/test_creole_toc_level_text.html +8 -0
  182. data/unittest/expected_creole/test_creole_toc_level_text.latex +9 -0
  183. data/unittest/expected_creole/test_creole_toc_text.html +5 -0
  184. data/unittest/expected_creole/test_creole_toc_text.latex +5 -0
  185. data/unittest/expected_creole/test_creole_ul_multiple_line.html +7 -0
  186. data/unittest/expected_creole/test_creole_ul_multiple_line.latex +14 -0
  187. data/unittest/expected_creole/test_creole_ul_with_blank.html +11 -0
  188. data/unittest/expected_creole/test_creole_ul_with_blank.latex +20 -0
  189. data/unittest/expected_creole/test_creole_ul_with_bold.creole +0 -0
  190. data/unittest/expected_creole/test_creole_ul_with_bold.html +11 -0
  191. data/unittest/expected_creole/test_creole_ul_with_bold.latex +18 -0
  192. data/unittest/expected_creole/test_creole_ul_with_bold.text +7 -0
  193. data/unittest/expected_creole/test_creole_verbatim.html +25 -0
  194. data/unittest/expected_creole/test_creole_verbatim.latex +33 -0
  195. data/unittest/expected_creole/test_creole_verbatim.text +17 -0
  196. data/unittest/expected_creole/test_creole_verbatim_inline.html +6 -0
  197. data/unittest/expected_creole/test_creole_verbatim_inline.latex +8 -0
  198. data/unittest/expected_creole/test_creole_verbatim_inline_at_start.html +6 -0
  199. data/unittest/expected_creole/test_creole_verbatim_inline_at_start.latex +8 -0
  200. data/unittest/expected_creole_rail/test_rail_creole_object.tex +33 -0
  201. data/unittest/expected_creole_rail/test_rail_creole_placeholder.tex +40 -0
  202. data/unittest/expected_rubycode4doc/creole_complete.html +26 -0
  203. data/unittest/expected_rubycode4doc/creole_complete.tex +40 -0
  204. data/unittest/expected_rubycode4doc/creole_in_tab.html +4 -0
  205. data/unittest/expected_rubycode4doc/creole_in_tab.tex +6 -0
  206. data/unittest/expected_rubycode4doc/creole_inline_ruby.html +7 -0
  207. data/unittest/expected_rubycode4doc/creole_output.html +2 -0
  208. data/unittest/expected_rubycode4doc/creole_output.tex +4 -0
  209. data/unittest/expected_rubycode4doc/creole_rubycode.html +1 -0
  210. data/unittest/expected_rubycode4doc/creole_rubycode.tex +3 -0
  211. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.html +1 -0
  212. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.tex +3 -0
  213. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.html +3 -0
  214. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.tex +5 -0
  215. data/unittest/unittest_creole.rb +1379 -0
  216. data/unittest/unittest_creole_placeholders.rb +161 -0
  217. data/unittest/unittest_creole_plugin_rail.rb +148 -0
  218. data/unittest/unittest_creole_plugin_rubycode4doc.rb +123 -0
  219. data/unittest/unittest_creole_plugin_struktex.rb +26 -0
  220. data/unittest/unittest_creole_tabular.rb +212 -0
  221. metadata +529 -0
@@ -0,0 +1,170 @@
1
+ #encoding: cp1252
2
+ =begin rdoc
3
+ Example how to define a structogramm with creole2doc.
4
+ =end
5
+
6
+ require 'rubygems'
7
+ $:.unshift("../lib") #for local tests with uninstalled gem
8
+ require 'docgenerator-creole.rb'
9
+ require 'docgenerator/creole/plugins/struktex.rb'
10
+
11
+
12
+ begin
13
+ require 'rake4latex_pdflatex'
14
+ rescue LoadError
15
+ puts "rake4latex not installed -> no translation of LaTeX-file"
16
+ end
17
+
18
+ #
19
+ # Move all results to another folder
20
+ #
21
+ Dir.chdir('results')
22
+
23
+ doc = Docgenerator::Document.new(
24
+ :title => 'creole/plugins/struktex.rb - Structogramms with Creole2Doc',
25
+ #~ :shorttitle => 'struktex.rb',
26
+ :author => 'Knut Lickert',
27
+ :maketitle => true
28
+ )
29
+ doc.head << Docgenerator::Packages::Struktex::USEPACKAGE_STRUKTEX
30
+ doc.head << Docgenerator::Packages::Struktex::USEPACKAGE_STRUKTEX_PROOF
31
+
32
+
33
+ #Redefinition to_latex for this documentation.
34
+ #Result is structogramm and sourcecode.
35
+ class Docgenerator::Packages::Struktex::Structogramm
36
+ alias :old_latex :to_latex
37
+ def to_latex(options={})
38
+ return [self.verbatim.to_latex, self.old_latex(options)].join
39
+ end
40
+ end
41
+
42
+
43
+ doc.body << (Docgenerator::Creole::Creole.new( :content => <<WIKI
44
+ =Preamble=
45
+ Code2Structgramm.rb translates a pseudo-code programm
46
+ to TeX-code for the \\StrukTeX-package.
47
+ \\StrukTeX\\ creates Nassi-Shneidermann-diagramms.
48
+
49
+ There is no support by this generator for:
50
+ *Interface description
51
+ *Variables and Keywords
52
+ *Comments
53
+
54
+ =Example=
55
+ An example, based on a German Saying
56
+ ''Der Krug geht solange zum Brunnen bis er bricht''
57
+ <<<structogramm|Krug;120;45
58
+ WHILE Krug nicht zerbrochen
59
+ Krug geht zum Brunnen
60
+ ENDWHILE
61
+ Qualit�tspr�fung
62
+ -> Krug Testgut
63
+ <- res_1 Pr�fergebnis
64
+ IF Krug zerbrochen
65
+ THEN
66
+ Schade
67
+ ELSE
68
+ Stabiler Krug
69
+ ENDIF
70
+ >>>
71
+
72
+ =Statements=
73
+ No support for:
74
+ *Height
75
+
76
+ <<<structogramm|Simple Statements;120;30
77
+ Statement
78
+ => Call procedure
79
+ <> Return value
80
+ <= Exit with return value
81
+ >>>
82
+
83
+ ==Declarations==
84
+ With declarations you can define interfaces of sub-routines.
85
+ This declarations are part of the command
86
+ <<<structogramm|Declarations/Interfaces;120;25
87
+ Statement
88
+ -> field1 description
89
+ <- field2 description
90
+ <-> field3 description
91
+ >>>
92
+
93
+ ==IF-Statement==
94
+ IF Condition
95
+ THEN size text
96
+ ELSE size text
97
+ ENDIF
98
+ <<<structogramm|Test f�r IF;120;40
99
+ IF Bedingung?
100
+ THEN 6 Ja
101
+ IF Andere Frage?
102
+ THEN
103
+ <= Ergebnis
104
+ ELSE
105
+ <= Anderes Ergebnis
106
+ ENDIF
107
+ ELSE 6 Nein
108
+ IF Andere Frage?
109
+ THEN 4
110
+ <= Ergebnis
111
+ ELSE 5
112
+ <= Anderes Ergebnis
113
+ ENDIF
114
+ ENDIF
115
+ >>>
116
+
117
+ ==CASE-statements==
118
+ The first number after CASE defines the degree of the case-line.
119
+
120
+ The WHEN clause has an optional parameter:
121
+ *c centered
122
+ *r right-aligned
123
+ <<<structogramm|CASE Statements;120;40
124
+ CASE 5 variable
125
+ WHEN value1
126
+ Statement 1-1
127
+ Statement 1-2
128
+ WHEN[r] value2
129
+ Statement 2-1
130
+ Statement 2-2
131
+ WHEN[c] value3
132
+ Statement 3-1
133
+ Statement 3-2
134
+ WHEN value4
135
+ Statement 4-1
136
+ Statement 4-2
137
+ ENDCASE
138
+ >>>
139
+ ==While-statements==
140
+ <<<structogramm|While Statements;120;15
141
+ WHILE Condition
142
+ Statement
143
+ ENDWHILE
144
+ >>>
145
+
146
+ ==Repeat-Until-statements==
147
+ <<<structogramm|Repeat-Until Statements;120;15
148
+ REPEAT
149
+ Statement
150
+ UNTIL Condition
151
+ >>>
152
+
153
+ ==FOREVER-Loop-statements==
154
+ <<<structogramm|FOREVER-Loop Statements;120;30
155
+ FOREVER
156
+ Statement
157
+ <= Exit
158
+ ENDFOREVER
159
+ >>>
160
+
161
+ WIKI
162
+ ))
163
+
164
+ # ###############################
165
+ # Save the files
166
+ # ###############
167
+ #~ doc.save( __FILE__.sub(/\.rb/, ".html")) #makes no sense
168
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
169
+ :runtex => [:statistic, :clean]
170
+ )
@@ -0,0 +1,96 @@
1
+ #encoding: cp1252
2
+ =begin rdoc
3
+ Example for creole/creole2doc
4
+ =end
5
+
6
+
7
+ require 'rubygems'
8
+ $:.unshift("../lib") #for local tests with uninstalled gem
9
+ #~ require 'docgenerator'
10
+ require 'docgenerator/creole'
11
+
12
+ begin
13
+ require 'rake4latex_pdflatex'
14
+ rescue LoadError
15
+ puts "rake4latex not installed -> no translation of LaTeX-file"
16
+ end
17
+
18
+ #
19
+ # Move all results to anothe folder
20
+ #
21
+ Dir.chdir('results')
22
+
23
+
24
+ =begin
25
+ Create document
26
+ =end
27
+ doc = Docgenerator::Document.new(
28
+ :title => 'creole2doc_example_tabular.rb: Test for tabulars with creole'
29
+ )
30
+
31
+ =begin
32
+ Add creole-content.
33
+ =end
34
+ doc.body << Docgenerator::Creole::Creole.new(:content => DATA)
35
+
36
+ # ###############################
37
+ # Save the files
38
+ # ###############
39
+ doc.save( __FILE__.sub(/\.rb/, ".html"))
40
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
41
+ :runtex => [:statistic, :clean]
42
+ )
43
+
44
+
45
+ __END__
46
+ =Normal tabular
47
+
48
+ |one | two
49
+ |1 | 2
50
+ |1.0 | 2.0
51
+
52
+ ==tabular with heading
53
+ |=header col1|=header col2|
54
+ |col1|col2|
55
+ |you |can |
56
+ |also |align\\ it. |
57
+
58
+
59
+ =tabular as placeholder
60
+ <<<tabular
61
+ |!columns=3
62
+ |!columndescription=ccc
63
+ |=1
64
+ |=2
65
+ |=3
66
+ |-|hline
67
+ |eins
68
+ |zwei
69
+ |drei
70
+ |-
71
+ |one
72
+ |two
73
+ |three
74
+ >>>
75
+
76
+ =tabular with cell option
77
+
78
+ After || you may define special data
79
+
80
+ <<<tabular
81
+ |!columns=3
82
+ |!columndescription=ccc
83
+ |eins||css=color: red
84
+ |css = zwei
85
+ |||class=empty
86
+ |-
87
+ |normal
88
+ |//italic//
89
+ |//italic//||class=it
90
+ |-
91
+ |text with | nice! ||class = it
92
+ |||css =
93
+ |
94
+ >>>
95
+
96
+
@@ -0,0 +1,47 @@
1
+ =begin rdoc
2
+ Example how to create rail-diagramms (syntax diagrams specified in EBNF)
3
+ with creole2doc.
4
+
5
+ This examples needs _rail_:
6
+ * http://texcatalogue.sarovar.org/entries/rail.html
7
+ * http://www.dante.ctan.org/tex-archive/support/rail/
8
+ * http://tex.lickert.net/tipps/rail/index.html
9
+
10
+ =end
11
+ $:.unshift '../lib'
12
+ require 'docgenerator/creole'
13
+ require 'docgenerator/creole/plugins/tikz.rb'
14
+ include Docgenerator
15
+
16
+ begin
17
+ require 'rake4latex_pdflatex'
18
+ rescue LoadError
19
+ puts "rake4latex not installed -> no translation of LaTeX-file"
20
+ end
21
+ #
22
+ # Move all results to another folder
23
+ #7
24
+ Dir.chdir('results')
25
+
26
+ doc = Creole::Creole_document.new(
27
+ :title => 'Tikz-images in Creole'
28
+ )
29
+ doc.doc.head << element(:usepackage,{}, 'tikz').cr
30
+
31
+ doc << DATA
32
+
33
+ # ###############################
34
+ # Save the files
35
+ # ###############
36
+ #~ doc.save( __FILE__.sub(/\.rb/, ".html")) --> makes no sense
37
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
38
+ :runtex => [:statistic, :clean]
39
+ #~ :runtex => [:statistic] #keep log...
40
+ )
41
+
42
+ __END__
43
+ <<<tikz_img|../../unittest/Red_Flower.jpg|remember picture|width=\textwidth
44
+ \node[red,rounded corners,draw] at (.8,.7) (source) {1};
45
+ >>>
46
+ * (1) Blossom<<tikz|\draw[<-,red,ultra thick] (0,0) -- (source);>>
47
+
@@ -0,0 +1,5 @@
1
+ #encoding: utf-8
2
+ =begin rdoc
3
+ =end
4
+
5
+ require_relative 'docgenerator/creole.rb'
@@ -0,0 +1,15 @@
1
+ #encoding: utf-8
2
+ =begin rdoc
3
+ =Background
4
+ The docgenerator-gem create documents with export feature as
5
+ LaTeX, HTML, Creole (a common wiki markup, see http://www.wikicreole.org ),
6
+ conTeXt (only rudimentory),
7
+ plain text (not very good supported).
8
+
9
+ This gem extends the docgenerator-gem with a Creole-parser.
10
+
11
+ =end
12
+
13
+ #~ gem 'docgenerator', '~> 3'
14
+ require 'docgenerator' #unless defined? Docgenerator
15
+ require_relative 'creole/base.rb'
@@ -0,0 +1,170 @@
1
+ #encoding: utf-8
2
+ =begin rdoc
3
+ This is a Creole-to-Docgenerator converter.
4
+ The Docgenerator-data can be exported as
5
+ - HTML
6
+ - LaTeX
7
+ - Creole
8
+ - Plain text
9
+
10
+ For another Creole-to-XHTML converter see
11
+ https://rubyforge.org/projects/wikicreole/
12
+
13
+ More about creole at http://www.wikicreole.org/
14
+ =end
15
+
16
+ module Docgenerator
17
+
18
+ =begin rdoc
19
+ Collect the classes to handle Creole-input.
20
+
21
+ More about creole at http://www.wikicreole.org/
22
+ =end
23
+ module Creole
24
+ VERSION = '3.0.0'
25
+
26
+ #Little structure to store the parsing result.
27
+ Creole_line = Struct.new('Creole_line', :type, :content, :add_info)
28
+
29
+ #Hash with Characters.
30
+ #This characters will be converted into elements.
31
+ CHARACTERS = {
32
+ '%' => element(:'%'),
33
+ '$' => element(:'$'),
34
+ '&' => element(:ampersand),
35
+ '->' => element(:rightarrow),
36
+ '=>' => element(:Rightarrow),
37
+ '<-' => element(:leftarrow),
38
+ '<=' => element(:Leftarrow),
39
+ '_' => element(:underscore),
40
+ '…' => element(:ldots),
41
+ '‚' => element(:sbquo), # einfaches low-9-Zeichen, U+201A , &#8218;
42
+ '’' => element(:rsquo), #'zu &#8217;
43
+ '„' => element(:bdquo), #"auf &#8222; #bottom double quote
44
+ '“' => element(:ldquo), #"zu &#8220; #left double quote
45
+ '”' => element(:rdquo), #right double quote
46
+ '–' => element(:ndash), # &#8211;
47
+ '—' => element(:mdash), # &#8211;
48
+ }
49
+
50
+ =begin rdoc
51
+ Add a quick online-help.
52
+ =end
53
+ def self.help( option = :syntax)
54
+ hlp = []
55
+ hlp << "==Creole help #{option}"
56
+ case option
57
+ when :syntax
58
+ hlp << <<Syntax
59
+ Headings:
60
+ = Level 1 (largest) =
61
+ == Level 2 ==
62
+ see also Creole.help(:headings)
63
+
64
+ Bold And Italics:
65
+ ** Bold
66
+ // Italics
67
+ You can close them. If not, the markup end with the paragraph.
68
+
69
+ Links: See Creole.help(:links)
70
+ Syntax
71
+ when :creole
72
+ hlp << <<creole
73
+ docgenerator/creole has some special features:
74
+ *headings allows labels ([key] direct after the =)
75
+ *line breaks are ignored, the text is wrapped.
76
+ (you can set it off with option :wrap_at => 0)
77
+ creole
78
+ when :headings
79
+ hlp << <<headings
80
+ Headings:
81
+ = Level 1 (largest) =
82
+ == Level 2 ==
83
+ === Level 3 ===
84
+ ==== Level 4 ====
85
+ ===== Level 5 =====
86
+ ====== Level 6 ======
87
+ === Also level 3
88
+ === Also level 3 =
89
+ === Also level 3 ==
90
+ === **not** //parsed// ===
91
+ Headings with label:
92
+ =[lev1] Level 1 (largest) =
93
+ ==[lev1.1] Level 2 ==
94
+
95
+ The content is not parsed.
96
+ Details see http://www.wikicreole.org/wiki/Headings
97
+ headings
98
+ when :links
99
+ hlp << <<links
100
+ Explicit:
101
+ * [[http://ruby.lickert.net/docgenerator]]
102
+ * [[http://ruby.lickert.net/docgenerator|Details on docgenerator.rb]]
103
+
104
+ Implicit:
105
+ * http://ruby.lickert.net/docgenerator
106
+ links
107
+ when :tabular
108
+ hlp << <<tabular
109
+ Wikimedia-like syntax:
110
+ <<<tabular
111
+ |!columns=3
112
+ |!columndescription=ccc
113
+ |=1
114
+ |=2
115
+ |=3
116
+ |-
117
+ |eins
118
+ |zwei
119
+ |drei
120
+ |-
121
+ |one
122
+ |two
123
+ |three
124
+ >>>
125
+ tabular
126
+ else
127
+ hlp << "Undefined help for #{option.inspect}"
128
+ end
129
+ return hlp.join("\n")
130
+ end #self.help
131
+
132
+ =begin
133
+ Load sub-classes.
134
+ =end
135
+ require_relative 'placeholder.rb'
136
+ require_relative 'tabular.rb'
137
+ require_relative 'inclusion_and_plugins.rb'
138
+ require_relative 'inclusions.rb'
139
+ require_relative 'characters.rb' #defined as inclusions
140
+ require_relative 'plugins.rb'
141
+
142
+ require_relative 'document.rb'
143
+ require_relative 'creole.rb'
144
+
145
+ end #module Creole
146
+ end #module Docgenerator
147
+
148
+
149
+ if [__FILE__ ].include?($0)
150
+
151
+ [
152
+ :syntax,
153
+ :creole,
154
+ :wikimedia,
155
+ :trippfall,
156
+ :headings,
157
+ :links,
158
+ ].each{|key|
159
+ puts '='*50
160
+ puts Docgenerator::Creole::Creole.help(key)
161
+ puts '='*50
162
+ }
163
+
164
+ creole = Docgenerator::Creole::Creole.new
165
+ creole << 'x{{-}}y{{-}}z'
166
+ creole << 'x{{shy}}y{{shy}}z'
167
+ creole << ''
168
+ creole << '{{../index.html#aa}}'
169
+ puts creole.to_html
170
+ end