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
@@ -2,10 +2,9 @@
2
2
  if ! defined?( Document )
3
3
  require 'docgenerator'
4
4
  end
5
- #
6
- #Used by
7
- #-ODPAnalyser
8
- #-Stummfilm/Bezugsquellen
5
+
6
+ module Docgenerator
7
+ module Packages
9
8
 
10
9
  #
11
10
  #Small Administration class for websites and their description
@@ -39,8 +38,8 @@ class Url
39
38
  def to_s()
40
39
  return "#{self.url()}"
41
40
  end
42
- def to_element()
43
- return element(:a, {:href=>self.url}, self.linktext())
41
+ def to_doc(target, attr = {})
42
+ return element(:a, {:href=>self.url}, self.linktext()).to_doc(target, attr)
44
43
  end
45
44
  #Output with all details.
46
45
  #The ctrl-hash contains all elements which should be included.
@@ -80,3 +79,5 @@ class Url
80
79
  return li_list
81
80
  end
82
81
  end
82
+ end #module Packages
83
+ end #module Docgenerator
@@ -2,95 +2,269 @@
2
2
  #Headings and sectioning
3
3
  #
4
4
 
5
- #Small helper to make TeX-Hyperlinks like in HTML (attribute id)
6
- def hypertarget(id)
7
- return "\\hypertarget{#{id}}{}" if id.is_a?(String)
8
- #~ return '' if ! id.content or id.content.to_s =~/\A\s*\Z/
9
- return '' if ! id.content or id.content.join =~/\A\s*\Z/ #Ruby 1.9
10
- return "\\hypertarget{#{id}}{}"
5
+ if $0 == __FILE__
6
+ $:.unshift('..')
7
+ require 'docgenerator'
8
+
9
+ END{
10
+ [
11
+ Docgenerator::Sectioning::DummySectioning.new({}, 'aa'),
12
+ element(:section,{}, 'bb'),
13
+ element(:h1,{}, 'cc'),
14
+ element(:abstract,{}, 'cc'),
15
+ ].each{|sec|
16
+
17
+ #~ puts sec.to_latex
18
+ #~ puts sec.to_html
19
+ #~ puts sec.to_wiki
20
+ #~ puts sec.to_creole
21
+ #~ puts sec.to_text
22
+ }
23
+ }
11
24
  end
12
25
 
