docgenerator 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/examples/docgenerator_example.rb +34 -17
  2. data/examples/docgenerator_example_footnote.rb +82 -61
  3. data/examples/docgenerator_example_list.rb +24 -18
  4. data/examples/docgenerator_example_restrictions.rb +17 -27
  5. data/examples/docgenerator_example_tabular.rb +20 -20
  6. data/examples/docgenerator_example_tripfalls.rb +28 -20
  7. data/examples/results/readme +1 -0
  8. data/examples/results_expected/docgenerator_example.html +39 -0
  9. data/examples/results_expected/docgenerator_example.pdf +0 -0
  10. data/examples/results_expected/docgenerator_example.tex +56 -0
  11. data/examples/results_expected/docgenerator_example_footnote.html +40 -0
  12. data/examples/results_expected/docgenerator_example_footnote.pdf +0 -0
  13. data/examples/results_expected/docgenerator_example_footnote.tex +50 -0
  14. data/examples/results_expected/docgenerator_example_list.html +18 -0
  15. data/examples/results_expected/docgenerator_example_list.pdf +0 -0
  16. data/examples/results_expected/docgenerator_example_list.tex +46 -0
  17. data/examples/results_expected/docgenerator_example_restrictions.html +22 -0
  18. data/examples/results_expected/docgenerator_example_restrictions.pdf +0 -0
  19. data/examples/results_expected/docgenerator_example_restrictions.tex +31 -0
  20. data/examples/results_expected/docgenerator_example_tabular.html +37 -0
  21. data/examples/results_expected/docgenerator_example_tabular.pdf +0 -0
  22. data/examples/results_expected/docgenerator_example_tabular.tex +41 -0
  23. data/examples/results_expected/docgenerator_example_tripfalls.html +27 -0
  24. data/examples/results_expected/docgenerator_example_tripfalls.pdf +0 -0
  25. data/examples/results_expected/docgenerator_example_tripfalls.tex +31 -0
  26. data/lib/creole/creole2doc.rb +291 -140
  27. data/lib/creole/creole_inclusion_and_plugins.rb +142 -39
  28. data/lib/creole/creole_placeholder.rb +92 -30
  29. data/lib/creole/creole_tabular.rb +119 -20
  30. data/lib/docgenerator.rb +209 -118
  31. data/lib/{docgenerator_attribute.rb → docgenerator/attribute.rb} +2 -1
  32. data/lib/{docgenerator_characters.rb → docgenerator/characters.rb} +75 -6
  33. data/lib/{docgenerator_css.rb → docgenerator/css.rb} +0 -0
  34. data/lib/docgenerator/document.rb +588 -0
  35. data/lib/{docgenerator_element.rb → docgenerator/element.rb} +52 -80
  36. data/lib/{docgenerator_elements.rb → docgenerator/elements.rb} +43 -17
  37. data/lib/{docgenerator_environments.rb → docgenerator/environments.rb} +20 -6
  38. data/lib/{docgenerator_footnote.rb → docgenerator/footnote.rb} +22 -18
  39. data/lib/{docgenerator_lists.rb → docgenerator/lists.rb} +17 -1
  40. data/lib/{docgenerator_sections.rb → docgenerator/sections.rb} +9 -1
  41. data/lib/docgenerator/standard.rb +81 -0
  42. data/lib/{docgenerator_tabular.rb → docgenerator/tabular.rb} +9 -5
  43. data/lib/packages/docgenerator_listings.rb +9 -5
  44. data/lib/packages/docgenerator_pdfpages.rb +17 -11
  45. data/lib/packages/docgenerator_url.rb +0 -2
  46. data/lib/templates/docgenerator_template.rb +66 -29
  47. data/lib/templates/docgenerator_template.yaml +18 -0
  48. data/lib/wiki2doc/wiki2docgenerator.rb +6 -2
  49. data/readme.rd +132 -0
  50. data/unittest/expected/test_document_usepackage_undefined.log +2 -0
  51. data/unittest/expected/test_enumerate.context +4 -0
  52. data/unittest/expected/test_footnote.html +4 -4
  53. data/unittest/expected/test_footnote.latex +4 -4
  54. data/unittest/expected/test_footnote_group.html +6 -6
  55. data/unittest/expected/test_footnote_group.latex +6 -6
  56. data/unittest/expected/test_href.html +2 -2
  57. data/unittest/expected/test_href.latex +2 -2
  58. data/unittest/expected/test_href.text +2 -2
  59. data/unittest/expected/test_itemize.context +4 -0
  60. data/unittest/expected/test_runtex.stdout +3 -0
  61. data/unittest/expected/test_runtex_2.stdout +3 -0
  62. data/unittest/expected/test_section.context +20 -0
  63. data/unittest/expected/test_tabular.html +2 -2
  64. data/unittest/expected/test_verbatim.html +3 -0
  65. data/unittest/expected/test_verbatim.latex +4 -0
  66. data/unittest/expected/test_verbatim_array.html +1 -0
  67. data/unittest/expected/test_verbatim_array.latex +2 -0
  68. data/unittest/expected_creole/test_creole_characters_all.html +12 -5
  69. data/unittest/expected_creole/test_creole_characters_all.latex +20 -6
  70. data/unittest/expected_creole/test_creole_comment.context +11 -0
  71. data/unittest/expected_creole/test_creole_comment.creole +12 -0
  72. data/unittest/expected_creole/test_creole_comment.html +9 -0
  73. data/unittest/expected_creole/test_creole_comment.latex +11 -0
  74. data/unittest/expected_creole/test_creole_creole1.0test.html +3 -3
  75. data/unittest/expected_creole/test_creole_creole1.0test.latex +3 -3
  76. data/unittest/expected_creole/test_creole_creole1.0test.text +4 -4
  77. data/unittest/expected_creole/test_creole_ignore.html +3 -0
  78. data/unittest/expected_creole/test_creole_ignore.latex +4 -0
  79. data/unittest/expected_creole/test_creole_ignore.text +2 -0
  80. data/unittest/expected_creole/test_creole_input.normsource +12 -12
  81. data/unittest/expected_creole/test_creole_input_file_simple.html +15 -0
  82. data/unittest/expected_creole/test_creole_input_file_simple_readlines.html +15 -0
  83. data/unittest/expected_creole/test_creole_links_external_implicit.html +2 -2
  84. data/unittest/expected_creole/test_creole_links_external_implicit.latex +2 -2
  85. data/unittest/expected_creole/test_creole_links_external_implicit.text +2 -2
  86. data/unittest/expected_creole/test_creole_links_implicit_end.creole +4 -0
  87. data/unittest/expected_creole/test_creole_links_implicit_end.html +3 -0
  88. data/unittest/expected_creole/test_creole_links_implicit_end.latex +4 -0
  89. data/unittest/expected_creole/test_creole_list_ul.normsource +42 -42
  90. data/unittest/expected_creole/test_creole_mix_titles_list.html +10 -0
  91. data/unittest/expected_creole/test_creole_mix_titles_list.latex +18 -0
  92. data/unittest/expected_creole/test_creole_mix_titles_list.text +12 -0
  93. data/unittest/expected_creole/test_creole_paragraphs.normsource +15 -15
  94. data/unittest/expected_creole/test_creole_pictures_css.html +4 -1
  95. data/unittest/expected_creole/test_creole_pictures_css.latex +5 -1
  96. data/unittest/expected_creole/test_creole_pictures_longdesc.html +3 -0
  97. data/unittest/expected_creole/test_creole_pictures_width.html +3 -0
  98. data/unittest/expected_creole/test_creole_pictures_width.latex +4 -0
  99. data/unittest/expected_creole/test_creole_short_html.html +3 -0
  100. data/unittest/expected_creole/test_creole_short_html.latex +4 -0
  101. data/unittest/expected_creole/test_creole_short_html.text +2 -0
  102. data/unittest/expected_creole/test_creole_shy.creole +6 -0
  103. data/unittest/expected_creole/test_creole_shy.html +6 -0
  104. data/unittest/expected_creole/test_creole_shy.latex +8 -0
  105. data/unittest/expected_creole/test_creole_shy.text +4 -0
  106. data/unittest/expected_creole/test_creole_tabular_with_cell_option.html +20 -0
  107. data/unittest/expected_creole/test_creole_toc.html +3 -1
  108. data/unittest/expected_creole/test_creole_toc.latex +1 -1
  109. data/unittest/expected_creole/test_creole_toc.text +1 -1
  110. data/unittest/expected_creole/test_creole_toc_level.html +7 -0
  111. data/unittest/expected_creole/test_creole_toc_level.latex +10 -0
  112. data/unittest/expected_creole/test_creole_toc_level.text +3 -0
  113. data/unittest/expected_creole/test_creole_toc_level_text.html +8 -0
  114. data/unittest/expected_creole/test_creole_toc_level_text.latex +9 -0
  115. data/unittest/expected_creole/test_creole_verbatim.html +1 -1
  116. data/unittest/expected_creole/test_creole_verbatim.latex +1 -1
  117. data/unittest/expected_creole/test_creole_verbatim.text +1 -1
  118. data/unittest/expected_creole/test_creole_verbatim_inline.html +1 -1
  119. data/unittest/expected_creole/test_creole_verbatim_inline.latex +1 -1
  120. data/unittest/expected_wiki/test_wiki_description.html +5 -5
  121. data/unittest/expected_wiki/test_wiki_description.latex +5 -5
  122. data/unittest/expected_wiki/test_wiki_description.text +5 -5
  123. data/unittest/expected_wiki/test_wiki_description.wiki +5 -5
  124. data/unittest/test_rakefile_docgenerator.rb +43 -0
  125. data/unittest/unittest_creole2doc.rb +415 -27
  126. data/unittest/unittest_docgenerator.rb +256 -23
  127. data/unittest/unittest_docgenerator_runtex.rb +83 -0
  128. data/unittest/unittest_versions.rb +44 -0
  129. data/unittest/unittest_wiki2doc.rb +28 -27
  130. metadata +473 -106
  131. data/lib/docgenerator_document.rb +0 -525
  132. data/lib/packages/docgenerator_beamer.rb +0 -253
  133. data/lib/yaml2presentation/yaml2presentation.rb +0 -1091
  134. data/unittest/expected/beamer_01_article.tex +0 -13
  135. data/unittest/expected/beamer_01_attachment.tex +0 -15
  136. data/unittest/expected/beamer_01_doc.html +0 -13
  137. data/unittest/expected/beamer_01_doc.tex +0 -18
  138. data/unittest/expected/beamer_01_notes_only.tex +0 -13
  139. data/unittest/expected/beamer_01_notes_onlyslideswithnotes.tex +0 -13
  140. data/unittest/expected/beamer_01_notes_show.tex +0 -13
  141. data/unittest/expected/beamer_01_presentation.tex +0 -13
  142. data/unittest/expected/beamer_02_doc.html +0 -29
  143. data/unittest/expected/beamer_02_doc.tex +0 -34
  144. data/unittest/expected/beamer_block.html +0 -1
  145. data/unittest/expected/beamer_block.latex +0 -1
  146. data/unittest/expected/beamer_doc_fragile_doc.tex +0 -33
  147. data/unittest/expected/beamer_doc_html_overview_with_detailpic_and_text_doc.html +0 -34
  148. data/unittest/expected/beamer_doc_html_overview_with_detailpic_doc.html +0 -34
  149. data/unittest/expected/beamer_doc_key_doc.html +0 -20
  150. data/unittest/expected/beamer_doc_key_doc.tex +0 -29
  151. data/unittest/expected/beamer_doc_note_doc.html +0 -30
  152. data/unittest/expected/beamer_doc_note_doc.tex +0 -37
  153. data/unittest/expected/beamer_doc_pic_bottom_doc.html +0 -24
  154. data/unittest/expected/beamer_doc_pic_doc.html +0 -24
  155. data/unittest/expected/beamer_doc_pic_doc.tex +0 -28
  156. data/unittest/expected/beamer_doc_pic_left_doc.html +0 -24
  157. data/unittest/expected/beamer_doc_pic_left_doc.tex +0 -28
  158. data/unittest/expected/beamer_doc_pic_ratio_doc.tex +0 -29
  159. data/unittest/expected/beamer_doc_pic_right_doc.html +0 -24
  160. data/unittest/expected/beamer_doc_pic_right_doc.tex +0 -28
  161. data/unittest/expected/beamer_doc_pic_top_doc.html +0 -24
  162. data/unittest/expected/beamer_frame.html +0 -5
  163. data/unittest/expected/beamer_frame.tex +0 -11
  164. data/unittest/expected/beamer_frame_fragile.tex +0 -7
  165. data/unittest/expected/beamer_frame_id.html +0 -1
  166. data/unittest/expected/beamer_frame_id.tex +0 -4
  167. data/unittest/expected/beamer_framepic.html +0 -5
  168. data/unittest/expected/beamer_framepic.latex +0 -1
  169. data/unittest/expected/beamer_framepic_link.html +0 -5
  170. data/unittest/expected/beamer_framepic_link.latex +0 -1
  171. data/unittest/expected/beamer_frametitle.html +0 -1
  172. data/unittest/expected/beamer_frametitle.latex +0 -1
  173. data/unittest/expected/beamer_note.html +0 -1
  174. data/unittest/expected/beamer_note.latex +0 -1
  175. data/unittest/expected_privat/test_creole_test_document.html +0 -6
  176. data/unittest/expected_wiki/test_wiki_amazon.html +0 -10
  177. data/unittest/expected_wiki/test_wiki_link.log +0 -3
  178. data/unittest/test_docgenerator.rb +0 -107
  179. data/unittest/unittest_yaml2pres.rb +0 -336
