docgenerator 1.1.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/docgenerator_example.rb +34 -17
- data/examples/docgenerator_example_footnote.rb +82 -61
- data/examples/docgenerator_example_list.rb +24 -18
- data/examples/docgenerator_example_restrictions.rb +17 -27
- data/examples/docgenerator_example_tabular.rb +20 -20
- data/examples/docgenerator_example_tripfalls.rb +28 -20
- data/examples/results/readme +1 -0
- data/examples/results_expected/docgenerator_example.html +39 -0
- data/examples/results_expected/docgenerator_example.pdf +0 -0
- data/examples/results_expected/docgenerator_example.tex +56 -0
- data/examples/results_expected/docgenerator_example_footnote.html +40 -0
- data/examples/results_expected/docgenerator_example_footnote.pdf +0 -0
- data/examples/results_expected/docgenerator_example_footnote.tex +50 -0
- data/examples/results_expected/docgenerator_example_list.html +18 -0
- data/examples/results_expected/docgenerator_example_list.pdf +0 -0
- data/examples/results_expected/docgenerator_example_list.tex +46 -0
- data/examples/results_expected/docgenerator_example_restrictions.html +22 -0
- data/examples/results_expected/docgenerator_example_restrictions.pdf +0 -0
- data/examples/results_expected/docgenerator_example_restrictions.tex +31 -0
- data/examples/results_expected/docgenerator_example_tabular.html +37 -0
- data/examples/results_expected/docgenerator_example_tabular.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tabular.tex +41 -0
- data/examples/results_expected/docgenerator_example_tripfalls.html +27 -0
- data/examples/results_expected/docgenerator_example_tripfalls.pdf +0 -0
- data/examples/results_expected/docgenerator_example_tripfalls.tex +31 -0
- data/lib/creole/creole2doc.rb +291 -140
- data/lib/creole/creole_inclusion_and_plugins.rb +142 -39
- data/lib/creole/creole_placeholder.rb +92 -30
- data/lib/creole/creole_tabular.rb +119 -20
- data/lib/docgenerator.rb +209 -118
- data/lib/{docgenerator_attribute.rb → docgenerator/attribute.rb} +2 -1
- data/lib/{docgenerator_characters.rb → docgenerator/characters.rb} +75 -6
- data/lib/{docgenerator_css.rb → docgenerator/css.rb} +0 -0
- data/lib/docgenerator/document.rb +588 -0
- data/lib/{docgenerator_element.rb → docgenerator/element.rb} +52 -80
- data/lib/{docgenerator_elements.rb → docgenerator/elements.rb} +43 -17
- data/lib/{docgenerator_environments.rb → docgenerator/environments.rb} +20 -6
- data/lib/{docgenerator_footnote.rb → docgenerator/footnote.rb} +22 -18
- data/lib/{docgenerator_lists.rb → docgenerator/lists.rb} +17 -1
- data/lib/{docgenerator_sections.rb → docgenerator/sections.rb} +9 -1
- data/lib/docgenerator/standard.rb +81 -0
- data/lib/{docgenerator_tabular.rb → docgenerator/tabular.rb} +9 -5
- data/lib/packages/docgenerator_listings.rb +9 -5
- data/lib/packages/docgenerator_pdfpages.rb +17 -11
- data/lib/packages/docgenerator_url.rb +0 -2
- data/lib/templates/docgenerator_template.rb +66 -29
- data/lib/templates/docgenerator_template.yaml +18 -0
- data/lib/wiki2doc/wiki2docgenerator.rb +6 -2
- data/readme.rd +132 -0
- data/unittest/expected/test_document_usepackage_undefined.log +2 -0
- data/unittest/expected/test_enumerate.context +4 -0
- data/unittest/expected/test_footnote.html +4 -4
- data/unittest/expected/test_footnote.latex +4 -4
- data/unittest/expected/test_footnote_group.html +6 -6
- data/unittest/expected/test_footnote_group.latex +6 -6
- data/unittest/expected/test_href.html +2 -2
- data/unittest/expected/test_href.latex +2 -2
- data/unittest/expected/test_href.text +2 -2
- data/unittest/expected/test_itemize.context +4 -0
- data/unittest/expected/test_runtex.stdout +3 -0
- data/unittest/expected/test_runtex_2.stdout +3 -0
- data/unittest/expected/test_section.context +20 -0
- data/unittest/expected/test_tabular.html +2 -2
- data/unittest/expected/test_verbatim.html +3 -0
- data/unittest/expected/test_verbatim.latex +4 -0
- data/unittest/expected/test_verbatim_array.html +1 -0
- data/unittest/expected/test_verbatim_array.latex +2 -0
- data/unittest/expected_creole/test_creole_characters_all.html +12 -5
- data/unittest/expected_creole/test_creole_characters_all.latex +20 -6
- data/unittest/expected_creole/test_creole_comment.context +11 -0
- data/unittest/expected_creole/test_creole_comment.creole +12 -0
- data/unittest/expected_creole/test_creole_comment.html +9 -0
- data/unittest/expected_creole/test_creole_comment.latex +11 -0
- data/unittest/expected_creole/test_creole_creole1.0test.html +3 -3
- data/unittest/expected_creole/test_creole_creole1.0test.latex +3 -3
- data/unittest/expected_creole/test_creole_creole1.0test.text +4 -4
- data/unittest/expected_creole/test_creole_ignore.html +3 -0
- data/unittest/expected_creole/test_creole_ignore.latex +4 -0
- data/unittest/expected_creole/test_creole_ignore.text +2 -0
- data/unittest/expected_creole/test_creole_input.normsource +12 -12
- data/unittest/expected_creole/test_creole_input_file_simple.html +15 -0
- data/unittest/expected_creole/test_creole_input_file_simple_readlines.html +15 -0
- data/unittest/expected_creole/test_creole_links_external_implicit.html +2 -2
- data/unittest/expected_creole/test_creole_links_external_implicit.latex +2 -2
- data/unittest/expected_creole/test_creole_links_external_implicit.text +2 -2
- data/unittest/expected_creole/test_creole_links_implicit_end.creole +4 -0
- data/unittest/expected_creole/test_creole_links_implicit_end.html +3 -0
- data/unittest/expected_creole/test_creole_links_implicit_end.latex +4 -0
- data/unittest/expected_creole/test_creole_list_ul.normsource +42 -42
- data/unittest/expected_creole/test_creole_mix_titles_list.html +10 -0
- data/unittest/expected_creole/test_creole_mix_titles_list.latex +18 -0
- data/unittest/expected_creole/test_creole_mix_titles_list.text +12 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource +15 -15
- data/unittest/expected_creole/test_creole_pictures_css.html +4 -1
- data/unittest/expected_creole/test_creole_pictures_css.latex +5 -1
- data/unittest/expected_creole/test_creole_pictures_longdesc.html +3 -0
- data/unittest/expected_creole/test_creole_pictures_width.html +3 -0
- data/unittest/expected_creole/test_creole_pictures_width.latex +4 -0
- data/unittest/expected_creole/test_creole_short_html.html +3 -0
- data/unittest/expected_creole/test_creole_short_html.latex +4 -0
- data/unittest/expected_creole/test_creole_short_html.text +2 -0
- data/unittest/expected_creole/test_creole_shy.creole +6 -0
- data/unittest/expected_creole/test_creole_shy.html +6 -0
- data/unittest/expected_creole/test_creole_shy.latex +8 -0
- data/unittest/expected_creole/test_creole_shy.text +4 -0
- data/unittest/expected_creole/test_creole_tabular_with_cell_option.html +20 -0
- data/unittest/expected_creole/test_creole_toc.html +3 -1
- data/unittest/expected_creole/test_creole_toc.latex +1 -1
- data/unittest/expected_creole/test_creole_toc.text +1 -1
- data/unittest/expected_creole/test_creole_toc_level.html +7 -0
- data/unittest/expected_creole/test_creole_toc_level.latex +10 -0
- data/unittest/expected_creole/test_creole_toc_level.text +3 -0
- data/unittest/expected_creole/test_creole_toc_level_text.html +8 -0
- data/unittest/expected_creole/test_creole_toc_level_text.latex +9 -0
- data/unittest/expected_creole/test_creole_verbatim.html +1 -1
- data/unittest/expected_creole/test_creole_verbatim.latex +1 -1
- data/unittest/expected_creole/test_creole_verbatim.text +1 -1
- data/unittest/expected_creole/test_creole_verbatim_inline.html +1 -1
- data/unittest/expected_creole/test_creole_verbatim_inline.latex +1 -1
- data/unittest/expected_wiki/test_wiki_description.html +5 -5
- data/unittest/expected_wiki/test_wiki_description.latex +5 -5
- data/unittest/expected_wiki/test_wiki_description.text +5 -5
- data/unittest/expected_wiki/test_wiki_description.wiki +5 -5
- data/unittest/test_rakefile_docgenerator.rb +43 -0
- data/unittest/unittest_creole2doc.rb +415 -27
- data/unittest/unittest_docgenerator.rb +256 -23
- data/unittest/unittest_docgenerator_runtex.rb +83 -0
- data/unittest/unittest_versions.rb +44 -0
- data/unittest/unittest_wiki2doc.rb +28 -27
- metadata +473 -106
- data/lib/docgenerator_document.rb +0 -525
- data/lib/packages/docgenerator_beamer.rb +0 -253
- data/lib/yaml2presentation/yaml2presentation.rb +0 -1091
- data/unittest/expected/beamer_01_article.tex +0 -13
- data/unittest/expected/beamer_01_attachment.tex +0 -15
- data/unittest/expected/beamer_01_doc.html +0 -13
- data/unittest/expected/beamer_01_doc.tex +0 -18
- data/unittest/expected/beamer_01_notes_only.tex +0 -13
- data/unittest/expected/beamer_01_notes_onlyslideswithnotes.tex +0 -13
- data/unittest/expected/beamer_01_notes_show.tex +0 -13
- data/unittest/expected/beamer_01_presentation.tex +0 -13
- data/unittest/expected/beamer_02_doc.html +0 -29
- data/unittest/expected/beamer_02_doc.tex +0 -34
- data/unittest/expected/beamer_block.html +0 -1
- data/unittest/expected/beamer_block.latex +0 -1
- data/unittest/expected/beamer_doc_fragile_doc.tex +0 -33
- data/unittest/expected/beamer_doc_html_overview_with_detailpic_and_text_doc.html +0 -34
- data/unittest/expected/beamer_doc_html_overview_with_detailpic_doc.html +0 -34
- data/unittest/expected/beamer_doc_key_doc.html +0 -20
- data/unittest/expected/beamer_doc_key_doc.tex +0 -29
- data/unittest/expected/beamer_doc_note_doc.html +0 -30
- data/unittest/expected/beamer_doc_note_doc.tex +0 -37
- data/unittest/expected/beamer_doc_pic_bottom_doc.html +0 -24
- data/unittest/expected/beamer_doc_pic_doc.html +0 -24
- data/unittest/expected/beamer_doc_pic_doc.tex +0 -28
- data/unittest/expected/beamer_doc_pic_left_doc.html +0 -24
- data/unittest/expected/beamer_doc_pic_left_doc.tex +0 -28
- data/unittest/expected/beamer_doc_pic_ratio_doc.tex +0 -29
- data/unittest/expected/beamer_doc_pic_right_doc.html +0 -24
- data/unittest/expected/beamer_doc_pic_right_doc.tex +0 -28
- data/unittest/expected/beamer_doc_pic_top_doc.html +0 -24
- data/unittest/expected/beamer_frame.html +0 -5
- data/unittest/expected/beamer_frame.tex +0 -11
- data/unittest/expected/beamer_frame_fragile.tex +0 -7
- data/unittest/expected/beamer_frame_id.html +0 -1
- data/unittest/expected/beamer_frame_id.tex +0 -4
- data/unittest/expected/beamer_framepic.html +0 -5
- data/unittest/expected/beamer_framepic.latex +0 -1
- data/unittest/expected/beamer_framepic_link.html +0 -5
- data/unittest/expected/beamer_framepic_link.latex +0 -1
- data/unittest/expected/beamer_frametitle.html +0 -1
- data/unittest/expected/beamer_frametitle.latex +0 -1
- data/unittest/expected/beamer_note.html +0 -1
- data/unittest/expected/beamer_note.latex +0 -1
- data/unittest/expected_privat/test_creole_test_document.html +0 -6
- data/unittest/expected_wiki/test_wiki_amazon.html +0 -10
- data/unittest/expected_wiki/test_wiki_link.log +0 -3
- data/unittest/test_docgenerator.rb +0 -107
- data/unittest/unittest_yaml2pres.rb +0 -336
data/lib/docgenerator.rb
CHANGED
@@ -1,69 +1,155 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
#
|
53
|
-
#(main problem: End-Tag for br)
|
70
|
+
#For quick test
|
54
71
|
#
|
55
|
-
|
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
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
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
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
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 '
|
237
|
+
require 'docgenerator/standard'
|
238
|
+
require 'docgenerator/element'
|
151
239
|
|
152
|
-
|
153
|
-
|
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 '
|
256
|
+
require 'docgenerator/css'
|
168
257
|
require 'templates/docgenerator_template_css'
|
169
|
-
require '
|
170
|
-
require '
|
171
|
-
|
172
|
-
|
173
|
-
require '
|
174
|
-
require '
|
175
|
-
require '
|
176
|
-
require '
|
177
|
-
require '
|
178
|
-
require '
|
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 => '­',
|
23
|
+
:latex => '"-', #only with babel/ngerman
|
24
|
+
:text => '',
|
25
|
+
:creole => '{{shy}}',
|
26
|
+
} )
|
19
27
|
Element.create( [:space, :ensp], {},false,
|
20
28
|
{ :html => ' ',
|
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,
|
65
|
+
Element.create( [:iquest ], {},false, #¿ umgekehrtes Fragezeichen
|
55
66
|
{ :html => '¿',
|
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 => '&',
|
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 => '↑',
|
129
|
+
:latex => '\ensuremath{\uparrow}'
|
130
|
+
} )
|
131
|
+
|
132
|
+
Element.create( [:dArr, :Downarrow ], {},false,
|
133
|
+
{ :html => '⇓',
|
134
|
+
:latex => '\ensuremath{\Downarrow}'
|
135
|
+
} )
|
136
|
+
|
137
|
+
Element.create( [:darr, :downarrow ], {},false,
|
138
|
+
{ :html => '↓',
|
139
|
+
:latex => '\ensuremath{\downarrow}'
|
140
|
+
} )
|
141
|
+
|
142
|
+
|
112
143
|
Element.create( [:lt, :'<'], {},false,
|
113
144
|
{ :html => '<',
|
114
145
|
:latex => '\ensuremath{<}'
|
@@ -189,7 +220,7 @@ Element.create( [:bullet], {},false,
|
|
189
220
|
Element.create( [:'--', :ndash], {},false,
|
190
221
|
{ :html => '–', #'–'
|
191
222
|
#:html => '–',
|
192
|
-
:latex => '--'
|
223
|
+
:latex => '--',
|
193
224
|
} )
|
194
225
|
Element.create( [:'---', :mdash], {},false,
|
195
226
|
{ :html => '—', #'—'
|
@@ -199,4 +230,42 @@ Element.create( [:'---', :mdash], {},false,
|
|
199
230
|
Element.create( [:dagger], {},false,
|
200
231
|
{ :html => '†',
|
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 => '„',
|
238
|
+
:latex => '"',
|
239
|
+
:creole => '{{bdquo}}',
|
240
|
+
} )
|
241
|
+
Element.create( [:ldquo], {},false,
|
242
|
+
{ :html => '“',
|
243
|
+
:latex => '``',
|
244
|
+
:text => '``',
|
245
|
+
:creole => '{{ldquo}}',
|
246
|
+
} )
|
247
|
+
Element.create( [:rdquo], {},false,
|
248
|
+
{ :html => '”',
|
249
|
+
:latex => "''",
|
250
|
+
:text => "''",
|
251
|
+
:creole => '{{rdquo}}',
|
252
|
+
} )
|
253
|
+
|
254
|
+
#einfaches low-9-Zeichen
|
255
|
+
Element.create( [:sbquo], {},false,
|
256
|
+
{ :html => '‚',
|
257
|
+
#~ :latex => '‚', #‚ -> kein Komma ,
|
258
|
+
:creole => '{{sbquo}}',
|
259
|
+
} )
|
260
|
+
Element.create( [:lsquo], {},false,
|
261
|
+
{ :html => '‘',
|
262
|
+
:latex => '`',
|
263
|
+
:text => '`',
|
264
|
+
:creole => '{{lsquo}}',
|
265
|
+
} )
|
266
|
+
Element.create( [:rsquo], {},false,
|
267
|
+
{ :html => '’',
|
268
|
+
:latex => "’",
|
269
|
+
:text => "’",
|
270
|
+
:creole => '{{rsquo}}',
|
271
|
+
} )
|