13
- #Fixmes:
14
- #- addsec
15
- #- article/report
16
- #- context (actual like latex
17
- sect = Struct.new( 'Sections', :keys, :wiki, :html, :tex )
18
- [
19
- sect.new( [:part], 0, '', 'part'), #fixme: neue HTML-Datei?
20
- sect.new( [:chapter], 1, '', 'chapter'), #fixme: neue HTML-Datei?
21
- sect.new( [:h1, :section], 2, 'h1', 'section'),
22
- sect.new( [:h2, :subsection], 3, 'h2', 'subsection'),
23
- sect.new( [:h3, :subsubsection], 4, 'h3', 'subsubsection'),
24
- sect.new( [:h4, :paragraph], 5, 'h4', 'paragraph'),
25
- sect.new( [:h5, :subparagraph], 6, 'h5', 'subparagraph'),
26
- sect.new( [:h6, :minisec], 7, 'h6', 'minisec'),
27
- ].each{ |s|
28
- Element.create( s.keys, {
29
- :short => Attribute.create( [ :latex ] ),
30
- }.update( HTML_ATTR_ALL ), true,
31
- { :htmltag => s.html,
32
- #~ :latex => '#{linebreak(@crbefore)}' + "\\#{s.tex}" + '{#{@content}}#{linebreak(@crafter)}',
33
- :latex => '#{linebreak(@crbefore)}' + "\\#{s.tex}" +
26
+ #
27
+ module Docgenerator
28
+ =begin rdoc
29
+ Collection of section elements.
30
+
31
+ Define of
32
+ * part, chapter, [sub]*section, [sub]paragraph
33
+ * h1...h6
34
+
35
+ =end
36
+ module Sectioning
37
+
38
+ =begin rdoc
39
+ Define Element :sectioning
40
+
41
+ This is a dummy-element as template for section...
42
+
43
+ Attributes may be:
44
+ * :short:
45
+ * HTML_ATTR_CORE
46
+ * HTML_ATTR_I18N
47
+ * HTML_ATTR_EVENTS
48
+ * :lang, ATTR_LANG
49
+ =end
50
+ class DummySectioning < Element
51
+ class << self
52
+ def inherited(subclass)
53
+ Element.inherited(subclass)
54
+ subclass.class_eval(<<-attr
55
+ add_attributes HTML_ATTR_CORE
56
+ add_attributes HTML_ATTR_I18N
57
+ add_attributes HTML_ATTR_EVENTS
58
+ add_attribute :lang, ATTR_LANG
59
+ add_attribute :short, Attribute.create( [ :latex ] )
60
+ attr
61
+ )
62
+ end
63
+ =begin rdoc
64
+ Define the number of '=' for this section-command in wiki syntax.
65
+ =end
66
+ def set_wikilevel( level )
67
+ class_eval( "def wikilevel(); '#{'=' * level}'; end")
68
+ end
69
+ end #class << self
70
+ =begin rdoc
71
+ Default marup for title for wikis.
72
+
73
+ Is redefined by set_wikilevel( level )
74
+ =end
75
+ def wikilevel(); ''; end
76
+
77
+ #Small helper to make TeX-Hyperlinks like in HTML (attribute id)
78
+ def hypertarget(id)
79
+ return "\\hypertarget{#{id}}{}" if id.is_a?(String)
80
+ #~ return '' if ! id.content or id.content.to_s =~/\A\s*\Z/
81
+ return '' if ! id.content or id.content.join =~/\A\s*\Z/ #Ruby 1.9
82
+ return "\\hypertarget{#{id}}{}"
83
+ end
84
+ =begin rdoc
85
+ Determine the TeX-Makroname from class name
86
+ =end
87
+ def texmakro()
88
+ self.class.name.split('::').last.downcase
89
+ end
90
+
91
+ add_latex_output '#{linebreak(@crbefore)}' + '\\#{texmakro}' +
34
92
  '#{texoptional(:short)}' +
35
93
  '{#{@content}}' +
36
94
  '#{hypertarget(@attr[:id])}' +
37
- '#{linebreak(@crafter)}',
38
- :context => '#{linebreak(@crbefore)}' + "\\#{s.tex}" +
95
+ '#{linebreak(@crafter)}'
96
+
97
+ add_context_output '#{linebreak(@crbefore)}' + '\\#{texmakro}' +
39
98
  '#{texoptional(:short)}' +
40
99
  '{#{@content}}' +
41
100
  '#{hypertarget(@attr[:id])}' +
42
- '#{linebreak(@crafter)}',
43
- :text => "\n" + '#{linebreak(@crbefore)}#{@content}' + "\n" +
44
- ' ' * s.wiki * 2 + '-' * 30 + "\n" + '#{linebreak(@crafter)}',
45
- :wiki => '#{linebreak(@crbefore)}' + "\n" + '='* (s.wiki ) + '#{@content}' + '='* (s.wiki) + "\n" + '#{linebreak(@crafter)}',
46
- :creole => '#{linebreak(@crbefore)}' + "\n" + '='* (s.wiki ) + '#{@content}' + "\n" + '#{linebreak(@crafter)}',
47
- } )
48
- }
49
- #~ Element.create( [:h1], HTML_ATTR_ALL, true,
50
- #~ { :htmltag => 'h1',
51
- #~ :latex => "\n" + '\section{#{@content}}' + "\n"
52
- #~ } )
53
- #~ Element.create( [:h2], HTML_ATTR_ALL, true,
54
- #~ { :htmltag => 'h2',
55
- #~ :latex => "\n" + '\subsection{#{@content}}' + "\n"
56
- #~ } )
57
-
58
- Element.create( [:addsec], HTML_ATTR_ALL, true,
59
- { :htmltag => 'h2',
60
- :latex => '#{linebreak(@crbefore)}' + '\addsec{#{@content}}' + '#{linebreak(@crafter)}'
61
- } )
62
-
63
-
64
- class Caption < Element
65
- #Make the key known to the complete key-list of elements.
66
- Element.add( [:caption], Caption )
67
- #
68
- add_attributes( {
69
- :optional => Attribute.create( [ :latex ] ),
70
- } )
71
- def to_latex()
72
- cmd = ''
73
- cmd << "\n" if @crbefore
74
- cmd << "\\caption"
75
- if @attr[:optional].content != []
76
- cmd << "["
77
- cmd << @attr[:optional].content.to_s
78
- cmd << "]"
79
- cmd << "\n\t" if @crmid
80
- end
81
- cmd << "{"
82
- cmd << @content.to_s
83
- cmd << "}"
84
- cmd << "\n" if @crafter
85
- return cmd
86
- end
87
- end
101
+ '#{linebreak(@crafter)}'
88
102
 
