docgenerator 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. data/build_test_and_doc.rb +505 -0
  2. data/examples/creole_example.rb +82 -0
  3. data/examples/creole_example_footnote.rb +67 -0
  4. data/examples/creole_example_placeholder.rb +77 -0
  5. data/examples/creole_example_rail.rb +154 -0
  6. data/examples/creole_example_rubycode.rb +144 -0
  7. data/examples/creole_example_struktex.rb +169 -0
  8. data/examples/docgenerator_example.rb +1 -1
  9. data/examples/docgenerator_example_footnote.rb +1 -0
  10. data/examples/docgenerator_example_list.rb +3 -0
  11. data/examples/docgenerator_example_restrictions.rb +1 -1
  12. data/examples/docgenerator_example_tabular.rb +1 -1
  13. data/examples/docgenerator_example_tripfalls.rb +2 -2
  14. data/examples/results/readme +2 -1
  15. data/examples/wiki2docgenerator_example.rb +61 -32
  16. data/lib/creole/creole2doc.rb +57 -58
  17. data/lib/creole/creole_characters.rb +56 -0
  18. data/lib/creole/creole_inclusion_and_plugins.rb +59 -284
  19. data/lib/creole/creole_inclusions.rb +142 -0
  20. data/lib/creole/creole_placeholder.rb +57 -23
  21. data/lib/creole/creole_plugins.rb +198 -0
  22. data/lib/creole/creole_tabular.rb +16 -8
  23. data/lib/creole/plugins/rail.rb +182 -0
  24. data/lib/creole/plugins/rubycode4creole.rb +136 -0
  25. data/lib/creole/plugins/struktex.rb +59 -0
  26. data/lib/creole/plugins/todonotes.rb +70 -0
  27. data/lib/docgenerator.rb +161 -71
  28. data/lib/docgenerator/attribute.rb +189 -156
  29. data/lib/docgenerator/characters.rb +824 -267
  30. data/lib/docgenerator/compatibility_v1.rb +249 -0
  31. data/lib/docgenerator/css.rb +53 -32
  32. data/lib/docgenerator/document.rb +119 -56
  33. data/lib/docgenerator/element.rb +304 -351
  34. data/lib/docgenerator/element_meta.rb +303 -0
  35. data/lib/docgenerator/elements.rb +1112 -481
  36. data/lib/docgenerator/environments.rb +153 -62
  37. data/lib/docgenerator/footnote.rb +30 -9
  38. data/lib/docgenerator/lists.rb +71 -47
  39. data/lib/docgenerator/packages/attachfile.rb +136 -0
  40. data/lib/{packages/docgenerator_caption.rb → docgenerator/packages/caption.rb} +28 -19
  41. data/lib/docgenerator/packages/hyperref.rb +194 -0
  42. data/lib/docgenerator/packages/listings.rb +179 -0
  43. data/lib/docgenerator/packages/pdfpages.rb +43 -0
  44. data/lib/docgenerator/packages/rubycode4doc.rb +227 -0
  45. data/lib/{packages/docgenerator_scrlettr2.rb → docgenerator/packages/scrlettr2.rb} +25 -16
  46. data/lib/docgenerator/packages/scrpage2.rb +410 -0
  47. data/lib/docgenerator/packages/struktex.rb +447 -0
  48. data/lib/docgenerator/packages/todonotes.rb +85 -0
  49. data/lib/{packages/docgenerator_url.rb → docgenerator/packages/url.rb} +7 -6
  50. data/lib/docgenerator/sections.rb +257 -83
  51. data/lib/docgenerator/standard.rb +19 -11
  52. data/lib/docgenerator/tabular.rb +234 -118
  53. data/lib/{templates → docgenerator/templates}/docgenerator_template.rb +52 -44
  54. data/lib/{templates → docgenerator/templates}/docgenerator_template.yaml +0 -0
  55. data/lib/{templates → docgenerator/templates}/docgenerator_template_css.rb +22 -16
  56. data/lib/wiki2doc/plugins/rubycode4wiki.rb +53 -0
  57. data/lib/wiki2doc/plugins/struktex.rb +12 -0
  58. data/lib/wiki2doc/wiki2docgenerator.rb +39 -38
  59. data/lib/wiki2doc/wikimedia_document.rb +24 -0
  60. data/manpage_elements.rb +10411 -0
  61. data/readme.rd +34 -24
  62. data/unittest/creole_testtext.creole +11 -0
  63. data/unittest/expected/test_document_usepackage_undefined.log +2 -2
  64. data/unittest/expected/test_runtex.stdout +0 -1
  65. data/unittest/expected/test_runtex_2.stdout +0 -1
  66. data/unittest/expected/toc_css.css +3 -2
  67. data/unittest/expected_creole/test_creole_characters_all.creole +28 -0
  68. data/unittest/expected_creole/test_creole_characters_all.html +15 -15
  69. data/unittest/expected_creole/test_creole_characters_all.latex +15 -15
  70. data/unittest/expected_creole/test_creole_footnotes_groupid.html +15 -0
  71. data/unittest/expected_creole/test_creole_links_file.html +2 -2
  72. data/unittest/expected_creole/test_creole_links_file.latex +2 -2
  73. data/unittest/expected_creole/test_creole_links_file.text +2 -2
  74. data/unittest/expected_creole/test_creole_picture_link.html +1 -1
  75. data/unittest/expected_creole_rail/test_rail_creole_object.tex +33 -0
  76. data/unittest/expected_creole_rail/test_rail_creole_placeholder.tex +40 -0
  77. data/unittest/expected_rubycode4doc/creole_complete.html +26 -0
  78. data/unittest/expected_rubycode4doc/creole_complete.tex +40 -0
  79. data/unittest/expected_rubycode4doc/creole_in_tab.html +4 -0
  80. data/unittest/expected_rubycode4doc/creole_in_tab.tex +6 -0
  81. data/unittest/expected_rubycode4doc/creole_inline_ruby.html +7 -0
  82. data/unittest/expected_rubycode4doc/creole_output.html +2 -0
  83. data/unittest/expected_rubycode4doc/creole_output.tex +4 -0
  84. data/unittest/expected_rubycode4doc/creole_rubycode.html +1 -0
  85. data/unittest/expected_rubycode4doc/creole_rubycode.tex +3 -0
  86. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.html +1 -0
  87. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.tex +3 -0
  88. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.html +3 -0
  89. data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.tex +5 -0
  90. data/unittest/expected_rubycode4doc/wiki_1.html +8 -0
  91. data/unittest/expected_rubycode4doc/wiki_2.html +8 -0
  92. data/unittest/expected_rubycode4doc/wiki_3.html +9 -0
  93. data/unittest/expected_rubycode4doc/wiki_immediate_1.html +5 -0
  94. data/unittest/expected_rubycode4doc/wiki_immediate_2.html +5 -0
  95. data/unittest/expected_rubycode4doc/wiki_immediate_3.html +8 -0
  96. data/unittest/expected_rubycode4doc/wiki_immediate_full.html +21 -0
  97. data/unittest/expected_struktex/test_struktex_krug.creole +15 -0
  98. data/unittest/expected_struktex/test_struktex_krug.tex +19 -0
  99. data/unittest/expected_struktex/test_struktex_krug.wiki +15 -0
  100. data/unittest/expected_struktex/test_struktex_statement.creole +7 -0
  101. data/unittest/expected_struktex/test_struktex_statement.tex +9 -0
  102. data/unittest/expected_struktex/test_struktex_statement.wiki +7 -0
  103. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.html +0 -0
  104. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.latex +0 -0
  105. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.text +0 -0
  106. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki.wiki +0 -0
  107. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.html +1 -1
  108. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.latex +1 -1
  109. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.text +1 -1
  110. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_description.wiki +1 -1
  111. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.html +0 -0
  112. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.latex +0 -0
  113. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.text +0 -0
  114. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote.wiki +0 -0
  115. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_2.html +0 -0
  116. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_footnote_groupid.html +0 -0
  117. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.html +0 -0
  118. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.latex +0 -0
  119. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.text +0 -0
  120. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_html_code.wiki +0 -0
  121. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.html +0 -0
  122. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.latex +0 -0
  123. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.text +0 -0
  124. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_inline.wiki +0 -0
  125. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_label.html +0 -0
  126. data/unittest/expected_wikimedia/test_wiki_link.html +8 -0
  127. data/unittest/expected_wikimedia/test_wiki_link.latex +17 -0
  128. data/unittest/expected_wikimedia/test_wiki_link.wiki +11 -0
  129. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.html +0 -0
  130. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.latex +0 -0
  131. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.text +0 -0
  132. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol.wiki +0 -0
  133. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.html +0 -0
  134. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.latex +0 -0
  135. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.text +0 -0
  136. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_after_ul.wiki +0 -0
  137. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.html +0 -0
  138. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.latex +0 -0
  139. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.text +0 -0
  140. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ol_ul.wiki +0 -0
  141. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.html +0 -0
  142. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.latex +0 -0
  143. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.text +0 -0
  144. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul.wiki +0 -0
  145. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.html +0 -0
  146. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.latex +0 -0
  147. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.text +0 -0
  148. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_list_ul_too_much.wiki +0 -0
  149. data/unittest/expected_wikimedia/test_wiki_picture.html +55 -0
  150. data/unittest/expected_wikimedia/test_wiki_picture.latex +76 -0
  151. data/unittest/expected_wikimedia/test_wiki_picture_thumb.html +5 -0
  152. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.html +0 -0
  153. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.latex +0 -0
  154. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_tab1.wiki +0 -0
  155. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.html +0 -0
  156. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.latex +0 -0
  157. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.text +0 -0
  158. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_textformatting.wiki +0 -0
  159. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.html +0 -0
  160. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.latex +0 -0
  161. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.text +0 -0
  162. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_toc.wiki +0 -0
  163. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.html +0 -0
  164. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.latex +0 -0
  165. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.text +0 -0
  166. data/unittest/{expected_wiki → expected_wikimedia}/test_wiki_ul_multiple_line.wiki +0 -0
  167. data/unittest/{unittest_creole2doc.rb → unittest_creole.rb} +385 -476
  168. data/unittest/unittest_creole_placeholders.rb +272 -0
  169. data/unittest/unittest_creole_plugin_rail.rb +147 -0
  170. data/unittest/unittest_docgenerator.rb +206 -332
  171. data/unittest/unittest_docgenerator_characters.rb +650 -0
  172. data/unittest/unittest_docgenerator_runtex.rb +48 -20
  173. data/unittest/unittest_packages_struktex.rb +187 -0
  174. data/unittest/unittest_rubycode4doc.rb +275 -0
  175. data/unittest/unittest_wikimedia.rb +479 -0
  176. metadata +245 -172
  177. data/examples/results_expected/docgenerator_example.html +0 -39
  178. data/examples/results_expected/docgenerator_example.pdf +0 -0
  179. data/examples/results_expected/docgenerator_example.tex +0 -56
  180. data/examples/results_expected/docgenerator_example_footnote.html +0 -40
  181. data/examples/results_expected/docgenerator_example_footnote.pdf +0 -0
  182. data/examples/results_expected/docgenerator_example_footnote.tex +0 -50
  183. data/examples/results_expected/docgenerator_example_list.html +0 -18
  184. data/examples/results_expected/docgenerator_example_list.pdf +0 -0
  185. data/examples/results_expected/docgenerator_example_list.tex +0 -46
  186. data/examples/results_expected/docgenerator_example_restrictions.html +0 -22
  187. data/examples/results_expected/docgenerator_example_restrictions.pdf +0 -0
  188. data/examples/results_expected/docgenerator_example_restrictions.tex +0 -31
  189. data/examples/results_expected/docgenerator_example_tabular.html +0 -37
  190. data/examples/results_expected/docgenerator_example_tabular.pdf +0 -0
  191. data/examples/results_expected/docgenerator_example_tabular.tex +0 -41
  192. data/examples/results_expected/docgenerator_example_tripfalls.html +0 -27
  193. data/examples/results_expected/docgenerator_example_tripfalls.pdf +0 -0
  194. data/examples/results_expected/docgenerator_example_tripfalls.tex +0 -31
  195. data/lib/packages/docgenerator_attachfile.rb +0 -71
  196. data/lib/packages/docgenerator_hyperref.rb +0 -109
  197. data/lib/packages/docgenerator_listings.rb +0 -103
  198. data/lib/packages/docgenerator_pdfpages.rb +0 -24
  199. data/lib/packages/docgenerator_scrpage2.rb +0 -172
  200. data/self_docgenerator.rb +0 -163
  201. data/unittest/expected_wiki/test_wiki_link.html +0 -8
  202. data/unittest/expected_wiki/test_wiki_link.latex +0 -17
  203. data/unittest/expected_wiki/test_wiki_link.wiki +0 -11
  204. data/unittest/expected_wiki/test_wiki_picture.html +0 -55
  205. data/unittest/expected_wiki/test_wiki_picture.latex +0 -76
  206. data/unittest/expected_wiki/test_wiki_picture_thumb.html +0 -5
  207. data/unittest/test_rakefile_docgenerator.rb +0 -43
  208. data/unittest/unittest_versions.rb +0 -44
  209. data/unittest/unittest_wiki2doc.rb +0 -464
