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
@@ -1,29 +1,47 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
=begin rdoc
|
2
|
+
Create a test-document with docgenerator.rb.
|
3
|
+
|
4
|
+
Result see
|
5
|
+
* examples/results_expected/docgenerator_example.html
|
6
|
+
* examples/results_expected/docgenerator_example.tex
|
7
|
+
* examples/results_expected/docgenerator_example.pdf
|
8
|
+
=end
|
4
9
|
|
5
|
-
|
6
|
-
|
10
|
+
require 'rubygems'
|
11
|
+
$:.unshift("../lib") #for local tests with uninstalled gem
|
7
12
|
require 'docgenerator'
|
13
|
+
begin
|
14
|
+
require 'rake4latex_pdflatex'
|
15
|
+
rescue LoadError
|
16
|
+
puts "rake4latex not installed -> no translation of LaTeX-file"
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# Move all results to anothe folder
|
21
|
+
#
|
22
|
+
Dir.chdir('results')
|
8
23
|
|
9
24
|
#
|
10
25
|
# Create a document
|
11
26
|
#
|
12
27
|
doc = Document.new(
|
13
28
|
:title => 'Testdocument for docgenerator.rb',
|
14
|
-
:language => 'english'
|
29
|
+
:language => 'english',
|
30
|
+
:author => 'Authorname',
|
31
|
+
:date => 'Datum',
|
32
|
+
:keywords => 'Test, docgenerator.rb',
|
33
|
+
:description => 'Testdocument for docgenerator.rb'
|
15
34
|
)
|
16
35
|
|
17
36
|
#
|
18
|
-
#
|
19
|
-
#
|
37
|
+
# Alternative psooibility to define settings:
|
20
38
|
#~ doc.title ='Titel'
|
21
39
|
#~ doc.author = 'Authorname'
|
22
40
|
#~ doc.date = 'Datum'
|
23
41
|
#~ doc.keywords = 'Test, DocGenerator.rb'
|
24
|
-
#~ doc.description = 'Testdokument
|
42
|
+
#~ doc.description = 'Testdokument for DocGenerator.rb'
|
25
43
|
|
26
|
-
|
44
|
+
doc.add_option('ngerman')
|
27
45
|
|
28
46
|
#
|
29
47
|
doc.body << element(:maketitle) #Only LaTeX
|
@@ -74,7 +92,7 @@ doc.body << element(:par, {}, [
|
|
74
92
|
doc.body << element(:h2, {}, 'Links and URLs').cr
|
75
93
|
doc.body << element(:par,{}, [
|
76
94
|
element(:url,{}, 'http://ruby.lickert.net/').cr,
|
77
|
-
element(:a, { :href => 'http://ruby.lickert.net/' }, '
|
95
|
+
element(:a, { :href => 'http://ruby.lickert.net/' }, 'link to my scripts').cr,
|
78
96
|
]).cr
|
79
97
|
|
80
98
|
|
@@ -92,10 +110,9 @@ doc.body.insertafter( par, 'This is inserted after the paragraph.' )
|
|
92
110
|
#~ doc.body.insertbefore( 'a', 'Before List' )
|
93
111
|
|
94
112
|
# ###############################
|
95
|
-
#
|
113
|
+
# Save the files
|
96
114
|
# ###############
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
doc.save( __FILE__.sub(/\.rb/, ".tex"), true )
|
115
|
+
doc.save( __FILE__.sub(/\.rb/, ".html"))
|
116
|
+
doc.save( __FILE__.sub(/\.rb/, ".tex"),
|
117
|
+
:runtex => [:statistic, :clean]
|
118
|
+
)
|
@@ -1,98 +1,119 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
=begin rdoc
|
2
|
+
Create a test-document with docgenerator.rb.
|
3
|
+
|
4
|
+
Result see
|
5
|
+
* examples/results_expected/docgenerator_example_footnote.html
|
6
|
+
* examples/results_expected/docgenerator_example_footnote.tex
|
7
|
+
* examples/results_expected/docgenerator_example_footnote.pdf
|
8
|
+
|
9
|
+
link:examples/results_expected/docgenerator_example_footnote.pdf
|
4
10
|
|
5
|
-
|
6
|
-
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
$:.unshift("../lib") #for local tests with uninstalled gem
|
7
15
|
require 'docgenerator'
|
16
|
+
begin
|
17
|
+
require 'rake4latex_pdflatex'
|
18
|
+
rescue LoadError
|
19
|
+
puts "rake4latex not installed -> no translation of LaTeX-file"
|
20
|
+
end
|
8
21
|
|
22
|
+
#
|
23
|
+
# Move all results to anothe folder
|
24
|
+
#
|
25
|
+
Dir.chdir('results')
|
9
26
|
#
|
10
27
|
# Create a document
|
11
28
|
#
|
12
29
|
doc = Document.new(
|
13
|
-
:title => 'Testdocument with
|
30
|
+
:title => 'Testdocument with footnotes'
|
14
31
|
)
|
15
32
|
|
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
33
|
|
28
34
|
#
|
29
35
|
doc.body << element(:maketitle) #Only LaTeX
|
30
36
|
doc.body[:lang] << 'de' #language flag for HTML
|
31
37
|
|
32
|
-
doc.body << element(:h1, {}, '
|
38
|
+
doc.body << element(:h1, {}, 'Standard Footnotes').cr
|
33
39
|
|
34
|
-
doc.body << element(:h2, {}, '
|
35
|
-
doc.body << '
|
36
|
-
doc.body <<
|
37
|
-
doc.body << '
|
40
|
+
doc.body << element(:h2, {}, 'Standard footnote').cr
|
41
|
+
doc.body << 'Some text in front'
|
42
|
+
doc.body << foot1 = element(:footnote,{}, 'one')
|
43
|
+
doc.body << 'and some text between.'
|
38
44
|
doc.body << element(:footnote,{}, 'two')
|
39
|
-
doc.body << '
|
40
|
-
doc.body <<
|
41
|
-
doc.body << '
|
45
|
+
doc.body << ' repeat first footnote'
|
46
|
+
doc.body << foot1 #makes not really sense, but it is possible
|
47
|
+
doc.body << ' and finish the text.'
|
42
48
|
|
49
|
+
=begin
|
50
|
+
Grouped footnotes (only HTML)
|
43
51
|
|
52
|
+
For LaTeX ledmac, manyfoot or bigfoot could be a solution.
|
53
|
+
But yet, there is no support for it.
|
54
|
+
=end
|
44
55
|
doc.body << element(:h1, {}, 'Footnotes in their own groups (only HTML)').cr
|
45
|
-
doc.body << element(:
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
56
|
+
doc.body << element(:par, {}, 'Footnote groups not supported for LaTeX.').cr
|
57
|
+
|
58
|
+
footnotegroup1 = Footnotegroup.new('g1')
|
59
|
+
footnotegroup1.attr={:style=>'font-size: smaller'}
|
60
|
+
|
61
|
+
footnotegroup2 = Footnotegroup.new('g2')
|
62
|
+
footnotegroup2.attr={:style=>'font-size: smaller'}
|
63
|
+
footnotegroup2.html_link = false #Footnotes are not linked
|
64
|
+
|
65
|
+
###############################
|
66
|
+
doc.body << element(:h2, {}, 'Footnotes in Group 1').cr
|
67
|
+
doc.body << 'Some text in front'
|
68
|
+
doc.body << f = element(:footnote,{:group => footnotegroup1}, 'Footnote one/Group 1')
|
69
|
+
doc.body << 'and some text between.'
|
70
|
+
doc.body << element(:footnote,{:group => footnotegroup1}, 'Footnote two/Group 1')
|
71
|
+
doc.body << ' repeat first footnote'
|
51
72
|
doc.body << f
|
52
|
-
doc.body << '
|
73
|
+
doc.body << ' and finish the text.'
|
53
74
|
|
54
75
|
doc.body << element(:h3, {}, 'Footnotes of the Group 1').cr
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
doc.body << element(:h2, {}, 'Footnotes in
|
59
|
-
doc.body << '
|
60
|
-
doc.body << f = element(:footnote,{:
|
61
|
-
doc.body << '
|
62
|
-
doc.body << element(:footnote,{:
|
63
|
-
doc.body << '
|
76
|
+
doc.body << footnotegroup1 #makes no sense for LaTeX
|
77
|
+
|
78
|
+
###############################
|
79
|
+
doc.body << element(:h2, {}, 'Footnotes in Group 2').cr
|
80
|
+
doc.body << 'Some text in front'
|
81
|
+
doc.body << f = element(:footnote,{:group=>footnotegroup2}, 'Footnote one/Group 2')
|
82
|
+
doc.body << 'and some text between.'
|
83
|
+
doc.body << element(:footnote,{:group=>footnotegroup2}, 'Footnote two/Group 2')
|
84
|
+
doc.body << ' repeat first footnote'
|
64
85
|
doc.body << f
|
65
|
-
doc.body << '
|
86
|
+
doc.body << ' and finish the text.'
|
66
87
|
|
67
88
|
doc.body << element(:h3, {}, 'Footnotes of the Group 2 - without links').cr
|
68
|
-
|
69
|
-
Footnotegroup.get(2).attr={:style=>'font-size: smaller'}
|
70
|
-
doc.body << Footnotegroup.get(2)
|
89
|
+
doc.body << footnotegroup2 #makes no sense for LaTeX
|
71
90
|
|
72
|
-
|
73
|
-
doc.body << element(:h1, {}, '
|
74
|
-
doc.body << '
|
91
|
+
###############################
|
92
|
+
doc.body << element(:h1, {}, 'Standard Footnotes - Continued').cr
|
93
|
+
doc.body << 'Some text in front'
|
75
94
|
doc.body << f = element(:footnote,{}, 'three')
|
76
|
-
doc.body << '
|
95
|
+
doc.body << 'and some text between.'
|
77
96
|
doc.body << element(:footnote,{}, 'four')
|
78
|
-
doc.body << '
|
97
|
+
doc.body << ' repeat first footnote'
|
79
98
|
doc.body << f
|
80
|
-
doc.body << '
|
99
|
+
doc.body << ' and finish the text.'
|
81
100
|
|
82
101
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
doc.body <<
|
102
|
+
=begin
|
103
|
+
Back to standard footnotes
|
104
|
+
=end
|
105
|
+
doc.body << element(:h2, {}, 'Print Footnotes').cr
|
106
|
+
doc.body << element(:par, {}, 'makes only sense in HTML. LaTeX has it''s own output routine for footnotes.').cr
|
107
|
+
Footnotegroup[].attr={:style=>'font-size: smaller'}
|
108
|
+
doc.body << Footnotegroup[] #makes no sense for LaTeX
|
87
109
|
doc.body << element(:hr)
|
88
110
|
|
89
111
|
|
90
112
|
|
91
113
|
# ###############################
|
92
|
-
#
|
114
|
+
# Save the files
|
93
115
|
# ###############
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
doc.save( __FILE__.sub(/\.rb/, ".tex"), true )
|
116
|
+
doc.save( __FILE__.sub(/\.rb/, ".html"))
|
117
|
+
doc.save( __FILE__.sub(/\.rb/, ".tex"),
|
118
|
+
:runtex => [:statistic, :clean]
|
119
|
+
)
|
@@ -2,9 +2,19 @@
|
|
2
2
|
#Create a test-document with docgenerator.rb.
|
3
3
|
#
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
require 'rubygems'
|
6
|
+
$:.unshift("../lib") #for local tests with uninstalled gem
|
7
7
|
require 'docgenerator'
|
8
|
+
begin
|
9
|
+
require 'rake4latex_pdflatex'
|
10
|
+
rescue LoadError
|
11
|
+
puts "rake4latex not installed -> no translation of LaTeX-file"
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# Move all results to anothe folder
|
16
|
+
#
|
17
|
+
Dir.chdir('results')
|
8
18
|
|
9
19
|
#
|
10
20
|
# Create a document
|
@@ -13,27 +23,20 @@ doc = Document.new(
|
|
13
23
|
:title => 'Testdocument with lists'
|
14
24
|
)
|
15
25
|
|
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
26
|
|
25
27
|
#
|
26
28
|
doc.body << element(:maketitle) #Only LaTeX
|
27
29
|
doc.body[:lang] << 'de' #language flag for HTML
|
28
30
|
|
29
|
-
doc.body << element(:h1, {}, '
|
31
|
+
doc.body << element(:h1, {}, 'Lists')
|
30
32
|
|
31
|
-
doc.body << element(:h2, {}, '
|
33
|
+
doc.body << element(:h2, {}, 'Unnumbered Lists')
|
32
34
|
doc.body << ul = element(:ul)
|
33
35
|
ul << element( :li, {}, 'Listitem 1' )
|
34
36
|
ul << element( :li, {}, 'Listitem 2' )
|
35
37
|
ul << element( :li, {}, 'Listitem 3' )
|
36
38
|
|
39
|
+
doc.body << element(:par,{}, 'Next list')
|
37
40
|
|
38
41
|
doc.body << itemize = element(:itemize)
|
39
42
|
itemize << element( :item, {}, 'Listitem 1' )
|
@@ -41,22 +44,25 @@ itemize << element( :item, {}, 'Listitem 2' )
|
|
41
44
|
itemize << element( :item, {}, 'Listitem 3' )
|
42
45
|
|
43
46
|
|
44
|
-
doc.body << element(:h2, {}, '
|
47
|
+
doc.body << element(:h2, {}, 'Numbered Lists')
|
45
48
|
doc.body << ol = element(:ol)
|
46
49
|
ol << element( :li, {}, 'Listitem 1' )
|
47
50
|
ol << element( :li, {}, 'Listitem 2' )
|
48
51
|
ol << element( :li, {}, 'Listitem 3' )
|
49
52
|
|
53
|
+
doc.body << element(:par,{}, 'Next list')
|
54
|
+
|
50
55
|
doc.body << enumerate = element(:enumerate)
|
51
56
|
enumerate << element( :item, {}, 'Listitem 1' )
|
52
57
|
enumerate << element( :item, {}, 'Listitem 2' )
|
53
58
|
enumerate << element( :item, {}, 'Listitem 3' )
|
54
59
|
|
55
60
|
# ###############################
|
56
|
-
#
|
61
|
+
# Save the files
|
57
62
|
# ###############
|
58
63
|
|
59
|
-
|
60
|
-
doc.save( __FILE__.sub(/\.rb/, ".
|
61
|
-
|
62
|
-
|
64
|
+
doc.save( __FILE__.sub(/\.rb/, ".html"))
|
65
|
+
doc.save( __FILE__.sub(/\.rb/, ".tex"),
|
66
|
+
:runtex => [:statistic, :clean]
|
67
|
+
)
|
68
|
+
|
@@ -2,29 +2,26 @@
|
|
2
2
|
#Create a test-document with docgenerator.rb.
|
3
3
|
#
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
require 'rubygems'
|
6
|
+
$:.unshift("../lib") #for local tests with uninstalled gem
|
7
7
|
require 'docgenerator'
|
8
|
+
begin
|
9
|
+
require 'rake4latex_pdflatex'
|
10
|
+
rescue LoadError
|
11
|
+
puts "rake4latex not installed -> no translation of LaTeX-file"
|
12
|
+
end
|
8
13
|
|
14
|
+
#
|
15
|
+
# Move all results to anothe folder
|
16
|
+
#
|
17
|
+
Dir.chdir('results')
|
9
18
|
#
|
10
19
|
# Create a document
|
11
20
|
#
|
12
21
|
doc = Document.new(
|
13
|
-
:title => 'Testdocument with
|
22
|
+
:title => 'Testdocument with restrictions to output format'
|
14
23
|
)
|
15
24
|
|
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
25
|
#
|
29
26
|
doc.body << element(:maketitle) #Only LaTeX
|
30
27
|
doc.body[:lang] << 'en' #language flag for HTML
|
@@ -43,17 +40,10 @@ doc.body << element(:h2, {}, 'Content only in LaTeX').cr
|
|
43
40
|
doc.body << element(:p, {}, 'Only in LaTeX').restrict_to(:latex)
|
44
41
|
doc.body << element(:latexonly, {}, 'Only in LaTeX')
|
45
42
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
43
|
# ###############################
|
53
|
-
#
|
44
|
+
# Save the files
|
54
45
|
# ###############
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
doc.save( __FILE__.sub(/\.rb/, ".tex"), true )
|
46
|
+
doc.save( __FILE__.sub(/\.rb/, ".html"))
|
47
|
+
doc.save( __FILE__.sub(/\.rb/, ".tex"),
|
48
|
+
:runtex => [:statistic, :clean]
|
49
|
+
)
|
@@ -1,10 +1,19 @@
|
|
1
1
|
#
|
2
2
|
#Create a test-document with docgenerator.rb.
|
3
3
|
#
|
4
|
-
|
5
|
-
|
6
|
-
$: << ".." #for local tests with uninstalled gem
|
4
|
+
require 'rubygems'
|
5
|
+
$:.unshift("../lib") #for local tests with uninstalled gem
|
7
6
|
require 'docgenerator'
|
7
|
+
begin
|
8
|
+
require 'rake4latex_pdflatex'
|
9
|
+
rescue LoadError
|
10
|
+
puts "rake4latex not installed -> no translation of LaTeX-file"
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# Move all results to anothe folder
|
15
|
+
#
|
16
|
+
Dir.chdir('results')
|
8
17
|
|
9
18
|
#
|
10
19
|
# Create a document
|
@@ -16,20 +25,11 @@ doc = Document.new(
|
|
16
25
|
#~ doc.head << element( :usepackage, { }, 'longtable' )
|
17
26
|
#~ doc.head << element( :usepackage, { :option => [] }, 'longtable' )
|
18
27
|
|
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
28
|
#
|
29
29
|
doc.body << element(:maketitle) #Only LaTeX
|
30
|
-
doc.body[:lang] << '
|
30
|
+
doc.body[:lang] << 'en' #language flag for HTML
|
31
31
|
|
32
|
-
doc.body << element(:h1, {}, '
|
32
|
+
doc.body << element(:h1, {}, 'Tabulars').cr
|
33
33
|
|
34
34
|
def mk_tabular( columns, lines )
|
35
35
|
|
@@ -42,7 +42,7 @@ def mk_tabular( columns, lines )
|
|
42
42
|
row << element(:multicolumn, {
|
43
43
|
:columns => columns.size,
|
44
44
|
:pos => 'c', #LaTeX
|
45
|
-
}, '
|
45
|
+
}, 'Title' )
|
46
46
|
row.hline #Only LaTeX
|
47
47
|
|
48
48
|
lines.each{|line|
|
@@ -59,10 +59,10 @@ doc.body << mk_tabular( Array('A'..'F'), Array(1..5) )
|
|
59
59
|
|
60
60
|
|
61
61
|
# ###############################
|
62
|
-
#
|
62
|
+
# Save the files
|
63
63
|
# ###############
|
64
64
|
|
65
|
-
|
66
|
-
doc.save( __FILE__.sub(/\.rb/, ".
|
67
|
-
|
68
|
-
|
65
|
+
doc.save( __FILE__.sub(/\.rb/, ".html"))
|
66
|
+
doc.save( __FILE__.sub(/\.rb/, ".tex"),
|
67
|
+
:runtex => [:statistic, :clean]
|
68
|
+
)
|