89
- class Abstract < Environment
90
- #~ add_attributes( HTML_ATTR_ALL )
91
- Element.add( [:abstract], Abstract)
92
- #~ def htmltag(); ''; end
93
- def to_latex( )
94
- return to_latex_environment( 'abstract' )
95
- end
96
- end
103
+ #'underlined' title
104
+ add_text_output "\n" + '#{linebreak(@crbefore)}#{@content}' + "\n" +
105
+ '#{wikilevel.gsub(/=/,\' \')}' +
106
+ '-' * 30 + "\n" + '#{linebreak(@crafter)}'
107
+
108
+ add_wiki_output '#{linebreak(@crbefore)}' + "\n" + '#{wikilevel}' + '#{@content}' + '#{wikilevel}' + "\n" + '#{linebreak(@crafter)}'
109
+
110
+ add_creole_output '#{linebreak(@crbefore)}' + "\n" + '#{wikilevel}' + '#{@content}' + "\n" + '#{linebreak(@crafter)}'
111
+ end #Sectioning
112
+
113
+
114
+ =begin rdoc
115
+ Define Element :part
116
+
117
+ Create an instance with
118
+ element( :part, [ attributes, [content]] )
119
+ or
120
+ Part.new( [ attributes, [content]] )
121
+
122
+ Attributes see class DummySectioning.
123
+ =end
124
+ class Part < DummySectioning
125
+ #~ add_html_tag ''
126
+ end #Part
127
+
128
+ =begin rdoc
129
+ Define Element :chapter
130
+
131
+ Create an instance with
132
+ element( :chapter, [ attributes, [content]] )
133
+ or
134
+ Chapter.new( [ attributes, [content]] )
135
+
136
+ Attributes see class DummySectioning.
137
+ =end
138
+ class Chapter < DummySectioning
139
+ set_wikilevel 1
140
+ #~ add_html_tag ''
141
+ end #Chapter
142
+
143
+ =begin rdoc
144
+ Define Element :h1, :section
145
+
146
+ Create an instance with
147
+ element( :h1, [ attributes, [content]] )
148
+ element( :section, [ attributes, [content]] )
149
+ or
150
+ Section.new( [ attributes, [content]] )
151
+
152
+ Attributes see class DummySectioning.
153
+ =end
154
+ class Section < DummySectioning
155
+ set_wikilevel 2
156
+ add_id :h1
157
+ add_html_tag 'h1'
158
+ end #H1
159
+
160
+ =begin rdoc
161
+ Define Element :h2, :subsection
162
+
163
+ Create an instance with
164
+ element( :h2, [ attributes, [content]] )
165
+ element( :subsection, [ attributes, [content]] )
166
+ or
167
+ Subsection.new( [ attributes, [content]] )
168
+
169
+ Attributes see class DummySectioning.
170
+ =end
171
+ class Subsection < DummySectioning
172
+ set_wikilevel 3
173
+ add_id :h2
174
+ add_html_tag 'h2'
175
+ end #H2
176
+
177
+ =begin rdoc
178
+ Define Element :h3, :subsubsection
179
+
180
+ Create an instance with
181
+ element( :h3, [ attributes, [content]] )
182
+ element( :subsubsection, [ attributes, [content]] )
183
+ or
184
+ Subsubsection.new( [ attributes, [content]] )
185
+ Attributes may be:
186
+
187
+ Attributes see class DummySectioning.
188
+ =end
189
+ class Subsubsection < DummySectioning
190
+ set_wikilevel 4
191
+ add_id :h3
192
+ add_html_tag 'h3'
193
+ end #H3
194
+
195
+ =begin rdoc
196
+ Define Element :h4, :paragraph
197
+
198
+ Create an instance with
199
+ element( :h4, [ attributes, [content]] )
200
+ element( :paragraph, [ attributes, [content]] )
201
+ or
202
+ Paragraph.new( [ attributes, [content]] )
203
+
204
+ Attributes see class DummySectioning.
205
+ =end
206
+ class Paragraph < DummySectioning
207
+ set_wikilevel 5
208
+ add_id :h4
209
+ add_html_tag 'h4'
210
+ end #H4
211
+
212
+
213
+ =begin rdoc
214
+ Define Element :h5, :subparagraph
215
+
216
+ Create an instance with
217
+ element( :h5, [ attributes, [content]] )
218
+ element( :subparagraph, [ attributes, [content]] )
219
+ or
220
+ Subparagraph.new( [ attributes, [content]] )
221
+
222
+ Attributes see class DummySectioning.
223
+ =end
224
+ class Subparagraph < DummySectioning
225
+ set_wikilevel 6
226
+ add_id :h5
227
+ add_html_tag 'h5'
228
+ end #H5
229
+
230
+ =begin rdoc
231
+ Define Element :h6, :minisec
232
+
233
+ Create an instance with
234
+ element( :h6, [ attributes, [content]] )
235
+ element( :minisec, [ attributes, [content]] )
236
+ or
237
+ Minisec.new( [ attributes, [content]] )
238
+
239
+ Attributes see class DummySectioning.
240
+ =end
241
+ class Minisec < DummySectioning
242
+ set_wikilevel 7
243
+ add_id :h6
244
+ add_html_tag 'h6'
245
+ end #H6
246
+
247
+
248
+ =begin rdoc
249
+ Define Element :addsec
250
+
251
+ \\addsec is a command provided by koma-script.
252
+
253
+ Create an instance with
254
+ element( :addsec, [ attributes, [content]] )
255
+ or
256
+ Addsec.new( [ attributes, [content]] )
257
+
258
+ Attributes may be:
259
+ * HTML_ATTR_ALL
260
+ =end
261
+ class Addsec < Element
262
+ add_attributes HTML_ATTR_CORE
263
+ add_attributes HTML_ATTR_I18N
264
+ add_attributes HTML_ATTR_EVENTS
265
+ add_attribute :lang, ATTR_LANG
266
+ add_html_tag 'h2'
267
+ add_latex_output '#{linebreak(@crbefore)}' + '\addsec{#{@content}}' + '#{linebreak(@crafter)}'
268
+ end #Addsec
269
+ end #module Sectioning
270
+ end #module Docgenerator
@@ -1,6 +1,6 @@
1
1
  #encoding: utf-8
