docgenerator 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/creole_example_tabular.rb +95 -0
- data/examples/docgenerator_example.rb +5 -5
- data/lib/creole/creole2doc.rb +28 -18
- data/lib/creole/creole_inclusions.rb +4 -4
- data/lib/creole/creole_placeholder.rb +4 -1
- data/lib/creole/creole_tabular.rb +173 -155
- data/lib/creole/plugins/rail.rb +118 -119
- data/lib/creole/plugins/struktex.rb +35 -35
- data/lib/creole/plugins/todonotes.rb +8 -1
- data/lib/docgenerator/attribute.rb +160 -160
- data/lib/docgenerator/characters.rb +343 -311
- data/lib/docgenerator/css.rb +167 -167
- data/lib/docgenerator/document.rb +525 -511
- data/lib/docgenerator/element.rb +316 -316
- data/lib/docgenerator/element_meta.rb +114 -114
- data/lib/docgenerator/elements.rb +19 -9
- data/lib/docgenerator/environments.rb +3 -1
- data/lib/docgenerator/lists.rb +177 -174
- data/lib/docgenerator/packages/hyperref.rb +74 -70
- data/lib/docgenerator/packages/multicol.rb +33 -0
- data/lib/docgenerator/packages/scrlettr2.rb +152 -151
- data/lib/docgenerator/packages/todonotes.rb +1 -1
- data/lib/docgenerator/tabular.rb +463 -400
- data/lib/docgenerator/templates/docgenerator_template.rb +94 -84
- data/lib/docgenerator/templates/docgenerator_template.yaml +75 -15
- data/lib/docgenerator.rb +1 -1
- data/lib/wiki2doc/wiki2docgenerator.rb +1 -1
- data/meta_test_and_doc/build__meta.rb +125 -0
- data/meta_test_and_doc/build_doc.rb +333 -0
- data/meta_test_and_doc/build_test.rb +251 -0
- data/meta_test_and_doc/manpages/attachfile.rb +389 -0
- data/meta_test_and_doc/manpages/caption.rb +133 -0
- data/meta_test_and_doc/manpages/characters.rb +3738 -0
- data/meta_test_and_doc/manpages/elements.rb +6851 -0
- data/meta_test_and_doc/manpages/environments.rb +985 -0
- data/meta_test_and_doc/manpages/footnote.rb +439 -0
- data/meta_test_and_doc/manpages/hyperref.rb +605 -0
- data/meta_test_and_doc/manpages/listings.rb +988 -0
- data/meta_test_and_doc/manpages/lists.rb +1463 -0
- data/meta_test_and_doc/manpages/others.rb +129 -0
- data/meta_test_and_doc/manpages/packages.rb +13 -0
- data/meta_test_and_doc/manpages/pdfpages.rb +108 -0
- data/meta_test_and_doc/manpages/readme.rdoc +9 -0
- data/meta_test_and_doc/manpages/scrlettr2.rb +362 -0
- data/meta_test_and_doc/manpages/scrpage2.rb +2028 -0
- data/meta_test_and_doc/manpages/sectioning.rb +2467 -0
- data/meta_test_and_doc/manpages/tables.rb +2088 -0
- data/meta_test_and_doc/manpages/todonotes.rb +235 -0
- data/meta_test_and_doc/manpages/wiki2docgenerator.rb +64 -0
- data/{readme.rd → readme.rdoc} +18 -1
- data/unittest/expected/test_tabular.creole +33 -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 +3 -3
- data/unittest/expected_creole/test_creole_inline_apostroph.html +6 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.latex +8 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.text +4 -0
- data/unittest/expected_creole/test_creole_input.normsource +12 -12
- data/unittest/expected_creole/test_creole_input.normsource_1.8 +23 -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.html +1 -1
- data/unittest/expected_creole/test_creole_links_implicit_end.latex +1 -1
- data/unittest/expected_creole/test_creole_list_ul.normsource +42 -42
- data/unittest/expected_creole/test_creole_list_ul.normsource_1.8 +83 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource +15 -15
- data/unittest/expected_creole/test_creole_paragraphs.normsource_1.8 +27 -0
- data/unittest/expected_creole/test_creole_tabular.creole +22 -0
- data/unittest/expected_creole/test_creole_tabular_creole.creole +19 -0
- data/unittest/expected_creole/test_creole_tabular_css.creole +24 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.creole +16 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.html +14 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.latex +16 -0
- data/unittest/expected_creole/test_creole_tabular_with_cell_option.creole +21 -0
- data/unittest/expected_creole/test_creole_toc_level_text.html +2 -2
- data/unittest/expected_creole/test_creole_toc_level_text.latex +2 -2
- data/unittest/expected_packages/test_multicol_3.tex +2 -0
- data/unittest/expected_packages/test_multicol_3_titleline.tex +2 -0
- data/unittest/expected_templates/test_article.tex +23 -0
- data/unittest/expected_templates/test_article_utf8.tex +34 -0
- data/unittest/expected_templates/test_context.miv +18 -0
- data/unittest/expected_templates/test_creole.creole +8 -0
- data/unittest/expected_templates/test_html.html +12 -0
- data/unittest/expected_templates/test_html401_strict.html +14 -0
- data/unittest/expected_templates/test_html401_trans.html +14 -0
- data/unittest/expected_templates/test_html_utf8.html +14 -0
- data/unittest/expected_templates/test_include.tex +17 -0
- data/unittest/expected_templates/test_include_utf8.tex +17 -0
- data/unittest/expected_templates/test_text.txt +6 -0
- data/unittest/expected_templates/test_wiki.wiki +6 -0
- data/unittest/expected_templates/test_xhtml_strict.html +14 -0
- data/unittest/expected_templates/test_xhtml_trans.html +14 -0
- data/unittest/unittest_creole.rb +27 -6
- data/unittest/unittest_creole_placeholders.rb +1 -123
- data/unittest/unittest_creole_tabular.rb +174 -0
- data/unittest/unittest_docgenerator.rb +4 -3
- data/unittest/unittest_docgenerator_characters.rb +4769 -615
- data/unittest/unittest_packages_multicol.rb +84 -0
- data/unittest/unittest_rubycode4doc.rb +0 -1
- data/unittest/unittest_templates.rb +64 -0
- metadata +163 -77
- data/build_test_and_doc.rb +0 -505
- data/manpage_elements.rb +0 -10411
data/lib/creole/plugins/rail.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
#encoding: utf-8
|
1
2
|
=begin rdoc
|
2
3
|
Support for the rail package.
|
3
4
|
|
@@ -8,7 +9,7 @@ Don't be confused with ruby on rails - there is no intersection of the two packa
|
|
8
9
|
require 'creole/creole2doc'
|
9
10
|
|
10
11
|
module Docgenerator
|
11
|
-
module Creole
|
12
|
+
module Creole
|
12
13
|
=begin rdoc
|
13
14
|
Support for the rail package.
|
14
15
|
|
@@ -16,100 +17,99 @@ This is support for LaTeX-style rail.
|
|
16
17
|
|
17
18
|
* http://www.ctan.org/tex-archive/support/rail/
|
18
19
|
=end
|
19
|
-
module Rail
|
20
|
+
module Rail
|
20
21
|
|
21
|
-
#
|
22
|
-
#A Wrapper for the Creole-placeholder for Rail-diagramms.
|
23
|
-
#
|
24
|
-
class Diagramm4Creole < Placeholder
|
25
|
-
|
26
|
-
|
27
|
-
def initialize( wiki, name = 'Raildiagramm')
|
28
|
-
super
|
29
|
-
@name = name
|
30
|
-
raise ParameterError, "Missing id for rail-diagramm" unless @name
|
31
|
-
raise ParameterError, "Id for rail-diagramm contains no-letter" unless @name =~ /\A\w+\Z/
|
32
|
-
end
|
33
|
-
|
34
|
-
#fixme
|
35
|
-
#Check if the rail-diagramm is available as a picture.
|
36
|
-
#~ @filename = "#{@key}.png"
|
37
|
-
#~ if ! File.exist?( @filename )
|
38
|
-
#~ @filename = nil
|
39
|
-
#~ end
|
22
|
+
#
|
23
|
+
#A Wrapper for the Creole-placeholder for Rail-diagramms.
|
24
|
+
#
|
25
|
+
class Diagramm4Creole < Placeholder
|
26
|
+
set_placeholder_key 'rail'
|
40
27
|
|
28
|
+
def initialize( wiki, name = 'Raildiagramm')
|
29
|
+
super
|
30
|
+
@name = name
|
31
|
+
raise ParameterError, "Missing id for rail-diagramm" unless @name
|
32
|
+
raise ParameterError, "Id for rail-diagramm contains no-letter" unless @name =~ /\A\w+\Z/
|
33
|
+
end
|
34
|
+
|
35
|
+
#fixme
|
36
|
+
#Check if the rail-diagramm is available as a picture.
|
37
|
+
#~ @filename = "#{@key}.png"
|
38
|
+
#~ if ! File.exist?( @filename )
|
39
|
+
#~ @filename = nil
|
40
|
+
#~ end
|
41
41
|
|
42
42
|
=begin rdoc
|
43
43
|
Return content only for LaTeX
|
44
44
|
=end
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
end #Rail_diagramm4Creole
|
45
|
+
def to_doc( target, options = {})
|
46
|
+
#fixme: Einmalig beim initialisieren
|
47
|
+
#fixme: Varianten erledigen
|
48
|
+
#fixme: Bild falls verfügbar
|
49
|
+
#fixme: nur TeX (oder Bild)
|
50
|
+
#fixme logs
|
51
|
+
#~ case options[:elementtype]
|
52
|
+
#~ when nil #ignore diagramm
|
53
|
+
#~ when :minipage
|
54
|
+
#~ return to_element_minipage()
|
55
|
+
#~ when :figure
|
56
|
+
#~ return to_element_figure()
|
57
|
+
#~ when :figure_img
|
58
|
+
#~ return to_element_figure_img()
|
59
|
+
#~ when :latexonly
|
60
|
+
#~ return element(:latexonly,{}, self.to_latex_rail ).cr
|
61
|
+
#~ else
|
62
|
+
#~ option[:log].error("Raildiagramm#to_element: Undefined type #{@@elementtype}") if option[:log].error?
|
63
|
+
#~ end
|
64
|
+
|
65
|
+
#fixme Bild?
|
66
|
+
Rail_diagramm.new( @name, @source ).to_doc( target, options )
|
67
|
+
end
|
68
|
+
#Check for picture and return a :img-macro (Only html)
|
69
|
+
def to_img()
|
70
|
+
return element( :img, { :src => @filename }) if @filename
|
71
|
+
end
|
72
|
+
#~ def to_element_figure()
|
73
|
+
#~ figure = element(:figure).cr
|
74
|
+
#~ figure << self.to_s
|
75
|
+
#~ figure << element(:caption,{}, "Rail-Diagramm #{@key}" ).Cr
|
76
|
+
#~ return figure
|
77
|
+
#~ end
|
78
|
+
#~ def to_element_figure_img()
|
79
|
+
#~ if @filename
|
80
|
+
#~ figure = element(:figure, { :style => CSS.new(
|
81
|
+
#~ :text_align => 'center',
|
82
|
+
#~ :float => 'right'
|
83
|
+
#~ )}).cr
|
84
|
+
#~ figure << self.to_img
|
85
|
+
#~ figure << element(:br).cr
|
86
|
+
#~ figure << element(:caption,{}, "Rail-Diagramm #{@key}" ).Cr
|
87
|
+
#~ else
|
88
|
+
#~ figure = nil
|
89
|
+
#~ end
|
90
|
+
#~ return figure
|
91
|
+
#~ end
|
92
|
+
#~ #Requires caption.sty
|
93
|
+
#~ # doc.head << element(:usepackage,{}, 'caption')
|
94
|
+
#~ def to_element_minipage()
|
95
|
+
#~ figure = element(:minipage, {:width => '\textwidth'} ).CR
|
96
|
+
#~ figure << element(:centering)
|
97
|
+
#~ figure << self.to_s
|
98
|
+
#~ figure << element(:captionof,{ :float_type => 'figure' }, "Rail-Diagramm #{@key}" ).Cr
|
99
|
+
#~ return figure
|
100
|
+
#~ end
|
101
|
+
end #Rail_diagramm4Creole
|
102
102
|
|
103
|
-
#
|
104
|
-
#A Rail-diagramm
|
105
|
-
#
|
106
|
-
class Rail_diagramm
|
103
|
+
#
|
104
|
+
#A Rail-diagramm
|
105
|
+
#
|
106
|
+
class Rail_diagramm
|
107
107
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
#Can be used in document header to load rail.sty
|
109
|
+
TEX_PACKAGE_RAIL = element(:usepackage,{ }, 'rail').cr
|
110
|
+
#Some command to be added in document header.
|
111
|
+
#Allows the usage of some characters as terminals.
|
112
|
+
RAIL_ALIAS = <<'RAIL_ALIAS'
|
113
113
|
\railalias{lbrace}{\{}
|
114
114
|
\railalias{rbrace}{\}}
|
115
115
|
\railalias{dollar}{\$}
|
@@ -131,29 +131,29 @@ class Rail_diagramm
|
|
131
131
|
\railterm{lbrace,rbrace,dollar,percent,backslash,underscore,at,atat}
|
132
132
|
\railterm{lt,le,gt,ge,caret,tildeeq}
|
133
133
|
RAIL_ALIAS
|
134
|
-
#~ \railalias{ampersand}{\&} -> umgesetht nachh << head>>
|
134
|
+
#~ \railalias{ampersand}{\&} -> umgesetht nachh << head>>
|
135
135
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
136
|
+
#Create new Rail diagramm.
|
137
|
+
#Parameter:
|
138
|
+
#-key
|
139
|
+
#-rail-definition
|
140
|
+
def initialize( key, code = '' )
|
141
|
+
@key = key
|
142
|
+
@code = code
|
143
|
+
end
|
144
|
+
#Implement << for Wikicollector
|
145
|
+
def << (code)
|
146
|
+
@code << code
|
147
|
+
end
|
148
148
|
=begin
|
149
149
|
Return LaTeX-environment rail
|
150
150
|
Requires rail.sty and rail.exe to generate the figure.
|
151
151
|
|
152
152
|
|
153
153
|
=end
|
154
|
-
|
155
|
-
|
156
|
-
|
154
|
+
def to_latex(options = {})
|
155
|
+
@code = @code.join if @code.respond_to?(:join) #if Array is given
|
156
|
+
return <<-RAIL
|
157
157
|
%
|
158
158
|
% Define a rail-diagramm #{@key}
|
159
159
|
%
|
@@ -163,20 +163,19 @@ Requires rail.sty and rail.exe to generate the figure.
|
|
163
163
|
;
|
164
164
|
\\end{rail}
|
165
165
|
RAIL
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
end
|
179
|
-
|
180
|
-
end #module
|
181
|
-
end #module Creole
|
166
|
+
end #to_latex
|
167
|
+
def to_doc( target, options = {})
|
168
|
+
case target
|
169
|
+
when :latex
|
170
|
+
self.to_latex( options )
|
171
|
+
else
|
172
|
+
o = set_option_defaults(options)
|
173
|
+
#~ o[:log].debug("enter to_doc(#{target}) for #{self.inspect}, options: #{options.keys.inspect}") if o[:log].debug?
|
174
|
+
o[:log].error("Rail-diagramm not supported for #{target}") if o[:log].error?
|
175
|
+
''
|
176
|
+
end #case target
|
177
|
+
end #to_doc
|
178
|
+
end
|
179
|
+
end #module Rail
|
180
|
+
end #module Creole
|
182
181
|
end #module Docgenerator
|
@@ -5,7 +5,7 @@ require 'creole/creole2doc'
|
|
5
5
|
require 'docgenerator/packages/struktex.rb'
|
6
6
|
|
7
7
|
module Docgenerator
|
8
|
-
module Creole
|
8
|
+
module Creole
|
9
9
|
|
10
10
|
=begin rdoc
|
11
11
|
Define Creole placeholder.
|
@@ -20,40 +20,40 @@ The placeholder insertion must contain three parameters:
|
|
20
20
|
<<<
|
21
21
|
Details see Docgenerator::Structogramm
|
22
22
|
=end
|
23
|
-
class Creole_structogramm < Placeholder
|
24
|
-
|
25
|
-
|
26
|
-
#~ fixme
|
27
|
-
#~ parameters optional als placeholder,
|
28
|
-
#~ hier aber
|
29
|
-
#~ Defaults??
|
23
|
+
class Creole_structogramm < Placeholder
|
24
|
+
set_placeholder_key('structogramm')
|
25
|
+
|
26
|
+
#~ fixme
|
27
|
+
#~ parameters optional als placeholder,
|
28
|
+
#~ hier aber benötigt.
|
29
|
+
#~ Defaults??
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end #Creole_latex
|
31
|
+
def initialize( wiki, parameters = nil)
|
32
|
+
super
|
33
|
+
#~ @wiki = wiki
|
34
|
+
#~ @log = @wiki.log
|
35
|
+
par = parameters ? parameters.split(/;/) : []
|
36
|
+
case par.size
|
37
|
+
when 0
|
38
|
+
raise ParameterError, "Creole_structogramm: Missing parameters"
|
39
|
+
when 3
|
40
|
+
title = par[0]
|
41
|
+
x = par[1]
|
42
|
+
y = par[2]
|
43
|
+
@source = ''
|
44
|
+
@structogramm = Packages::Struktex::Structogramm.new( title, x, y, @source )
|
45
|
+
else
|
46
|
+
raise ParameterError, "Creole_structogramm: Wrong number of parameters: #{parameters.inspect}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
#Instance of class Structogramm.
|
50
|
+
attr_reader :structogramm
|
51
|
+
|
52
|
+
#Return content only for latex
|
53
|
+
def to_doc( target, options = {})
|
54
|
+
target == :latex ? @structogramm.to_doc( target, options ) : ''
|
55
|
+
end
|
56
|
+
end #Creole_latex
|
57
57
|
|
58
|
-
end #module Creole
|
58
|
+
end #module Creole
|
59
59
|
end #module Docgenerator
|
@@ -10,6 +10,12 @@ Classes to provide support for the todonotes-package.
|
|
10
10
|
=end
|
11
11
|
module Todo
|
12
12
|
|
13
|
+
class Creole_todolist < Creole_inclusion_and_plugin
|
14
|
+
set_plugin_key('listoftodos') #use <<todo|..>>
|
15
|
+
def to_doc(target, options = {})
|
16
|
+
element(:listoftodos, options).to_doc(target, options)
|
17
|
+
end
|
18
|
+
end
|
13
19
|
=begin rdoc
|
14
20
|
Define a plugin for the todonotes-package.
|
15
21
|
=end
|
@@ -47,6 +53,7 @@ Usage:
|
|
47
53
|
element(:todo, @options, @description).to_doc(target, options)
|
48
54
|
end
|
49
55
|
end #Creole_todo
|
56
|
+
|
50
57
|
=begin rdoc
|
51
58
|
A variant of Creole_todo with green color.
|
52
59
|
=end
|
@@ -62,7 +69,7 @@ A variant of Creole_todo with inline-layout.
|
|
62
69
|
class Creole_todo_inline < Creole_todo
|
63
70
|
set_plugin_key('todo_inline') #use <<todo_inline|..>>
|
64
71
|
#define default options for todonotes. may be redefined for children of this class.
|
65
|
-
def default_options; {:
|
72
|
+
def default_options; {:inline => true}; end
|
66
73
|
end
|
67
74
|
|
68
75
|
end #module Todo
|