docgenerator 0.1.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/docgenerator_example.rb +76 -160
- data/examples/docgenerator_example_footnote.rb +98 -0
- data/examples/docgenerator_example_list.rb +62 -0
- data/examples/docgenerator_example_restrictions.rb +59 -0
- data/examples/docgenerator_example_tabular.rb +68 -0
- data/examples/docgenerator_example_tripfalls.rb +57 -0
- data/examples/wiki2docgenerator_example.rb +270 -0
- data/lib/docgenerator.rb +159 -0
- data/{docgenerator_attribute.rb → lib/docgenerator_attribute.rb} +32 -7
- data/{docgenerator_characters.rb → lib/docgenerator_characters.rb} +15 -0
- data/{docgenerator_css.rb → lib/docgenerator_css.rb} +6 -1
- data/{docgenerator_document.rb → lib/docgenerator_document.rb} +92 -93
- data/{docgenerator_element.rb → lib/docgenerator_element.rb} +125 -51
- data/{docgenerator_elements.rb → lib/docgenerator_elements.rb} +40 -56
- data/{docgenerator_environments.rb → lib/docgenerator_environments.rb} +16 -10
- data/{docgenerator_footnote.rb → lib/docgenerator_footnote.rb} +44 -22
- data/{docgenerator_lists.rb → lib/docgenerator_lists.rb} +44 -39
- data/{docgenerator_sections.rb → lib/docgenerator_sections.rb} +2 -2
- data/{docgenerator_tabular.rb → lib/docgenerator_tabular.rb} +71 -39
- data/{packages → lib/packages}/docgenerator_attachfile.rb +0 -0
- data/{packages → lib/packages}/docgenerator_caption.rb +0 -0
- data/{packages → lib/packages}/docgenerator_hyperref.rb +0 -0
- data/{packages → lib/packages}/docgenerator_listings.rb +1 -2
- data/{packages → lib/packages}/docgenerator_pdfpages.rb +0 -0
- data/{packages → lib/packages}/docgenerator_scrlettr2.rb +2 -2
- data/{packages → lib/packages}/docgenerator_scrpage2.rb +0 -0
- data/{packages → lib/packages}/docgenerator_url.rb +0 -0
- data/lib/templates/docgenerator_template.rb +176 -0
- data/lib/templates/docgenerator_template.yaml +105 -0
- data/lib/wiki2doc/wiki2docgenerator.rb +1161 -0
- data/self_docgenerator.rb +161 -0
- data/unittest/expected/test_beamer_note.html +1 -0
- data/unittest/expected/test_beamer_note.latex +1 -0
- data/unittest/expected/test_beamer_note.text +1 -0
- data/unittest/expected/test_beamer_note.wiki +1 -0
- data/unittest/expected/test_block.html +1 -0
- data/unittest/expected/test_block.latex +1 -0
- data/unittest/expected/test_block.text +1 -0
- data/unittest/expected/test_block.wiki +2 -0
- data/unittest/expected/test_css.css +1 -0
- data/unittest/expected/test_css2.css +1 -0
- data/unittest/expected/test_description.html +1 -0
- data/unittest/expected/test_description.latex +3 -0
- data/unittest/expected/test_description.text +3 -0
- data/unittest/expected/test_description.wiki +3 -0
- data/unittest/expected/test_document_article.latex +23 -0
- data/unittest/expected/test_document_html.html +14 -0
- data/unittest/expected/test_document_replacement_article.latex +23 -0
- data/unittest/expected/test_document_replacement_html.html +14 -0
- data/unittest/expected/test_document_replacement_text.text +5 -0
- data/unittest/expected/test_document_replacement_wiki.wiki +5 -0
- data/unittest/expected/test_document_text.text +5 -0
- data/unittest/expected/test_document_wiki.wiki +5 -0
- data/unittest/expected/test_enumerate.html +1 -0
- data/unittest/expected/test_enumerate.latex +3 -0
- data/unittest/expected/test_enumerate.text +1 -0
- data/unittest/expected/test_enumerate.wiki +2 -0
- data/unittest/expected/test_footnote.html +5 -0
- data/unittest/expected/test_footnote.latex +11 -0
- data/unittest/expected/test_footnote.text +13 -0
- data/unittest/expected/test_footnote.wiki +11 -0
- data/unittest/expected/test_footnote_group.html +8 -0
- data/unittest/expected/test_footnote_group.latex +17 -0
- data/unittest/expected/test_footnote_group.wiki +17 -0
- data/unittest/expected/test_href.html +2 -0
- data/unittest/expected/test_href.latex +8 -0
- data/unittest/expected/test_href.text +4 -0
- data/unittest/expected/test_html_css.html +1 -0
- data/unittest/expected/test_itemize.html +1 -0
- data/unittest/expected/test_itemize.latex +3 -0
- data/unittest/expected/test_itemize.text +1 -0
- data/unittest/expected/test_itemize.wiki +2 -0
- data/unittest/expected/test_section.html +8 -0
- data/unittest/expected/test_section.latex +20 -0
- data/unittest/expected/test_section.text +24 -0
- data/unittest/expected/test_section.wiki +20 -0
- data/unittest/expected/test_tabular.html +10 -0
- data/unittest/expected/test_tabular.latex +10 -0
- data/unittest/expected/test_tabular.wiki +31 -0
- data/unittest/expected/test_tabular_doc.latex +22 -0
- data/unittest/expected/test_wiki.html +6 -0
- data/unittest/expected/test_wiki.latex +12 -0
- data/unittest/expected/test_wiki.text +14 -0
- data/unittest/expected/test_wiki.wiki +12 -0
- data/unittest/expected/test_wiki_amazon.html +10 -0
- data/unittest/expected/test_wiki_description.html +7 -0
- data/unittest/expected/test_wiki_description.latex +11 -0
- data/unittest/expected/test_wiki_description.text +6 -0
- data/unittest/expected/test_wiki_description.wiki +6 -0
- data/unittest/expected/test_wiki_footnote.html +8 -0
- data/unittest/expected/test_wiki_footnote.latex +15 -0
- data/unittest/expected/test_wiki_footnote.text +12 -0
- data/unittest/expected/test_wiki_footnote.wiki +12 -0
- data/unittest/expected/test_wiki_footnote_groupid.html +21 -0
- data/unittest/expected/test_wiki_html_code.html +7 -0
- data/unittest/expected/test_wiki_html_code.latex +10 -0
- data/unittest/expected/test_wiki_html_code.text +6 -0
- data/unittest/expected/test_wiki_html_code.wiki +6 -0
- data/unittest/expected/test_wiki_inline.html +6 -0
- data/unittest/expected/test_wiki_inline.latex +12 -0
- data/unittest/expected/test_wiki_inline.text +8 -0
- data/unittest/expected/test_wiki_inline.wiki +8 -0
- data/unittest/expected/test_wiki_label.html +6 -0
- data/unittest/expected/test_wiki_link.html +8 -0
- data/unittest/expected/test_wiki_link.latex +14 -0
- data/unittest/expected/test_wiki_link.log +3 -0
- data/unittest/expected/test_wiki_link.wiki +6 -0
- data/unittest/expected/test_wiki_list_ol.html +24 -0
- data/unittest/expected/test_wiki_list_ol.latex +30 -0
- data/unittest/expected/test_wiki_list_ol.text +10 -0
- data/unittest/expected/test_wiki_list_ol.wiki +12 -0
- data/unittest/expected/test_wiki_list_ol_after_ul.html +16 -0
- data/unittest/expected/test_wiki_list_ol_after_ul.latex +24 -0
- data/unittest/expected/test_wiki_list_ol_after_ul.text +8 -0
- data/unittest/expected/test_wiki_list_ol_after_ul.wiki +10 -0
- data/unittest/expected/test_wiki_list_ol_ul.html +24 -0
- data/unittest/expected/test_wiki_list_ol_ul.latex +30 -0
- data/unittest/expected/test_wiki_list_ol_ul.text +10 -0
- data/unittest/expected/test_wiki_list_ol_ul.wiki +12 -0
- data/unittest/expected/test_wiki_list_ul.html +24 -0
- data/unittest/expected/test_wiki_list_ul.latex +30 -0
- data/unittest/expected/test_wiki_list_ul.text +10 -0
- data/unittest/expected/test_wiki_list_ul.wiki +12 -0
- data/unittest/expected/test_wiki_list_ul_too_much.html +39 -0
- data/unittest/expected/test_wiki_list_ul_too_much.latex +51 -0
- data/unittest/expected/test_wiki_list_ul_too_much.text +11 -0
- data/unittest/expected/test_wiki_list_ul_too_much.wiki +15 -0
- data/unittest/expected/test_wiki_picture.html +55 -0
- data/unittest/expected/test_wiki_picture.latex +76 -0
- data/unittest/expected/test_wiki_picture_thumb.html +5 -0
- data/unittest/expected/test_wiki_tab1.html +30 -0
- data/unittest/expected/test_wiki_tab1.latex +30 -0
- data/unittest/expected/test_wiki_tab1.wiki +29 -0
- data/unittest/expected/test_wiki_textformatting.html +7 -0
- data/unittest/expected/test_wiki_textformatting.latex +16 -0
- data/unittest/expected/test_wiki_textformatting.text +11 -0
- data/unittest/expected/test_wiki_textformatting.wiki +9 -0
- data/unittest/expected/test_wiki_toc.html +9 -0
- data/unittest/expected/test_wiki_toc.latex +18 -0
- data/unittest/expected/test_wiki_toc.text +21 -0
- data/unittest/expected/test_wiki_toc.wiki +18 -0
- data/unittest/expected/test_wiki_ul_multiple_line.html +18 -0
- data/unittest/expected/test_wiki_ul_multiple_line.latex +19 -0
- data/unittest/expected/test_wiki_ul_multiple_line.text +6 -0
- data/unittest/expected/test_wiki_ul_multiple_line.wiki +7 -0
- data/unittest/test_docgenerator.rb +85 -0
- data/unittest/unittest_docgenerator.rb +454 -0
- data/unittest/unittest_wiki2doc.rb +451 -0
- metadata +155 -31
- data/docgenerator.rb +0 -137
- data/docgenerator_template.rb +0 -103
- data/packages/docgenerator_beamer.rb +0 -250
@@ -1,185 +1,101 @@
|
|
1
|
-
#Create a test-document with docgenerator.rb.
|
2
1
|
#
|
3
|
-
#
|
4
|
-
#use most of the features of the tool.
|
2
|
+
#Create a test-document with docgenerator.rb.
|
5
3
|
#
|
6
|
-
#Start the tool and two documents
|
7
|
-
#- test.html and
|
8
|
-
#- test.tex
|
9
|
-
#are created.
|
10
4
|
|
11
5
|
#~ require 'rubygems'
|
12
6
|
$: << ".." #for local tests with uninstalled gem
|
13
7
|
require 'docgenerator'
|
14
|
-
with_error = false
|
15
|
-
#~ with_error = true #Include some "wrong" statements. You will get a message from docgenerator
|
16
|
-
|
17
|
-
##############
|
18
|
-
## Test
|
19
|
-
##############
|
20
|
-
puts '='*40
|
21
|
-
#~ puts Element.overview( [Element.get(:h1)] )
|
22
|
-
#~ puts Element.overview( [Title] )
|
23
|
-
#~ puts Element.overview( )
|
24
|
-
#~ puts '='*40
|
25
|
-
|
26
|
-
puts ">Create a test-document"
|
27
|
-
doc = Document.new()
|
28
|
-
doc.add_option('ngerman')
|
29
|
-
|
30
|
-
doc.head << element( :usepackage, { }, 'longtable' )
|
31
|
-
#~ doc.head << element( :usepackage, { :option => [] }, 'longtable' )
|
32
|
-
doc.head << element( :sepline ) #Separator line
|
33
|
-
|
34
|
-
|
35
|
-
#~ doc.head << element(:title, {}, 'Titel')
|
36
|
-
#~ doc.head << element(:author, {}, 'Authorname')
|
37
|
-
doc.title ='Titel'
|
38
|
-
doc.author = 'Authorname'
|
39
|
-
doc.date = 'Datum'
|
40
|
-
doc.keywords = 'Test, DocGenerator.rb'
|
41
|
-
doc.description = 'Testdokument f�r DocGenerator.rb'
|
42
|
-
|
43
|
-
doc.head << element(:meta, {:name => 'xxx', :content => 'inhalt' } )
|
44
|
-
if with_error
|
45
|
-
puts '!And at <save> an error: Meta-Tag without required attributes'
|
46
|
-
doc.head << element(:meta, {} )
|
47
|
-
end
|
48
|
-
|
49
|
-
doc.body << element(:maketitle)
|
50
|
-
doc.body[:lang] << 'de'
|
51
8
|
|
52
|
-
#
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
ul << element( :li, {}, 'Listitem 1' )
|
60
|
-
ul << element( :li, {}, 'Listitem 2' )
|
61
|
-
ul << element( :li, {}, 'Listitem 3' )
|
62
|
-
|
63
|
-
listen << element(:h2, {}, 'Nummerierte Liste')
|
64
|
-
listen << ol = element(:ol)
|
65
|
-
ol << element( :li, {}, 'Listitem 1' )
|
66
|
-
ol << element( :li, {}, 'Listitem 2' )
|
67
|
-
ol << element( :li, {}, 'Listitem 3' )
|
68
|
-
return listen
|
69
|
-
end
|
70
|
-
doc.body << listen
|
9
|
+
#
|
10
|
+
# Create a document
|
11
|
+
#
|
12
|
+
doc = Document.new(
|
13
|
+
:title => 'Testdocument for docgenerator.rb',
|
14
|
+
:language => 'english'
|
15
|
+
)
|
71
16
|
|
72
|
-
#
|
73
|
-
|
74
|
-
|
75
|
-
doc.
|
76
|
-
doc.
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
17
|
+
#
|
18
|
+
# Set some settings
|
19
|
+
#
|
20
|
+
#~ doc.title ='Titel'
|
21
|
+
#~ doc.author = 'Authorname'
|
22
|
+
#~ doc.date = 'Datum'
|
23
|
+
#~ doc.keywords = 'Test, DocGenerator.rb'
|
24
|
+
#~ doc.description = 'Testdokument f�r DocGenerator.rb'
|
81
25
|
|
82
|
-
|
83
|
-
doc.body << element(:h1, {}, 'Links und Verweise').cr
|
84
|
-
doc.body << element(:a, { :href => 'http://ruby.lickert.net/' }, 'Link zu meinen Skripten').cr
|
85
|
-
doc.body << element(:url,{}, 'http://ruby.lickert.net/')
|
26
|
+
#~ doc.add_option('ngerman')
|
86
27
|
|
28
|
+
#
|
29
|
+
doc.body << element(:maketitle) #Only LaTeX
|
30
|
+
doc.body[:lang] << 'de' #language flag for HTML
|
87
31
|
|
88
32
|
# ###############################
|
89
|
-
doc.body << element(:h1, {}, '
|
90
|
-
doc.body <<
|
33
|
+
doc.body << element(:h1, {}, 'Sections and paragraphs').cr
|
34
|
+
doc.body << element(:h2, {}, 'Paragraphs').cr
|
35
|
+
#
|
36
|
+
# Add content immediate
|
37
|
+
#
|
38
|
+
doc.body << element(:par, {}, 'This is a paragraph').cr
|
39
|
+
doc.body << element(:par, {}, [
|
40
|
+
'This is another paragraph.',
|
41
|
+
'This paragraph contains a second phrase',
|
42
|
+
]).cr
|
43
|
+
|
44
|
+
#
|
45
|
+
# Add content afterwords
|
46
|
+
#
|
47
|
+
doc.body << par = element(:par).cr
|
48
|
+
par << 'This is also a paragraph.'
|
49
|
+
par << 'This paragraph contains also second phrase'
|
50
|
+
|
51
|
+
|
52
|
+
doc.body << element(:h2, {}, 'Paragraphs with linebreaks').cr
|
53
|
+
doc.body << element(:par, {}, [ 'This is a paragraph with linebreaks',
|
54
|
+
element( :br ).cr, #Add a newline
|
55
|
+
'This is text after a linebreak',
|
56
|
+
element( :newline ).cr, #Add a newline
|
57
|
+
'Further text after another linebreak (newline in LaTeX)',
|
58
|
+
]).cr
|
59
|
+
|
91
60
|
|
92
|
-
doc.body.insertbefore( par, 'Einschub vor dem Absatz' )
|
93
|
-
doc.body.insertafter( par, 'Einschub nach dem Absatz' )
|
94
61
|
|
95
|
-
if with_error
|
96
|
-
puts "!And now an error: insertbefore with a non-existing target"
|
97
|
-
doc.body.insertbefore( 'a', 'Before List' )
|
98
|
-
end
|
99
62
|
|
100
63
|
# ###############################
|
101
|
-
doc.body << element(:h1, {}, '
|
102
|
-
columnnumber = 5
|
103
|
-
doc.body << tab = element(:tabular, {
|
104
|
-
:columns => columnnumber,
|
105
|
-
:columndescription => 'c' * columnnumber
|
106
|
-
} ).CR
|
107
|
-
|
108
|
-
tab << row = element( :row, {:add_vspace=>'1ex'} ).cr
|
109
|
-
row << element(:multicolumn, {
|
110
|
-
:columns => columnnumber,
|
111
|
-
:pos => 'c',
|
112
|
-
}, 'Titel' )
|
113
|
-
row.hline
|
114
|
-
|
115
|
-
'a'.upto('f'){|num|
|
116
|
-
tab << row = element( :row ).cr
|
117
|
-
1.upto(columnnumber){|letter|
|
118
|
-
row << element(:column, {}, "#{num}#{letter}" )
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
|
-
|
123
|
-
def footnote( )
|
124
|
-
txt = []
|
125
|
-
|
126
|
-
txt << element(:h1, {}, 'Fu�noten').cr
|
127
|
-
txt << element(:h2, {}, 'Standardfu�noten').cr
|
128
|
-
txt << 'a'
|
129
|
-
txt << f = element(:footnote,{}, 'eins')
|
130
|
-
txt << 'b'
|
131
|
-
txt << element(:footnote,{}, 'zwei')
|
132
|
-
txt << ' nochmal erste Fu�note'
|
133
|
-
txt << f
|
134
|
-
txt << 'z'
|
135
|
-
|
136
|
-
txt << element(:h2, {}, 'Fu�noten in eigener Gruppe 1').cr
|
137
|
-
txt << 'a'
|
138
|
-
txt << f = element(:footnote,{:groupid=>1}, 'Fu�note eins/Gruppe 1')
|
139
|
-
txt << 'b'
|
140
|
-
txt << element(:footnote,{:groupid=>1}, 'Fu�note zwei/Gruppe 1')
|
141
|
-
txt << 'c'
|
142
|
-
txt << f
|
143
|
-
txt << 'z'
|
144
|
-
|
145
|
-
txt << element(:h2, {}, 'Fortsetzung').cr
|
146
|
-
txt << 'a'
|
147
|
-
txt << f = element(:footnote,{}, 'drei')
|
148
|
-
txt << 'b'
|
149
|
-
txt << element(:footnote,{}, 'vier')
|
150
|
-
txt << 'c'
|
151
|
-
txt << f
|
152
|
-
txt << 'z'
|
153
|
-
|
154
|
-
txt << element(:hr).cr
|
155
|
-
Footnotegroup.get.attr={:style=>'font-size: smaller'}
|
156
|
-
txt << Footnotegroup.get()
|
157
|
-
txt << element(:hr)
|
158
|
-
Footnotegroup.get( 1 ).html_link = false #Footnote are not linked
|
159
|
-
txt << Footnotegroup.get(1)
|
160
|
-
return txt
|
161
|
-
end
|
162
|
-
doc.body << footnote
|
163
|
-
|
164
|
-
# ##############
|
165
|
-
#~ Element.log = true #Write Errors to stdout
|
166
|
-
#~ doc.save( 'test.html', true )
|
64
|
+
doc.body << element(:h1, {}, 'Specific content').cr
|
167
65
|
|
168
|
-
doc.body << element(:
|
169
|
-
doc.body
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
66
|
+
doc.body << element(:h2, {}, 'Formatting').cr
|
67
|
+
doc.body << element(:par, {}, [
|
68
|
+
'This is normal text, ',
|
69
|
+
element(:textbf, {}, 'this is bold, '),
|
70
|
+
element(:emph, {}, 'this is emphasized.'),
|
71
|
+
]).cr
|
72
|
+
|
73
|
+
|
74
|
+
doc.body << element(:h2, {}, 'Links and URLs').cr
|
75
|
+
doc.body << element(:par,{}, [
|
76
|
+
element(:url,{}, 'http://ruby.lickert.net/').cr,
|
77
|
+
element(:a, { :href => 'http://ruby.lickert.net/' }, 'Link zu meinen Skripten').cr,
|
78
|
+
]).cr
|
174
79
|
|
175
80
|
|
176
81
|
# ###############################
|
177
|
-
doc.body << element(:h1, {}, '
|
82
|
+
doc.body << element(:h1, {}, 'Insert content').cr
|
83
|
+
doc.body << par = element(:par, {}, 'This is a paragraph')
|
84
|
+
|
85
|
+
doc.body.insertbefore( par, 'This is inserted before the paragraph.' )
|
86
|
+
doc.body.insertafter( par, 'This is inserted after the paragraph.' )
|
87
|
+
|
88
|
+
#
|
89
|
+
# This would give yo an error
|
90
|
+
#
|
91
|
+
#~ puts "!And now an error: insertbefore with a non-existing target"
|
92
|
+
#~ doc.body.insertbefore( 'a', 'Before List' )
|
178
93
|
|
179
94
|
# ###############################
|
180
|
-
|
95
|
+
# �Save the files
|
96
|
+
# ###############
|
181
97
|
|
182
98
|
#~ Element.log = true #Write Errors to stdout
|
183
|
-
doc.save(
|
99
|
+
doc.save( __FILE__.sub(/\.rb/, ".html"), true )
|
184
100
|
doc.runtex = true
|
185
|
-
doc.save(
|
101
|
+
doc.save( __FILE__.sub(/\.rb/, ".tex"), true )
|
@@ -0,0 +1,98 @@
|
|
1
|
+
#
|
2
|
+
#Create a test-document with docgenerator.rb.
|
3
|
+
#
|
4
|
+
|
5
|
+
#~ require 'rubygems'
|
6
|
+
$: << ".." #for local tests with uninstalled gem
|
7
|
+
require 'docgenerator'
|
8
|
+
|
9
|
+
#
|
10
|
+
# Create a document
|
11
|
+
#
|
12
|
+
doc = Document.new(
|
13
|
+
:title => 'Testdocument with tabulars'
|
14
|
+
)
|
15
|
+
|
16
|
+
#~ doc.head << element( :usepackage, { }, 'longtable' )
|
17
|
+
#~ doc.head << element( :usepackage, { :option => [] }, 'longtable' )
|
18
|
+
|
19
|
+
#
|
20
|
+
# Set some settings
|
21
|
+
#
|
22
|
+
#~ doc.title ='Titel'
|
23
|
+
#~ doc.author = 'Authorname'
|
24
|
+
#~ doc.date = 'Datum'
|
25
|
+
#~ doc.keywords = 'Test, DocGenerator.rb'
|
26
|
+
#~ doc.description = 'Testdokument f�r DocGenerator.rb'
|
27
|
+
|
28
|
+
#
|
29
|
+
doc.body << element(:maketitle) #Only LaTeX
|
30
|
+
doc.body[:lang] << 'de' #language flag for HTML
|
31
|
+
|
32
|
+
doc.body << element(:h1, {}, 'Normal Footnotes').cr
|
33
|
+
|
34
|
+
doc.body << element(:h2, {}, 'Standardfu�noten').cr
|
35
|
+
doc.body << 'a'
|
36
|
+
doc.body << f = element(:footnote,{}, 'one')
|
37
|
+
doc.body << 'b'
|
38
|
+
doc.body << element(:footnote,{}, 'two')
|
39
|
+
doc.body << ' nochmal erste Fu�note'
|
40
|
+
doc.body << f
|
41
|
+
doc.body << 'z'
|
42
|
+
|
43
|
+
|
44
|
+
doc.body << element(:h1, {}, 'Footnotes in their own groups (only HTML)').cr
|
45
|
+
doc.body << element(:h2, {}, 'Footnotes in a Group 1').cr
|
46
|
+
doc.body << 'a'
|
47
|
+
doc.body << f = element(:footnote,{:groupid=>1}, 'Footnote one/Group 1')
|
48
|
+
doc.body << 'b'
|
49
|
+
doc.body << element(:footnote,{:groupid=>1}, 'Footnote two/Group 1')
|
50
|
+
doc.body << 'c'
|
51
|
+
doc.body << f
|
52
|
+
doc.body << 'z'
|
53
|
+
|
54
|
+
doc.body << element(:h3, {}, 'Footnotes of the Group 1').cr
|
55
|
+
Footnotegroup.get(1).attr={:style=>'font-size: smaller'}
|
56
|
+
doc.body << Footnotegroup.get(1)
|
57
|
+
|
58
|
+
doc.body << element(:h2, {}, 'Footnotes in a Group 2').cr
|
59
|
+
doc.body << 'a'
|
60
|
+
doc.body << f = element(:footnote,{:groupid=>2}, 'Footnote one/Group 2')
|
61
|
+
doc.body << 'b'
|
62
|
+
doc.body << element(:footnote,{:groupid=>2}, 'Footnote two/Group 2')
|
63
|
+
doc.body << 'c'
|
64
|
+
doc.body << f
|
65
|
+
doc.body << 'z'
|
66
|
+
|
67
|
+
doc.body << element(:h3, {}, 'Footnotes of the Group 2 - without links').cr
|
68
|
+
Footnotegroup.get( 2 ).html_link = false #Footnote are not linked
|
69
|
+
Footnotegroup.get(2).attr={:style=>'font-size: smaller'}
|
70
|
+
doc.body << Footnotegroup.get(2)
|
71
|
+
|
72
|
+
|
73
|
+
doc.body << element(:h1, {}, 'Normal Footnotes - Continued').cr
|
74
|
+
doc.body << 'a'
|
75
|
+
doc.body << f = element(:footnote,{}, 'three')
|
76
|
+
doc.body << 'b'
|
77
|
+
doc.body << element(:footnote,{}, 'four')
|
78
|
+
doc.body << 'c'
|
79
|
+
doc.body << f
|
80
|
+
doc.body << 'z'
|
81
|
+
|
82
|
+
|
83
|
+
doc.body << element(:hr).cr
|
84
|
+
doc.body << element(:h1, {}, 'Footnotes').cr
|
85
|
+
Footnotegroup.get.attr={:style=>'font-size: smaller'}
|
86
|
+
doc.body << Footnotegroup.get()
|
87
|
+
doc.body << element(:hr)
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
# ###############################
|
92
|
+
# �Save the files
|
93
|
+
# ###############
|
94
|
+
|
95
|
+
#~ Element.log = true #Write Errors to stdout
|
96
|
+
doc.save( __FILE__.sub(/\.rb/, ".html"), true )
|
97
|
+
doc.runtex = true
|
98
|
+
doc.save( __FILE__.sub(/\.rb/, ".tex"), true )
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#
|
2
|
+
#Create a test-document with docgenerator.rb.
|
3
|
+
#
|
4
|
+
|
5
|
+
#~ require 'rubygems'
|
6
|
+
$: << ".." #for local tests with uninstalled gem
|
7
|
+
require 'docgenerator'
|
8
|
+
|
9
|
+
#
|
10
|
+
# Create a document
|
11
|
+
#
|
12
|
+
doc = Document.new(
|
13
|
+
:title => 'Testdocument with lists'
|
14
|
+
)
|
15
|
+
|
16
|
+
#
|
17
|
+
# Set some settings
|
18
|
+
#
|
19
|
+
#~ doc.title ='Titel'
|
20
|
+
#~ doc.author = 'Authorname'
|
21
|
+
#~ doc.date = 'Datum'
|
22
|
+
#~ doc.keywords = 'Test, DocGenerator.rb'
|
23
|
+
#~ doc.description = 'Testdokument f�r DocGenerator.rb'
|
24
|
+
|
25
|
+
#
|
26
|
+
doc.body << element(:maketitle) #Only LaTeX
|
27
|
+
doc.body[:lang] << 'de' #language flag for HTML
|
28
|
+
|
29
|
+
doc.body << element(:h1, {}, 'Listen')
|
30
|
+
|
31
|
+
doc.body << element(:h2, {}, 'Unnummerierte Liste')
|
32
|
+
doc.body << ul = element(:ul)
|
33
|
+
ul << element( :li, {}, 'Listitem 1' )
|
34
|
+
ul << element( :li, {}, 'Listitem 2' )
|
35
|
+
ul << element( :li, {}, 'Listitem 3' )
|
36
|
+
|
37
|
+
|
38
|
+
doc.body << itemize = element(:itemize)
|
39
|
+
itemize << element( :item, {}, 'Listitem 1' )
|
40
|
+
itemize << element( :item, {}, 'Listitem 2' )
|
41
|
+
itemize << element( :item, {}, 'Listitem 3' )
|
42
|
+
|
43
|
+
|
44
|
+
doc.body << element(:h2, {}, 'Nummerierte Liste')
|
45
|
+
doc.body << ol = element(:ol)
|
46
|
+
ol << element( :li, {}, 'Listitem 1' )
|
47
|
+
ol << element( :li, {}, 'Listitem 2' )
|
48
|
+
ol << element( :li, {}, 'Listitem 3' )
|
49
|
+
|
50
|
+
doc.body << enumerate = element(:enumerate)
|
51
|
+
enumerate << element( :item, {}, 'Listitem 1' )
|
52
|
+
enumerate << element( :item, {}, 'Listitem 2' )
|
53
|
+
enumerate << element( :item, {}, 'Listitem 3' )
|
54
|
+
|
55
|
+
# ###############################
|
56
|
+
# �Save the files
|
57
|
+
# ###############
|
58
|
+
|
59
|
+
#~ Element.log = true #Write Errors to stdout
|
60
|
+
doc.save( __FILE__.sub(/\.rb/, ".html"), true )
|
61
|
+
doc.runtex = true
|
62
|
+
doc.save( __FILE__.sub(/\.rb/, ".tex"), true )
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#
|
2
|
+
#Create a test-document with docgenerator.rb.
|
3
|
+
#
|
4
|
+
|
5
|
+
#~ require 'rubygems'
|
6
|
+
$: << ".." #for local tests with uninstalled gem
|
7
|
+
require 'docgenerator'
|
8
|
+
|
9
|
+
#
|
10
|
+
# Create a document
|
11
|
+
#
|
12
|
+
doc = Document.new(
|
13
|
+
:title => 'Testdocument with retsrictions to output format'
|
14
|
+
)
|
15
|
+
|
16
|
+
#~ doc.head << element( :usepackage, { }, 'longtable' )
|
17
|
+
#~ doc.head << element( :usepackage, { :option => [] }, 'longtable' )
|
18
|
+
|
19
|
+
#
|
20
|
+
# Set some settings
|
21
|
+
#
|
22
|
+
#~ doc.title ='Titel'
|
23
|
+
#~ doc.author = 'Authorname'
|
24
|
+
#~ doc.date = 'Datum'
|
25
|
+
#~ doc.keywords = 'Test, DocGenerator.rb'
|
26
|
+
#~ doc.description = 'Testdokument f�r DocGenerator.rb'
|
27
|
+
|
28
|
+
#
|
29
|
+
doc.body << element(:maketitle) #Only LaTeX
|
30
|
+
doc.body[:lang] << 'en' #language flag for HTML
|
31
|
+
|
32
|
+
doc.body << element(:h1, {}, 'Restrict to different Output formats').cr
|
33
|
+
doc.body << element(:p, {}, <<txt
|
34
|
+
When you create simultanous output to LaTeX and HTML, perhaps you need some parts only in one output document.
|
35
|
+
txt
|
36
|
+
)
|
37
|
+
|
38
|
+
doc.body << element(:h2, {}, 'Content only in HTML').cr
|
39
|
+
doc.body << element(:p, {}, 'Only in HTML').restrict_to(:html)
|
40
|
+
doc.body << element(:htmlonly, {}, 'Only in HTML')
|
41
|
+
|
42
|
+
doc.body << element(:h2, {}, 'Content only in LaTeX').cr
|
43
|
+
doc.body << element(:p, {}, 'Only in LaTeX').restrict_to(:latex)
|
44
|
+
doc.body << element(:latexonly, {}, 'Only in LaTeX')
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
# ###############################
|
53
|
+
# �Save the files
|
54
|
+
# ###############
|
55
|
+
|
56
|
+
#~ Element.log = true #Write Errors to stdout
|
57
|
+
doc.save( __FILE__.sub(/\.rb/, ".html"), true )
|
58
|
+
doc.runtex = true
|
59
|
+
doc.save( __FILE__.sub(/\.rb/, ".tex"), true )
|