2
2
  =begin rdoc
3
- This file change the behaviour of each Object.
3
+ This file change the behaviour of each Object and extends Array
4
4
  =end
5
5
 
6
6
  =begin rdoc
@@ -9,36 +9,44 @@ Extend all objects by the methods
9
9
  - to_html
10
10
  - to_latex
11
11
  - to_wiki
12
+ - to_creole
12
13
  - to_text
13
14
  - to_context
14
15
  Redefine is_a?:
15
- Return true, when you test with a symbol.
16
+ Allows comparison with a symbol.
16
17
  =end
17
18
  class Object
18
19
  alias :old_is_a? :is_a?
19
20
  =begin rdoc
20
- Redefine the standard is_a?
21
+ Redefine the standard is_a? to allow to
22
+ compare with Symbol.
21
23
 
22
- Returns also true, if one of the ids is in testvalue
24
+ Returns also true, if you compare Docgenerator::Element with a Symbol
25
+ and one of the ids if the element corresponds to the Symbol.
26
+
27
+ Example:
28
+ newline = element(:br)
29
+ newline.is_a?(:newline) #true
23
30
  =end
24
31
  def is_a?( testvalue)
25
32
  if testvalue.old_is_a?(Symbol)
26
- if old_is_a?(Element)
27
- return ids.include?(testvalue)
33
+ if old_is_a?(Docgenerator::Element)
34
+ return element_ids.include?(testvalue)
28
35
  else
29
36
  return false
30
37
  end
31
- else
38
+ else #old/normal behaviour.
32
39
  return old_is_a?(testvalue)
33
40
  end
34
41
  end
35
42
  =begin rdoc
36
43
  to_doc returns the object as a string.
37
- will be redefined for Element
44
+ will be redefined for Docgenerator::Element
45
+
38
46
  =end
39
47
  def to_doc(target, options = {})
40
- o = Docgenerator_logger.set_option_defaults(options)
41
- if self.is_a?(Element) and ! self.respond_to?(:to_doc)
48
+ o = Docgenerator.set_option_defaults(options)
49
+ if self.is_a?(Docgenerator::Element) and ! self.respond_to?(:to_doc)
42
50
  o[:log].error( "Missing to_doc routine for #{self.class}") if o[:log].error?
43
51
  end
44
52
  self.respond_to?(:to_str) ? self.to_str : self.to_s
@@ -59,7 +67,7 @@ class Array
59
67
  Returns the element for each parameter
60
68
  =end
61
69
  def to_doc(target, options = {})
62
- o = Docgenerator_logger.set_option_defaults(options)
70
+ o = Docgenerator.set_option_defaults(options)
63
71
  o[:log].debug("enter to_doc(#{target}) for Array, options: #{options.keys.inspect}") if o[:log].debug?
64
72
  str = ""
65
73
  self.each{|el|