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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d7697faf69178d6b880d363e7cccbc9acbd37277
4
+ data.tar.gz: d11ae000c9c28535038671ab5e045ed1a24c2991
5
+ SHA512:
6
+ metadata.gz: 70e4ebee5d6f7815ab0eaf11e8471220c20e17167fea549be5f6812f32f82215132c5d1759fa1be9b18132ad525dc7735a53309416d7524810dbf04793735d07
7
+ data.tar.gz: 1c80b6aac3306e1461b7ac5c8c358de8ee12ae42ed62ccfe7ad3a417427923f492a8b444ca892ec483817618e52648a472eafa70285c813898923cedbaac3d67
@@ -0,0 +1,76 @@
1
+ #encoding: cp1252
2
+ =begin rdoc
3
+ Example for creole/creole2doc
4
+ =end
5
+
6
+ $:.unshift("../lib") #for local tests with uninstalled gem
7
+ require 'docgenerator-creole'
8
+ begin
9
+ require 'rake4latex_pdflatex'
10
+ rescue LoadError
11
+ puts "rake4latex not installed -> no translation of LaTeX-file"
12
+ end
13
+
14
+ #
15
+ # Move all results to another folder
16
+ #
17
+ Dir.chdir('results')
18
+
19
+
20
+ =begin
21
+ Create document
22
+ =end
23
+ doc = Docgenerator::Document.new(
24
+ :title => 'creole2doc_example.rb: Test for creole'
25
+ )
26
+
27
+ =begin
28
+ Add creole-content.
29
+ =end
30
+ doc.body << Docgenerator::Creole::Creole.new(:content => DATA)
31
+
32
+ # ###############################
33
+ # Save the files
34
+ # ###############
35
+ doc.save( __FILE__.sub(/\.rb/, ".html"))
36
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
37
+ :runtex => [:statistic, :clean]
38
+ )
39
+
40
+
41
+ __END__
42
+ =creole/creole2doc.rb
43
+ The Creole-class allows to analyse a text in creole format and
44
+ transform it to a "docgenerator"-object.
45
+
46
+ =Heading and paragraphs
47
+ ==Paragraphs
48
+
49
+ Some text.
50
+
51
+ Some more text in a new paragraph.
52
+
53
+ ==Text formatting
54
+
55
+ //italic// and **bold** is possible.
56
+
57
+ =Lists
58
+ ==Unnumbered list
59
+ * item
60
+ * item
61
+ ** subitem
62
+ *** subsubitem
63
+ **** subsubsubitem
64
+ *** subsubitem
65
+
66
+ ==Numbered lists
67
+ # liste 1
68
+ # liste 2
69
+ ## liste 2-1
70
+ # liste 3
71
+
72
+ ===Mixed Lists
73
+ # Liste num
74
+ #* liste num-*
75
+ ## liste num-num
76
+
@@ -0,0 +1,66 @@
1
+ #encoding: cp1252
2
+ =begin rdoc
3
+ Example how to use footnotes with creole/creole2doc.
4
+ =end
5
+
6
+ $:.unshift( '../lib' )
7
+
8
+ require 'docgenerator/creole'
9
+ begin
10
+ require 'rake4latex_pdflatex'
11
+ rescue LoadError
12
+ puts "rake4latex not installed -> no translation of LaTeX-file"
13
+ end
14
+ #
15
+ # Move all results to another folder
16
+ #
17
+ Dir.chdir('results')
18
+
19
+ #Build document with usepackage{listings}...
20
+ doc = Docgenerator::Document.new( :title => 'Creole with footnotes' )
21
+ doc.body << Docgenerator::Creole::Creole.new(:content => DATA )
22
+
23
+ # ###############################
24
+ # Save the files
25
+ # ###############
26
+ doc.save( __FILE__.sub(/\.rb/, ".html"))
27
+
28
+ #~ doc.save( __FILE__.sub(/\.rb/, ".tex"),
29
+ #~ :runtex => [:statistic, :clean]
30
+ #~ )
31
+
32
+ __END__
33
+ =Basic footnotes
34
+ Add a footnote is easy<<footnote|This is a footnote>>,
35
+ just use the plugin-technique of creole<<footnote|see http://www.wikicreole.org/wiki/Plugin>>.
36
+
37
+
38
+ For HTML you may define your own label<<footnote|as you can see here|label=s>>
39
+
40
+ Footnote must be in one line.
41
+
42
+ ==Writing the footnotes
43
+ Writing footnotes makes only sense in HTML.
44
+ LaTeX has it own footnote output routine.
45
+
46
+ And now the footnotes:
47
+ <<footnotes>>
48
+
49
+
50
+
51
+ =Footnote groups
52
+ You may define footnote groups<<footnote|just add a groupid|groupid=g1>>.
53
+
54
+
55
+ //Inside italics you may define another group<<footnote|as here|groupid=g2>>.//
56
+
57
+ Grouping is only supported for HTML<<footnote|in fact, you may use it with LaTeX, but there is no support of manyfoot, bigfoot or similar package.|groupid=g1>>.
58
+
59
+
60
+ ==Writing the footnotes
61
+
62
+ ===Footnotes for group1:
63
+ <<footnotes|g1>>
64
+
65
+ ===Footnotes for group2:
66
+ <<footnotes|g2>>
@@ -0,0 +1,51 @@
1
+ #encoding: cp1252
2
+ =begin rdoc
3
+ Example how to use self defined placeholders with creole/creole2doc.
4
+ =end
5
+
6
+ $:.unshift( '../lib' )
7
+
8
+ require 'docgenerator/creole.rb'
9
+ begin
10
+ require 'rake4latex_pdflatex'
11
+ rescue LoadError
12
+ puts "rake4latex not installed -> no translation of LaTeX-file"
13
+ end
14
+
15
+ class PDFComment_html < Docgenerator::Creole::Creole_inclusion_and_plugin
16
+ set_plugin_key 'pdfcomment'
17
+ #~ Docgenerator::Creole::Plugins::Collection['pdfcomment'] = self
18
+ #~ def initialize( inclusionname, description, options, wiki )
19
+ #~ super
20
+ #~ end
21
+
22
+ #Return content as pdfcomment
23
+ def to_doc( target, options = {})
24
+ target == :latex ? "\\pdfcomment{%s}" % @description : ''
25
+ end
26
+ end
27
+
28
+ #
29
+ # Move all results to another folder
30
+ #
31
+ Dir.chdir('results')
32
+
33
+ #Build document with usepackage{listings}...
34
+ doc = Docgenerator::Document.new( :title => 'Creole with placeholder' )
35
+ doc.head << element(:usepackage,{},'pdfcomment').cr #-> \pdfcomment
36
+ doc.body << creole = Docgenerator::Creole::Creole.new(:content => DATA )
37
+
38
+ # ###############################
39
+ # Save the files
40
+ # ###############
41
+ #~ doc.save( __FILE__.sub(/\.rb/, ".html"))
42
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
43
+ :runtex => [:statistic, :clean]
44
+ )
45
+
46
+ __END__
47
+ This is text with a PDF-comment<<pdfcomment|This is a comment>>
48
+
49
+ <<<pdfcomment|This is a comment
50
+ longtext
51
+ >>>
@@ -0,0 +1,77 @@
1
+ #encoding: cp1252
2
+ =begin rdoc
3
+ Example how to use HTML with creole/creole2doc.
4
+ =end
5
+
6
+ $:.unshift( '../lib' )
7
+
8
+ require 'docgenerator/creole.rb'
9
+ begin
10
+ require 'rake4latex_pdflatex'
11
+ rescue LoadError
12
+ puts "rake4latex not installed -> no translation of LaTeX-file"
13
+ end
14
+ #
15
+ # Move all results to another folder
16
+ #
17
+ Dir.chdir('results')
18
+
19
+ #Build document with usepackage{listings}...
20
+ doc = Docgenerator::Document.new( :title => 'Creole with raw data' )
21
+ doc.body << Docgenerator::Creole::Creole.new(:content => DATA )
22
+
23
+ # ###############################
24
+ # Save the files
25
+ # ###############
26
+ doc.save( __FILE__.sub(/\.rb/, ".html"))
27
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
28
+ :runtex => [:statistic, :clean]
29
+ )
30
+
31
+ __END__
32
+ =Raw HTML
33
+
34
+ HTML can be added via placeholders.
35
+ In LaTeX it will be ignored.
36
+
37
+ <<<html
38
+ <p style = 'color: red'>red paragraph</p>
39
+ >>>
40
+
41
+ =Raw LaTeX
42
+
43
+ LaTeX-Code can be added via placeholders.
44
+ In HTML it will be ignored.
45
+
46
+ So you can add math.
47
+
48
+ <<<latex
49
+ $$\sum_{i=1}^5 = 15$$
50
+ >>>
51
+
52
+ =Raw text
53
+
54
+ {{{
55
+ Some raw text.
56
+
57
+ The text formatting is unchanged
58
+ }}}
59
+
60
+ =Add some ruby
61
+ You can eval ruby code in your creole-text.
62
+
63
+ The following Rubycode is executed (eval), the result is added as raw text.
64
+ 1 + 1 = <<ruby_raw|1+1>>
65
+
66
+ The following Rubycode is executed (eval), the result is added as wiki text.
67
+ 1 + 1 = <<ruby_raw|1+1>>
68
+
69
+ ==Countdown
70
+ Countdown: <<ruby_raw|(1..10).to_a.reverse.join("-")>>
71
+
72
+ Countdown: <<ruby|(1..10).to_a.reverse.join("-")>>
73
+
74
+ Countdown as raw data: <<ruby_raw|(1..10).to_a.reverse.map{|i| "*%i" % i}.join("\n")>>
75
+
76
+ Countdown as wiki data: <<ruby|(1..10).to_a.reverse.map{|i| "*%i" % i}.join("\n")>>
77
+
@@ -0,0 +1,155 @@
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/rail.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 => 'Rail-Diagramms in Creole'
28
+ )
29
+ doc.doc.head << Creole::Rail::Rail_diagramm::TEX_PACKAGE_RAIL
30
+ doc.doc.head << element(:latexonly,{}, [
31
+ Creole::Rail::Rail_diagramm::RAIL_ALIAS,
32
+ '\railterm{lowcharacter,uppercharacter}',
33
+ ])
34
+
35
+ doc << DATA
36
+
37
+ # ###############################
38
+ # Save the files
39
+ # ###############
40
+ #~ doc.save( __FILE__.sub(/\.rb/, ".html")) --> makes no sense
41
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
42
+ :runtex => [:statistic, :clean]
43
+ #~ :runtex => [:statistic] #keep log...
44
+ )
45
+
46
+ __END__
47
+ =Rail-Diagramms
48
+
49
+ Rail-diagramms are specifiv Syntax-diagramms.
50
+
51
+ [[http://en.wikipedia.org/wiki/Syntax_diagram|Syntax diagramms at Wikipedia]]
52
+
53
+ They represent a graphical alternative to Backus-Naur Form or EBNF.
54
+
55
+ More about the rail-programm at:
56
+ * http://texcatalogue.sarovar.org/entries/rail.html
57
+ * http://www.dante.ctan.org/tex-archive/support/rail/
58
+ * http://tex.lickert.net/tipps/rail/index.html
59
+
60
+ ==Main elements
61
+ Non-finite elements (squared text):
62
+ //test//
63
+ <<<rail|nofinite
64
+ test
65
+ >>>
66
+
67
+ Finite element (circled text)
68
+ Just put the text in '':
69
+ //'final'//
70
+ <<<rail|finite
71
+ 'final'
72
+ >>>
73
+
74
+ ==Path descriptions
75
+ //[Text before] 'final' //
76
+ <<<rail|textbefore
77
+ [Text before] 'final'
78
+ >>>
79
+
80
+ To put text after an element, you have to put the text in braces
81
+ //'final' ( [Text after] )//
82
+ <<<rail|textafter
83
+ 'final' ( [Text after] )
84
+ >>>
85
+
86
+ ==Alternatives
87
+ //A | B //
88
+ <<<rail|alternative
89
+ A | B
90
+ >>>
91
+
92
+ ==Optional pathes
93
+ Optional: //'final' ?//
94
+ <<<rail|optional
95
+ 'final' ?
96
+ >>>
97
+
98
+
99
+ ==Loops with +
100
+ Simple loop: //'final' +//
101
+ <<<rail|loop
102
+ 'final' +
103
+ >>>
104
+
105
+ Loop with an additional part:
106
+ // A + B//
107
+ <<<rail|loop2
108
+ A + B
109
+ >>>
110
+
111
+
112
+ The part before the + must be visited during a walk through the rails.
113
+ The part after the + is only visited if you enter the loop.
114
+
115
+ With braces you can define your own ways through the diagramm.
116
+
117
+ //( A + B )//
118
+ <<<rail|loop3
119
+ ( A + B )
120
+ >>>
121
+
122
+ //( A + ) B//
123
+ <<<rail|loop4
124
+ ( A + ) B
125
+ >>>
126
+
127
+ //( A B + )//
128
+ <<<rail|loop5
129
+ ( A B + )
130
+ >>>
131
+
132
+ //( A + ';' ) B//
133
+ <<<rail|loop6
134
+ ( A + ';' ) B
135
+ >>>
136
+
137
+
138
+ ==A complex example
139
+ <<<rail|complex
140
+ [1] (
141
+ ( '[' string ']' )
142
+ ? body[2--6] + '|'
143
+ )
144
+ | [2] body[3--6] '*' body[5--6]
145
+ | [2] body[3--6] '+' body[5--6]
146
+ | [3] ( body[4--5] + )
147
+ | [4] body[5] '?'
148
+ | [5] identifier ( '[' string ']' ) ?
149
+ | [5] quote string quote
150
+ | [5] dquote string dquote
151
+ | [5] '(' body[1--6] ')'
152
+ | [5] cr
153
+ | [6]
154
+ ;
155
+ >>>
@@ -0,0 +1,144 @@
1
+ #encoding: cp1252
2
+ =begin rdoc
3
+ Example how to use inline-ruby with creole/creole2doc.
4
+ =end
5
+
6
+ $:.unshift( '../lib' )
7
+
8
+ require 'creole/plugins/rubycode4creole.rb'
9
+ begin
10
+ require 'rake4latex_pdflatex'
11
+ rescue LoadError
12
+ puts "rake4latex not installed -> no translation of LaTeX-file"
13
+ end
14
+ #
15
+ # Move all results to another folder
16
+ #
17
+ Dir.chdir('results')
18
+
19
+ #Build document with usepackage{listings}...
20
+ doc = Docgenerator::Rubycode::CodeTest.mk_document( 'Rubycode4doc-Test' )
21
+ doc.head << Docgenerator::Tables::TEX_PACKAGE_TABULARX
22
+ doc.body << Docgenerator::Creole::Creole.new(:content => DATA )
23
+
24
+ # ###############################
25
+ # Save the files
26
+ # ###############
27
+ doc.save( __FILE__.sub(/\.rb/, ".html"))
28
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
29
+ :runtex => [:statistic, :clean]
30
+ )
31
+
32
+ __END__
33
+ =Easy example
34
+ rubycode
35
+ <<<rubycode
36
+ 1 + 1
37
+ >>>
38
+ ----
39
+ rubycode_output
40
+ <<<rubycode_output
41
+ puts 1 + 1
42
+ >>>
43
+ ----
44
+ rubycode_evaluated
45
+ <<<rubycode_evaluated
46
+ 1 + 1
47
+ >>>
48
+ ----
49
+ rubycode_in_tab
50
+ <<<rubycode_in_tab
51
+ 1 + 1
52
+ >>>
53
+
54
+ =More examples
55
+ ==Variables and output==
56
+ ===Sourcecode===
57
+ <<<rubycode
58
+ a = 5
59
+ b = a * 5
60
+ puts b
61
+ puts b + 3
62
+ >>>
63
+
64
+ ===Output===
65
+ <<<rubycode_output
66
+ a = 5
67
+ b = a * 5
68
+ puts b
69
+ puts b + 3
70
+ >>>
71
+
72
+ ===Evaluation
73
+ <<<rubycode_evaluated
74
+ a = 5
75
+ b = a * 5
76
+ puts b
77
+ puts b + 3
78
+ >>>
79
+
80
+ ===Evaluation in tabular===
81
+ <<<rubycode_in_tab
82
+ a = 5
83
+ b = a * 5
84
+ puts b
85
+ puts b + 3
86
+ >>>
87
+
88
+ ==Strings and Here-Docs==
89
+ ===Sourcecode===
90
+ <<<rubycode
91
+ b = 'Booo'
92
+ puts "#{b}"
93
+ puts '#{b}'
94
+ puts %Q{#{b}}
95
+ puts %q{#{b}}
96
+ >>>
97
+
98
+ ===Evaluation
99
+ <<<rubycode_evaluated
100
+ b = 'Booo'
101
+ puts "#{b}"
102
+ puts '#{b}'
103
+ puts %Q{#{b}}
104
+ puts %q{#{b}}
105
+ >>>
106
+
107
+ ===Evaluation in tabular===
108
+ <<<rubycode_in_tab
109
+ b = 'Booo'
110
+ puts "#{b}"
111
+ puts '#{b}'
112
+ puts %Q{#{b}}
113
+ puts %q{#{b}}
114
+ >>>
115
+
116
+
117
+
118
+ ==Loops==
119
+ ===Sourcecode===
120
+ <<<rubycode
121
+ 3.times{ puts 11 }
122
+ 1.upto(3){|i| puts i}
123
+ 1.upto(3){|i| puts "run #{i}"}
124
+ >>>
125
+
126
+ ===Output===
127
+ <<<rubycode_output
128
+ 3.times{ puts 11 }
129
+ 1.upto(3){|i| puts i}
130
+ 1.upto(3){|i| puts "run #{i}"}
131
+ >>>
132
+ ===Evaluated
133
+ <<<rubycode_evaluated
134
+ 3.times{ puts 11 }
135
+ 1.upto(3){|i| puts i}
136
+ 1.upto(3){|i| puts "run #{i}"}
137
+ >>>
138
+
139
+ ===Evaluation in tab
140
+ <<<rubycode_in_tab
141
+ 3.times{ puts 11 }
142
+ 1.upto(3){|i| puts i}
143
+ 1.upto(3){|i| puts "run #{i}"}
144
+ >>>