data/lib/docgenerator.rb CHANGED
@@ -1,69 +1,155 @@
1
- #Generic methods to create documents.
2
- #The target format is generic, supported are LaTeX and HTML.
3
- #Plain text and a Wiki-version exist also, but they are not well maintained.
4
- #
5
- #
6
- #==Wiki
7
- #Docgenerator is also the base for two Wiki-analyser.
8
- #Both parse a wiki-source and build a docgenerator tree.
9
- #In combination, you get a wiki to html and wiki to LaTeX converter.
10
- #
11
- #Details see
12
- #- Creole (Creole-syntax)
13
- #- Wikitext (Wikimedia-syntax, no longer supported.)
14
- #
15
- #==Elements
16
- #A document is structured by Element.
17
- #Each element contains attributes/parameters and content.
18
- #(Think of HTML-attributes and TeX-Parameters and the content of HTML-Tags and TeX-Environments.).
19
- #
20
- #Each element corresponds to a HTML-Tag or a LaTeX-Makro/Environment.
21
- #There is a "translation" between HTML and LaTeX elements.
22
- #
23
- #Elements are defined by Element.get (or the method element() ),
24
- #new element types can be defined with Element.create() ).
25
- #
26
- #Some elements (in fact, most of them) are generated dynamic,
27
- #so they will not occur in this generated documentation).
28
- #
29
- #=== Examples
30
- #A document with a paragraph:
31
- # doc = Document.new
32
- # doc.body << element(:p,{}, 'Content')
33
- # doc.save( 'test.tex', true)
34
- # doc.save( 'test.html', true)
35
- #
36
- #A document with a (unnumbered) list:
37
- # doc = Document.new
38
- # doc.body << ul = element(:ul)
39
- # ul << element(:li,{}, 'List content 1')
40
- # ul << element(:li,{}, 'List content 2')
41
- # doc.save( 'test.tex', true)
42
- # doc.save( 'test.html', true)
43
- #
44
- #See the unit tests and the examples-folder of the docgenerator distribution for more examples.
45
- #
46
- #
47
- #== Known problems
48
- #This program is developed under Windows.
49
- #I expect encoding problems on other systems
50
- #(It's not a problem of the program, but a test problem on my side).
1
+ =begin rdoc
2
+ = NAME
3
+ Docgenerator
4
+
5
+ = SYNOPSIS
6
+ Docgenerator provides a ruby interface to build documents.
7
+
8
+ = DESCRIPTION
9
+ The document generation is build via 'Elements',
10
+ the target format is generic, actual supported are:
11
+ -LaTeX
12
+ -HTML
13
+ Plain text and a Wiki-version exist also, but they are not well maintained,
14
+ a context-export is planned for the future (but it has a low level-importance for me).
15
+
16
+
17
+ ==Wiki
18
+ Docgenerator is also the base for two Wiki-analyser.
19
+ Both parse a wiki-source and build a docgenerator tree.
20
+ In combination, you get a wiki to html and wiki to LaTeX converter.
21
+
22
+ Details see
23
+ * Creole (Creole-syntax)
24
+ * Wikitext (Wikimedia-syntax, no longer supported.)
25
+
26
+ ==Elements
27
+ A document is structured by Element.
28
+ Each element contains attributes/parameters and content.
29
+ (Think of HTML-attributes and TeX-Parameters and the content of HTML-Tags and TeX-Environments.).
30
+
31
+ Each element corresponds to a HTML-Tag or a LaTeX-Makro/Environment.
32
+ There is a "translation" between HTML and LaTeX elements.
33
+
34
+ Elements are defined by Element.get (or the method element() ),
35
+ new element types can be defined with Element.create() ).
36
+
37
+ Some elements (in fact, most of them) are generated dynamic,
38
+ so they will not occur in this generated documentation).
39
+
40
+ === Examples
41
+ A document with a paragraph:
42
+ doc = Document.new
43
+ doc.body << element(:p,{}, 'Content')
44
+ doc.save( 'test.tex', true)
45
+ doc.save( 'test.html', true)
46
+
47
+ A document with a (unnumbered) list:
48
+ doc = Document.new
49
+ doc.body << ul = element(:ul)
50
+ ul << element(:li,{}, 'List content 1')
51
+ ul << element(:li,{}, 'List content 2')
52
+ doc.save( 'test.tex', true)
53
+ doc.save( 'test.html', true)
54
+
55
+ See the unit tests and the examples-folder of the docgenerator distribution for more examples.
56
+
57
+
58
+ == Known problems
59
+ This program is developed under Windows.
60
+ I expect encoding problems on other systems
61
+ (It's not a problem of the program, but a test problem on my side).
62
+
63
+ HTML-Versions are not supported properly
64
+ (main problem: End-Tag for br)
65
+
66
+ More at http://ruby.lickert.net/docgenerator/index.html
67
+ =end
68
+
51
69
  #
52
- #HTML-Versions are not supported properly
53
- #(main problem: End-Tag for br)
70
+ #For quick test
54
71
  #
55
- #More at http://ruby.lickert.net/docgenerator/index.html
56
-
57
- #Version information.
58
- begin
59
- if Gem.loaded_specs['docgenerator']
60
- DOCGENERATOR_VERSION = Gem.loaded_specs['docgenerator'].version
61
- else
62
- DOCGENERATOR_VERSION = "#{File.expand_path('docgenerator')} (no Gem)"
63
- end
64
- rescue NameError #No gems?
65
- DOCGENERATOR_VERSION = "#{File.expand_path('docgenerator')} (no Gem)"
72
+ if $0 == __FILE__ and RUBY_VERSION == '1.9.1'
73
+ $:.unshift('./')
66
74
  end
75
+
76
+
77
+
78
+ =begin rdoc
79
+ Just a dummy for the version.
80
+ This module should be included by all classes.
81
+ =end
82
+ module Docgenerator
83
+ #Define Version number
84
+ VERSION = '1.2.1'
85
+ end #Docgenerator
86
+
87
+
88
+ =begin rdoc
89
+ Small include-module to define a to_doc-distributor
90
+
91
+ If you include this, please redefine to_latex, to_html.... else you get a endless loop.
92
+ =end
93
+ module Docgenerator_to_doc
94
+ =begin rdoc
95
+ to_doc returns the object as a string.
96
+ =end
97
+ def to_doc(target, options = {})
98
+ o = Docgenerator_logger.set_option_defaults(options)
99
+ str = ""
100
+ case target
101
+ when :latex
102
+ str = self.to_latex(options)
103
+ when :html
104
+ str = self.to_html(options)
105
+ when :context
106
+ str = self.to_context(options)
107
+ when :wiki
108
+ str = self.to_wiki(options)
109
+ when :creole
110
+ str = self.to_creole(options)
111
+ else;
112
+ o[:log].error( "Unknown target #{target.inspect} for #{self.class}") if o[:log].error?
113
+ str = self.to_doc_str()
114
+ end #case target
115
+ str
116
+ end
117
+ =begin rdoc
118
+ The following code must be redefinded
119
+ =end
120
+ def to_text(options = {})
121
+ o = Docgenerator_logger.set_option_defaults(options)
122
+ o[:log].fatal( "Please redefine to_text in #{self.class}") if o[:log].fatal?
123
+ self.respond_to?(:to_str) ? self.to_str : self.to_s
124
+ end
125
+ def to_latex(options = {})
126
+ o = Docgenerator_logger.set_option_defaults(options)
127
+ o[:log].fatal( "Please redefine to_text in #{self.class}") if o[:log].fatal?
128
+ self.respond_to?(:to_str) ? self.to_str : self.to_s
129
+ end
130
+ def to_context(options = {})
131
+ o = Docgenerator_logger.set_option_defaults(options)
132
+ o[:log].fatal( "Please redefine to_text in #{self.class}") if o[:log].fatal?
133
+ self.respond_to?(:to_str) ? self.to_str : self.to_s
134
+ end
135
+ def to_html(options = {})
136
+ o = Docgenerator_logger.set_option_defaults(options)
137
+ o[:log].fatal( "Please redefine to_text in #{self.class}") if o[:log].fatal?
138
+ self.respond_to?(:to_str) ? self.to_str : self.to_s
139
+ end
140
+ def to_wiki(options = {})
141
+ o = Docgenerator_logger.set_option_defaults(options)
142
+ o[:log].fatal( "Please redefine to_text in #{self.class}") if o[:log].fatal?
143
+ self.respond_to?(:to_str) ? self.to_str : self.to_s
144
+ end
145
+ def to_creole(options = {})
146
+ o = Docgenerator_logger.set_option_defaults(options)
147
+ o[:log].fatal( "Please redefine to_text in #{self.class}") if o[:log].fatal?
148
+ self.respond_to?(:to_str) ? self.to_str : self.to_s
149
+ end
150
+ end #Docgenerator_to_doc
151
+
152
+
67
153
  require 'log4r'
68
154
  require 'yaml' #needed by docgenerator_template.rb
69
155
 
@@ -78,44 +164,44 @@ require 'yaml' #needed by docgenerator_template.rb
78
164
  ENDTAG = false if ! defined?( ENDTAG )
79
165
 
80
166
 
167
+ =begin rdoc
168
+ The docgenerator own log-formatter.
81
169
 
82
- #The docgenetor own log-formatter.
83
- #
84
- #Reason:
85
- #docgenerator throws logging information.
86
- #The trace would inform, where the problems come from (a docgenerator-tool)
87
- #but normally the problems are document problems,
88
- #so we need the first step outside the docgenerator-path
170
+ Reason:
171
+ docgenerator throws logging information.
172
+ The trace would inform, where the problems come from (a docgenerator-tool)
173
+ but normally the problems are document problems,
174
+ so we need the first step outside the docgenerator-path
175
+ =end
89
176
  class LogFormatter < Log4r::BasicFormatter
90
- #Use another format for the logger.
91
- #
92
- #Based on BasicFormatter.
93
- #When used with trace on, return the location from docgenerator and the first non-docgenerator position.
94
- def format(event)
95
- buff = sprintf(@@basicformat, Log4r::MaxLevelLength, Log4r::LNAMES[event.level],
96
- event.name)
97
- mytrace = []
98
- #~ buff += (event.tracer.nil? ? "" : "(#{event.tracer[0]})") + ": "
99
- if event.tracer.nil?
100
- else
101
- event.tracer.each{|trace|
102
- if trace !~ /lib\/docgenerator/
103
- mytrace << trace
104
- break
105
- end
106
- }
107
- mytrace << event.tracer[0]
108
- end
109
- buff += ": "
110
- buff += format_object(event.data)
111
- #~ buff += (event.tracer.nil? ? "" : " (#{event.tracer.join('/')})")
112
- buff += (event.tracer.nil? ? "" : " (#{mytrace.join('|')})")
113
- buff += "\n"
114
- buff
177
+ #Use another format for the logger.
178
+ #
179
+ #Based on BasicFormatter.
180
+ #When used with trace on, return the location from docgenerator and the first non-docgenerator position.
181
+ def format(event)
182
+ buff = sprintf(@@basicformat, Log4r::MaxLevelLength, Log4r::LNAMES[event.level],
183
+ event.name)
184
+ mytrace = []
185
+ #~ buff += (event.tracer.nil? ? "" : "(#{event.tracer[0]})") + ": "
186
+ if event.tracer.nil?
187
+ else
188
+ event.tracer.each{|trace|
189
+ if trace !~ /lib\/docgenerator/
190
+ mytrace << trace
191
+ break
192
+ end
193
+ }
194
+ mytrace << event.tracer[0]
115
195
  end
196
+ buff += ": "
197
+ buff += format_object(event.data)
198
+ #~ buff += (event.tracer.nil? ? "" : " (#{event.tracer.join('/')})")
199
+ buff += (event.tracer.nil? ? "" : " (#{mytrace.join('|')})")
200
+ buff += "\n"
201
+ buff
116
202
  end
203
+ end #LogFormatter
117
204
 
118
-
119
205
  #Default Logger
120
206
  DOCGENERATOR_LOGGER = Log4r::Logger.new( 'docgenerator')
121
207
  DOCGENERATOR_LOGGER.level = Log4r::FATAL
@@ -124,19 +210,20 @@ DOCGENERATOR_LOGGER.outputters = Log4r::StdoutOutputter.new('log_stdout',
124
210
  )
125
211
 
126
212
 
127
- #
128
- #A 'global' parameter setting
129
- #
130
- #For usage of
131
- # o = Docgenerator_logger.set_option_defaults(options)
132
- # o[:log].debug("Enter ...") if o[:log].debug?
213
+ =begin rdoc
214
+ A 'global' parameter setting
215
+
216
+ For usage of
217
+ o = Docgenerator_logger.set_option_defaults(options)
218
+ o[:log].debug("Enter ...") if o[:log].debug?
219
+ =end
133
220
  module Docgenerator_logger
134
221
  #Each to_doc, to_html, to_latex, to_wiki, to_text has an option-parameter.
135
222
  #This option-hash should contain at least a :log-value.
136
223
  #This method completes the option hash with a default logger if no logger is given.
137
224
  def self.set_option_defaults(options)
138
225
  return {
139
- :log => DOCGENERATOR_LOGGER
226
+ :log => DOCGENERATOR_LOGGER,
140
227
  #Added from Document:
141
228
  # :document useable for documentation
142
229
  # :filename useable for documentation
@@ -147,11 +234,13 @@ module Docgenerator_logger
147
234
  }.update(options)
148
235
  end
149
236
  end
150
- require 'docgenerator_element'
237
+ require 'docgenerator/standard'
238
+ require 'docgenerator/element'
151
239
 
152
- #Returns an element of a type "name".
153
- #Attributes and content are optional parameter.
154
- #
240
+ =begin rdoc
241
+ Returns an element of a type "name".
242
+ Attributes and content are optional parameter.
243
+ =end
155
244
  def element( name, attr = {}, content = nil )
156
245
  element = Element.get( name )
157
246
  if element
@@ -164,18 +253,20 @@ def element( name, attr = {}, content = nil )
164
253
  end
165
254
 
166
255
  require 'templates/docgenerator_template'
167
- require 'docgenerator_css'
256
+ require 'docgenerator/css'
168
257
  require 'templates/docgenerator_template_css'
169
- require 'docgenerator_attribute'
170
- require 'docgenerator_document'
171
-
172
- require 'docgenerator_elements'
173
- require 'docgenerator_environments'
174
- require 'docgenerator_lists' #define environment
175
- require 'docgenerator_sections'
176
- require 'docgenerator_tabular'
177
- require 'docgenerator_footnote'
178
- require 'docgenerator_characters' #special characters (spaces, euro-sign...)
258
+ require 'docgenerator/attribute'
259
+ require 'docgenerator/document'
260
+ #~ require_relative 'docgenerator/document'
261
+
262
+ require 'docgenerator/elements'
263
+ require 'docgenerator/environments'
264
+ require 'docgenerator/lists' #define environment
265
+ require 'docgenerator/sections'
266
+ require 'docgenerator/tabular'
267
+ require 'docgenerator/footnote'
268
+ require 'docgenerator/characters' #special characters (spaces, euro-sign...)
269
+ #~ require_relative 'docgenerator/characters' #special characters (spaces, euro-sign...)
179
270
 
180
271
  __END__
181
272
  class Test
@@ -127,7 +127,8 @@ class Attribute
127
127
  #Return the content.
128
128
  def to_s()
129
129
  #~ def to_s( target = Document.target( self ) )
130
- @attr_content.to_s()
130
+ #~ @attr_content.to_s() #Ruby 1.8
131
+ @attr_content.join() #Ruby 1.9
131
132
  end
132
133
  def inspect()
133
134
  return "<#Attribute #{@name} #{@attr_content.inspect} (in #{@element.ids}) >"
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  #Some Coding to prepare the unit tests
2
4
  #~ els = nil
3
5
  #~ DATA.each{|line|
@@ -16,6 +18,12 @@
16
18
  #
17
19
  # Special Characters
18
20
  #
21
+ Element.create( [:shy ], {},false,
22
+ { :html => '&shy;',
23
+ :latex => '"-', #only with babel/ngerman
24
+ :text => '',
25
+ :creole => '{{shy}}',
26
+ } )
19
27
  Element.create( [:space, :ensp], {},false,
20
28
  { :html => '&ensp;',
21
29
  :latex => '~'
@@ -43,7 +51,10 @@ Element.create( [:percent, :'%'], {},false,
43
51
 
44
52
  Element.create( [:dollar, :'$'], {},false,
45
53
  { :html => '$',
46
- :latex => '\$'
54
+ :latex => '\$',
55
+ :creole => '$',
56
+ :wiki => '$',
57
+ :text => '$',
47
58
  } )
48
59
 
49
60
  Element.create( [:'^'], {},false,
@@ -51,15 +62,19 @@ Element.create( [:'^'], {},false,
51
62
  :latex => '\hat{}'
52
63
  } )
53
64
 
54
- Element.create( [:iquest ], {},false, #� umgekehrtes Fragezeichen
65
+ Element.create( [:iquest ], {},false, #¿ umgekehrtes Fragezeichen
55
66
  { :html => '&iquest;',
56
- :latex => '' #?`
67
+ :latex => '¿', #?`
68
+ :creole => '¿',
69
+ :wiki => '¿',
70
+ :text => '¿',
57
71
  } )
58
72
 
59
73
 
60
74
  Element.create( [:ampersand, :'&'], {},false,
61
75
  { :html => '&amp;',
62
- :latex => '\&'
76
+ :latex => '\&',
77
+ :text => '&',
63
78
  } )
64
79
 
65
80
  Element.create( [:rbrace, :'}'], {},false,
@@ -109,6 +124,22 @@ Element.create( [:uArr, :Uparrow ], {},false,
109
124
  :latex => '\ensuremath{\Uparrow}'
110
125
  } )
111
126
 
127
+ Element.create( [:uarr, :uparrow ], {},false,
128
+ { :html => '&uarr;',
129
+ :latex => '\ensuremath{\uparrow}'
130
+ } )
131
+
132
+ Element.create( [:dArr, :Downarrow ], {},false,
133
+ { :html => '&dArr;',
134
+ :latex => '\ensuremath{\Downarrow}'
135
+ } )
136
+
137
+ Element.create( [:darr, :downarrow ], {},false,
138
+ { :html => '&darr;',
139
+ :latex => '\ensuremath{\downarrow}'
140
+ } )
141
+
142
+
112
143
  Element.create( [:lt, :'<'], {},false,
113
144
  { :html => '&lt;',
114
145
  :latex => '\ensuremath{<}'
@@ -189,7 +220,7 @@ Element.create( [:bullet], {},false,
189
220
  Element.create( [:'--', :ndash], {},false,
190
221
  { :html => '&ndash;', #'&#8211;'
191
222
  #:html => '&#150;',
192
- :latex => '--'
223
+ :latex => '--',
193
224
  } )
194
225
  Element.create( [:'---', :mdash], {},false,
195
226
  { :html => '&mdash;', #'&#8212;'
@@ -199,4 +230,42 @@ Element.create( [:'---', :mdash], {},false,
199
230
  Element.create( [:dagger], {},false,
200
231
  { :html => '&dagger;',
201
232
  :latex => '\dag'
202
- } )
233
+ } )
234
+
235
+ #See http://www.cs.sfu.ca/~ggbaker/reference/characters/#double
236
+ Element.create( [:bdquo], {},false,
237
+ { :html => '&bdquo;',
238
+ :latex => '"',
239
+ :creole => '{{bdquo}}',
240
+ } )
241
+ Element.create( [:ldquo], {},false,
242
+ { :html => '&ldquo;',
243
+ :latex => '``',
244
+ :text => '``',
245
+ :creole => '{{ldquo}}',
246
+ } )
247
+ Element.create( [:rdquo], {},false,
248
+ { :html => '&rdquo;',
249
+ :latex => "''",
250
+ :text => "''",
251
+ :creole => '{{rdquo}}',
252
+ } )
253
+
254
+ #einfaches low-9-Zeichen
255
+ Element.create( [:sbquo], {},false,
256
+ { :html => '&sbquo;',
257
+ #~ :latex => '‚', #‚ -> kein Komma ,
258
+ :creole => '{{sbquo}}',
259
+ } )
260
+ Element.create( [:lsquo], {},false,
261
+ { :html => '&lsquo;',
262
+ :latex => '`',
263
+ :text => '`',
264
+ :creole => '{{lsquo}}',
265
+ } )
266
+ Element.create( [:rsquo], {},false,
267
+ { :html => '&rsquo;',
268
+ :latex => "’",
269
+ :text => "’",
270
+ :creole => '{{rsquo}}',
271
+ } )