@@ -0,0 +1,82 @@
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 'creole/creole2doc'
11
+ include Docgenerator
12
+
13
+ begin
14
+ require 'rake4latex_pdflatex'
15
+ rescue LoadError
16
+ puts "rake4latex not installed -> no translation of LaTeX-file"
17
+ end
18
+
19
+ #
20
+ # Move all results to anothe folder
21
+ #
22
+ Dir.chdir('results')
23
+
24
+
25
+ =begin
26
+ Create document
27
+ =end
28
+ doc = Document.new(
29
+ :title => 'creole2doc_example.rb: Test for creole'
30
+ )
31
+
32
+ =begin
33
+ Add creole-content.
34
+ =end
35
+ doc.body << Creole::Creole.new(:content => DATA)
36
+
37
+ # ###############################
38
+ # Save the files
39
+ # ###############
40
+ doc.save( __FILE__.sub(/\.rb/, ".html"))
41
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
42
+ :runtex => [:statistic, :clean]
43
+ )
44
+
45
+
46
+ __END__
47
+ =creole/creole2doc.rb
48
+ The Creole-class allows to analyse a text in creole format and
49
+ transform it to a "docgenerator"-object.
50
+
51
+ =Heading and paragraphs
52
+ ==Paragraphs
53
+
54
+ Some text.
55
+
56
+ Some more text in a new paragraph.
57
+
58
+ ==Text formatting
59
+
60
+ //italic// and **bold** is possible.
61
+
62
+
63
+ =Lists
64
+ ==Unnumbered list
65
+ * item
66
+ * item
67
+ ** subitem
68
+ *** subsubitem
69
+ **** subsubsubitem
70
+ *** subsubitem
71
+
72
+ ==Numbered lists
73
+ # liste 1
74
+ # liste 2
75
+ ## liste 2-1
76
+ # liste 3
77
+
78
+ ===Mixed Lists
79
+ # Liste num
80
+ #* liste num-*
81
+ ## liste num-num
82
+
@@ -0,0 +1,67 @@
1
+ #encoding: cp1252
2
+ =begin rdoc
3
+ Example how to use footnotes with creole/creole2doc.
4
+ =end
5
+
6
+ $:.unshift( '../lib' )
7
+
8
+ require 'creole/creole2doc.rb'
9
+ include Docgenerator
10
+ begin
11
+ require 'rake4latex_pdflatex'
12
+ rescue LoadError
13
+ puts "rake4latex not installed -> no translation of LaTeX-file"
14
+ end
15
+ #
16
+ # Move all results to another folder
17
+ #
18
+ Dir.chdir('results')
19
+
20
+ #Build document with usepackage{listings}...
21
+ doc = Docgenerator::Document.new( :title => 'Creole with footnotes' )
22
+ doc.body << Docgenerator::Creole::Creole.new(:content => DATA )
23
+
24
+ # ###############################
25
+ # Save the files
26
+ # ###############
27
+ doc.save( __FILE__.sub(/\.rb/, ".html"))
28
+
29
+ #~ doc.save( __FILE__.sub(/\.rb/, ".tex"),
30
+ #~ :runtex => [:statistic, :clean]
31
+ #~ )
32
+
33
+ __END__
34
+ =Basic footnotes
35
+ Add a footnote is easy<<footnote|This is a footnote>>,
36
+ just use the plugin-technique of creole<<footnote|see http://www.wikicreole.org/wiki/Plugin>>.
37
+
38
+
39
+ For HTML you may define your own label<<footnote|as you can see here|label=s>>
40
+
41
+ Footnote must be in one line.
42
+
43
+ ==Writing the footnotes
44
+ Writing footnotes makes only sense in HTML.
45
+ LaTeX has it own footnote output routine.
46
+
47
+ And now the footnotes:
48
+ <<footnotes>>
49
+
50
+
51
+
52
+ =Footnote groups
53
+ You may define footnote groups<<footnote|just add a groupid|groupid=g1>>.
54
+
55
+
56
+ //Inside italics you may define another group<<footnote|as here|groupid=g2>>.//
57
+
58
+ 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>>.
59
+
60
+
61
+ ==Writing the footnotes
62
+
63
+ ===Footnotes for group1:
64
+ <<footnotes|g1>>
65
+
66
+ ===Footnotes for group2:
67
+ <<footnotes|g2>>
@@ -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 'creole/creole2doc.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,154 @@
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 'creole/plugins/rail.rb'
13
+ include Docgenerator
14
+
15
+ begin
16
+ require 'rake4latex_pdflatex'
17
+ rescue LoadError
18
+ puts "rake4latex not installed -> no translation of LaTeX-file"
19
+ end
20
+ #
21
+ # Move all results to another folder
22
+ #7
23
+ Dir.chdir('results')
24
+
25
+ doc = Creole::Creole_document.new(
26
+ :title => 'Rail-Diagramms in Creole'
27
+ )
28
+ doc.doc.head << Creole::Rail::Rail_diagramm::TEX_PACKAGE_RAIL
29
+ doc.doc.head << element(:latexonly,{}, [
30
+ Creole::Rail::Rail_diagramm::RAIL_ALIAS,
31
+ '\railterm{lowcharacter,uppercharacter}',
32
+ ])
33
+
34
+ doc << DATA
35
+
36
+ # ###############################
37
+ # Save the files
38
+ # ###############
39
+ #~ doc.save( __FILE__.sub(/\.rb/, ".html")) --> makes no sense
40
+ doc.save( __FILE__.sub(/\.rb/, ".tex"),
41
+ :runtex => [:statistic, :clean]
42
+ #~ :runtex => [:statistic] #keep log...
43
+ )
44
+
45
+ __END__
46
+ =Rail-Diagramms
47
+
48
+ Rail-diagramms are specifiv Syntax-diagramms.
49
+
50
+ [[http://en.wikipedia.org/wiki/Syntax_diagram|Syntax diagramms at Wikipedia]]
51
+
52
+ They represent a graphical alternative to Backus-Naur Form or EBNF.
53
+
54
+ More about the rail-programm at:
55
+ * http://texcatalogue.sarovar.org/entries/rail.html
56
+ * http://www.dante.ctan.org/tex-archive/support/rail/
57
+ * http://tex.lickert.net/tipps/rail/index.html
58
+
59
+ ==Main elements
60
+ Non-finite elements (squared text):
61
+ //test//
62
+ <<<rail|nofinite
63
+ test
64
+ >>>
65
+
66
+ Finite element (circled text)
67
+ Just put the text in '':
68
+ //'final'//
69
+ <<<rail|finite
70
+ 'final'
71
+ >>>
72
+
73
+ ==Path descriptions
74
+ //[Text before] 'final' //
75
+ <<<rail|textbefore
76
+ [Text before] 'final'
77
+ >>>
78
+
79
+ To put text after an element, you have to put the text in braces
80
+ //'final' ( [Text after] )//
81
+ <<<rail|textafter
82
+ 'final' ( [Text after] )
83
+ >>>
84
+
85
+ ==Alternatives
86
+ //A | B //
87
+ <<<rail|alternative
88
+ A | B
89
+ >>>
90
+
91
+ ==Optional pathes
92
+ Optional: //'final' ?//
93
+ <<<rail|optional
94
+ 'final' ?
95
+ >>>
96
+
97
+
98
+ ==Loops with +
99
+ Simple loop: //'final' +//
100
+ <<<rail|loop
101
+ 'final' +
102
+ >>>
103
+
104
+ Loop with an additional part:
105
+ // A + B//
106
+ <<<rail|loop2
107
+ A + B
108
+ >>>
109
+
110
+
111
+ The part before the + must be visited during a walk through the rails.
112
+ The part after the + is only visited if you enter the loop.
113
+
114
+ With braces you can define your own ways through the diagramm.
115
+
116
+ //( A + B )//
117
+ <<<rail|loop3
118
+ ( A + B )
119
+ >>>
120
+
121
+ //( A + ) B//
122
+ <<<rail|loop4
123
+ ( A + ) B
124
+ >>>
125
+
126
+ //( A B + )//
127
+ <<<rail|loop5
128
+ ( A B + )
129
+ >>>
130
+
131
+ //( A + ';' ) B//
132
+ <<<rail|loop6
133
+ ( A + ';' ) B
134
+ >>>
135
+
136
+
137
+ ==A complex example
138
+ <<<rail|complex
139
+ [1] (
140
+ ( '[' string ']' )
141
+ ? body[2--6] + '|'
142
+ )
143
+ | [2] body[3--6] '*' body[5--6]
144
+ | [2] body[3--6] '+' body[5--6]
145
+ | [3] ( body[4--5] + )
146
+ | [4] body[5] '?'
147
+ | [5] identifier ( '[' string ']' ) ?
148
+ | [5] quote string quote
149
+ | [5] dquote string dquote
150
+ | [5] '(' body[1--6] ')'
151
+ | [5] cr
152
+ | [6]
153
+ ;
154
+ >>>
@@ -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
+ >>>