docgenerator 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/examples/creole_example.rb +0 -1
- data/examples/creole_example_new_plugin.rb +51 -0
- data/examples/creole_example_tabular.rb +3 -1
- data/examples/wiki2docgenerator_example.rb +2 -2
- data/lib/creole/creole2doc.rb +697 -680
- data/lib/creole/creole_characters.rb +90 -26
- data/lib/creole/creole_inclusion_and_plugins.rb +25 -43
- data/lib/creole/creole_inclusions.rb +87 -75
- data/lib/creole/creole_placeholder.rb +87 -89
- data/lib/creole/creole_plugins.rb +149 -117
- data/lib/creole/creole_tabular.rb +247 -141
- data/lib/creole/plugins/todonotes.rb +48 -48
- data/lib/docgenerator/characters.rb +106 -8
- data/lib/docgenerator/compatibility_v1.rb +7 -1
- data/lib/docgenerator/document.rb +34 -19
- data/lib/docgenerator/element.rb +1 -0
- data/lib/docgenerator/element_meta.rb +1 -1
- data/lib/docgenerator/elements.rb +594 -535
- data/lib/docgenerator/environments.rb +131 -99
- data/lib/docgenerator/index.rb +110 -0
- data/lib/docgenerator/lists.rb +2 -1
- data/lib/docgenerator/packages/caption.rb +32 -34
- data/lib/docgenerator/packages/hyperref.rb +1 -0
- data/lib/docgenerator/packages/multicol.rb +3 -2
- data/lib/docgenerator/packages/pdfpages.rb +71 -20
- data/lib/docgenerator/packages/scrpage2.rb +99 -142
- data/lib/docgenerator/packages/url.rb +75 -81
- data/lib/docgenerator/sections.rb +98 -98
- data/lib/docgenerator/standard.rb +8 -1
- data/lib/docgenerator/tabular.rb +44 -25
- data/lib/docgenerator/templates/docgenerator_template.yaml +28 -0
- data/lib/docgenerator/version.rb +146 -0
- data/lib/docgenerator.rb +20 -15
- data/meta_test_and_doc/build_doc.rb +39 -10
- data/meta_test_and_doc/build_test.rb +34 -12
- data/meta_test_and_doc/manpages/characters.rb +452 -20
- data/meta_test_and_doc/manpages/elementlist.rb +304 -0
- data/meta_test_and_doc/manpages/elements.rb +305 -42
- data/meta_test_and_doc/manpages/others.rb +403 -0
- data/meta_test_and_doc/manpages/pdfpages.rb +117 -18
- data/meta_test_and_doc/manpages/readme.rdoc +3 -1
- data/meta_test_and_doc/manpages/scrpage2.rb +0 -80
- data/meta_test_and_doc/manpages/tables.rb +6 -6
- data/readme.rdoc +11 -120
- data/unittest/expected/test_comment.html +1 -0
- data/unittest/expected/test_comment.latex +5 -0
- data/unittest/expected/test_comment_complex.html +3 -0
- data/unittest/expected/test_comment_complex.latex +15 -0
- data/unittest/expected_creole/test_creole_characters_all.html +6 -5
- data/unittest/expected_creole/test_creole_characters_all.latex +10 -8
- data/unittest/expected_creole/test_creole_creole1.0test.latex +5 -5
- data/unittest/expected_creole/test_creole_input.normsource +11 -9
- data/unittest/expected_creole/test_creole_list_ul.normsource +57 -51
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.html +6 -0
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.latex +12 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource +12 -10
- data/unittest/expected_creole/test_creole_pictures.latex +2 -2
- data/unittest/expected_creole/test_creole_pictures_css.latex +2 -2
- data/unittest/expected_creole/test_creole_pictures_imgclass.latex +2 -2
- data/unittest/expected_creole/test_creole_pictures_width.latex +1 -1
- data/unittest/expected_creole/test_creole_tabular.latex +3 -3
- data/unittest/expected_creole/test_creole_tabular_creole.latex +2 -2
- data/unittest/expected_creole/test_creole_tabular_css.latex +3 -3
- data/unittest/expected_creole/test_creole_tabular_row_parameters.latex +22 -0
- data/unittest/expected_templates/test_standalone.tex +34 -0
- data/unittest/expected_wikimedia/test_wiki_picture.latex +12 -12
- data/unittest/unittest_creole.rb +22 -3
- data/unittest/unittest_creole_tabular.rb +34 -1
- data/unittest/unittest_docgenerator.rb +46 -3
- data/unittest/unittest_docgenerator_characters.rb +527 -82
- data/unittest/unittest_templates.rb +1 -1
- metadata +149 -108
@@ -0,0 +1,34 @@
|
|
1
|
+
<<prefix>>
|
2
|
+
\documentclass[ngerman]{standalone}
|
3
|
+
\usepackage{babel}
|
4
|
+
%Encoding-package depends on TeX-engine
|
5
|
+
\usepackage{ifpdf,ifxetex,ifluatex}
|
6
|
+
\ifxetex
|
7
|
+
\usepackage{fontspec} %Without, umlauts are missing
|
8
|
+
\fi
|
9
|
+
\ifluatex
|
10
|
+
\usepackage[utf8]{luainputenc} %Or in first line: % !Mode:: "TeX:UTF-8".
|
11
|
+
\else
|
12
|
+
\ifpdf\relax
|
13
|
+
\usepackage[utf8]{inputenc}
|
14
|
+
\fi
|
15
|
+
\fi
|
16
|
+
%\usepackage{hyperref}
|
17
|
+
% ----------------------------------------------------------------
|
18
|
+
|
19
|
+
\title{Test of Template standalone}
|
20
|
+
\hypersetup{pdftitle={Test of Template standalone}}
|
21
|
+
|
22
|
+
% ----------------------------------------------------------------
|
23
|
+
\begin{document}
|
24
|
+
|
25
|
+
|
26
|
+
Some text
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
Umlaute: öäü ÖÄÜ ß
|
31
|
+
|
32
|
+
|
33
|
+
\end{document}
|
34
|
+
% ----------------------------------------------------------------
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
\bgroup
|
4
|
-
\includegraphics[]{Red_Flower.jpg}
|
4
|
+
\includegraphics[,]{Red_Flower.jpg}
|
5
5
|
\egroup
|
6
6
|
|
7
7
|
|
@@ -9,16 +9,16 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
\bgroup
|
12
|
-
\includegraphics[]{Red_Flower.jpg}
|
12
|
+
\includegraphics[,]{Red_Flower.jpg}
|
13
13
|
\egroup
|
14
14
|
|
15
15
|
\bgroup
|
16
|
-
vorher\includegraphics[]{Red_Flower.jpg}\newline
|
16
|
+
vorher\includegraphics[,]{Red_Flower.jpg}\newline
|
17
17
|
|
18
18
|
\egroup
|
19
19
|
|
20
20
|
\bgroup
|
21
|
-
\includegraphics[]{Red_Flower.jpg}\newline
|
21
|
+
\includegraphics[,]{Red_Flower.jpg}\newline
|
22
22
|
nachher
|
23
23
|
\egroup
|
24
24
|
|
@@ -27,12 +27,12 @@ nachher
|
|
27
27
|
|
28
28
|
|
29
29
|
\bgroup
|
30
|
-
\href{http://ruby.lickert.net}{\includegraphics[]{Red_Flower.jpg}}
|
30
|
+
\href{http://ruby.lickert.net}{\includegraphics[,]{Red_Flower.jpg}}
|
31
31
|
|
32
32
|
\egroup
|
33
33
|
|
34
34
|
\bgroup
|
35
|
-
\href{http://ruby.lickert.net}{\includegraphics[]{Red_Flower.jpg}}
|
35
|
+
\href{http://ruby.lickert.net}{\includegraphics[,]{Red_Flower.jpg}}
|
36
36
|
|
37
37
|
\egroup
|
38
38
|
|
@@ -41,11 +41,11 @@ nachher
|
|
41
41
|
|
42
42
|
|
43
43
|
\bgroup
|
44
|
-
\includegraphics[]{Red_Flower.jpg}
|
44
|
+
\includegraphics[,]{Red_Flower.jpg}
|
45
45
|
\egroup
|
46
46
|
|
47
47
|
\bgroup
|
48
|
-
\includegraphics[]{Red_Flower.jpg}
|
48
|
+
\includegraphics[,]{Red_Flower.jpg}
|
49
49
|
\egroup
|
50
50
|
|
51
51
|
|
@@ -53,7 +53,7 @@ nachher
|
|
53
53
|
|
54
54
|
|
55
55
|
\bgroup
|
56
|
-
\includegraphics[width={123px}]{Red_Flower.jpg}
|
56
|
+
\includegraphics[width={123px},]{Red_Flower.jpg}
|
57
57
|
\egroup
|
58
58
|
|
59
59
|
|
@@ -61,15 +61,15 @@ nachher
|
|
61
61
|
|
62
62
|
|
63
63
|
\bgroup
|
64
|
-
\includegraphics[]{Red_Flower.jpg}
|
64
|
+
\includegraphics[,]{Red_Flower.jpg}
|
65
65
|
\egroup
|
66
66
|
|
67
67
|
\bgroup
|
68
|
-
\includegraphics[]{Red_Flower.jpg}
|
68
|
+
\includegraphics[,]{Red_Flower.jpg}
|
69
69
|
\egroup
|
70
70
|
|
71
71
|
\bgroup
|
72
|
-
\includegraphics[]{Red_Flower.jpg}
|
72
|
+
\includegraphics[,]{Red_Flower.jpg}
|
73
73
|
\egroup
|
74
74
|
|
75
75
|
|
data/unittest/unittest_creole.rb
CHANGED
@@ -3,7 +3,8 @@ if $0 == __FILE__
|
|
3
3
|
$:.unshift("../lib")
|
4
4
|
end
|
5
5
|
|
6
|
-
gem 'test-
|
6
|
+
gem 'more_unit_test' #Wichtig das unit test-version correct verwendet wird
|
7
|
+
#~ gem 'test-unit', '~> 2'
|
7
8
|
require 'test/unit'
|
8
9
|
require 'more_unit_test/assert_equal_filecontent.rb'
|
9
10
|
|
@@ -126,6 +127,7 @@ creole
|
|
126
127
|
return unless $0 == __FILE__
|
127
128
|
|
128
129
|
creole1 = Docgenerator::Creole::Creole.new( :name => 'input_file_rb/DATA', :content => DATA )
|
130
|
+
|
129
131
|
creole2 = nil
|
130
132
|
File.open($thisfile){|filehandle|
|
131
133
|
#~ $log.warn('Test Filehandle auf ruby nicht m�glich (Test $0 == input.path)')
|
@@ -134,7 +136,8 @@ creole
|
|
134
136
|
creole2 = Docgenerator::Creole::Creole.new( :name => 'input_file_rb', :content => filehandle, :log => $tmplog )
|
135
137
|
$0 = $thisfile
|
136
138
|
}
|
137
|
-
|
139
|
+
#normalize line ends
|
140
|
+
assert_equal( creole1.source.map{|entry|entry.gsub( /\r\n?/, "\n")}, creole2.source)
|
138
141
|
end
|
139
142
|
def test_creole_input_file_simple
|
140
143
|
assert_true(File.exist?('creole_testtext.creole'))
|
@@ -590,6 +593,23 @@ creole
|
|
590
593
|
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.text", creole.to_doc(:text, @opt))
|
591
594
|
end
|
592
595
|
|
596
|
+
def test_creole_list_ulul_without_ul()
|
597
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
598
|
+
Text before
|
599
|
+
**Listentry 1
|
600
|
+
Text afterwords
|
601
|
+
creole
|
602
|
+
)
|
603
|
+
@opt[:log] = $tmplog #Suppress error message
|
604
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.html", creole.to_doc(:html, @opt))
|
605
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.latex", creole.to_doc(:latex, @opt))
|
606
|
+
$log.warn("#{__method__}: to_context")
|
607
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.context", creole.to_doc(:context))
|
608
|
+
$log.warn("#{__method__}: list to wiki/creole")
|
609
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.creole", creole.to_doc(:creole, @opt))
|
610
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.text", creole.to_doc(:text, @opt))
|
611
|
+
end
|
612
|
+
|
593
613
|
#Line breaks will be lost.
|
594
614
|
def test_creole_ul_multiple_line()
|
595
615
|
$log.warn('test_creole_ul_multiple_line: latex: grosse textl�cken (wrap mit leerzeichen bereinigen?)')
|
@@ -1104,7 +1124,6 @@ class Test_creole_characters < Test::Unit::TestCase
|
|
1104
1124
|
#~ :content => Creole::CHARACTERS.keys.sort.map{|char| "*#{char}" }.join("\n")
|
1105
1125
|
:content => Docgenerator::Creole::Creole::CHARACTERS.sort.map{|char, o| "* #{o.class}: #{char}"}.join("\n")
|
1106
1126
|
)
|
1107
|
-
self.readoption = 'r:cp1252'
|
1108
1127
|
assert_equal_filecontent( "expected_creole/test_creole_characters_all.html", creole.to_doc(:html, @opt))
|
1109
1128
|
|
1110
1129
|
$log.warn('test_creole_characters_all: to_latex Dollar Missing escape mechanism')
|
@@ -147,7 +147,40 @@ creole
|
|
147
147
|
$log.warn('test_creole_tabular_css: to text')
|
148
148
|
#~ assert_equal_filecontent( "expected_creole/test_creole_tabular_css.text", creole.to_doc(:text))
|
149
149
|
end #test_creole_tabular_css
|
150
|
-
|
150
|
+
|
151
|
+
def test_creole_tabular_row_parameters()
|
152
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
153
|
+
before
|
154
|
+
<<<tabular
|
155
|
+
|!columns=3
|
156
|
+
|!columndescription=ccc
|
157
|
+
|Titel A
|
158
|
+
|Titel B
|
159
|
+
|Titel C
|
160
|
+
|-|toprule
|
161
|
+
|eins
|
162
|
+
|zwei
|
163
|
+
|drei
|
164
|
+
|-|midrule
|
165
|
+
|eins
|
166
|
+
|zwei
|
167
|
+
|drei
|
168
|
+
>>>
|
169
|
+
after
|
170
|
+
creole
|
171
|
+
)
|
172
|
+
$log.warn("#{__method__}: to_html")
|
173
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.html", creole.to_doc(:html, OPT))
|
174
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.latex", creole.to_doc(:latex, OPT))
|
175
|
+
$log.warn("#{__method__}: to_context")
|
176
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.context", creole.to_doc(:context))
|
177
|
+
$log.warn("#{__method__}: to_creole")
|
178
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.creole", creole.to_doc(:creole))
|
179
|
+
$log.warn("#{__method__}: to text")
|
180
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.text", creole.to_doc(:text))
|
181
|
+
end #test_creole_tabular_row_parameters
|
182
|
+
|
183
|
+
|
151
184
|
def test_creole_tabular_multicols()
|
152
185
|
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
153
186
|
before
|
@@ -1,8 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
gem 'more_unit_test'
|
2
3
|
gem 'test-unit'
|
3
|
-
|
4
|
+
|
4
5
|
#~ $:.unshift('C:/usr/Script/more_unit_test/lib')
|
5
6
|
require 'more_unit_test/assert_equal_filecontent.rb'
|
7
|
+
require 'test/unit'
|
8
|
+
|
6
9
|
|
7
10
|
if $0 == __FILE__
|
8
11
|
$:.unshift("../lib")
|
@@ -149,6 +152,45 @@ class Test_elements < Test::Unit::TestCase
|
|
149
152
|
#~ assert_equal_filecontent( "expected/test_href.wiki", text.to_doc(:wiki,@opt))
|
150
153
|
assert_equal_filecontent( "expected/test_href.text", text.to_doc(:text, @opt)) #not good
|
151
154
|
end
|
155
|
+
|
156
|
+
def test_comment()
|
157
|
+
text = [
|
158
|
+
element(:p, {}, [ 'Now some text ',
|
159
|
+
element(:comment, {}, 'comment'),
|
160
|
+
'interrupted by a comment',
|
161
|
+
] ).cr
|
162
|
+
]
|
163
|
+
assert_equal_filecontent( "expected/#{__method__}.html", text.to_doc(:html, @opt))
|
164
|
+
assert_equal_filecontent( "expected/#{__method__}.latex", text.to_doc(:latex, @opt))
|
165
|
+
$log.warn("#{__method__}: to_context")
|
166
|
+
#~ assert_equal_filecontent( "expected/#{__method__}.context", text.to_doc(:context, @opt))
|
167
|
+
$log.warn("#{__method__}: to_creole")
|
168
|
+
#~ assert_equal_filecontent( "expected/#{__method__}.creole", text.to_doc(:creole, @opt))
|
169
|
+
#~ assert_equal_filecontent( "expected/#{__method__}.wiki", text.to_doc(:wiki,@opt))
|
170
|
+
$log.warn("#{__method__}: to_text")
|
171
|
+
#~ assert_equal_filecontent( "expected/#{__method__}.text", text.to_doc(:text, @opt)) #not good
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_comment_complex()
|
175
|
+
ul = element(:ul,{},[element(:item,{},'1'), element(:item,{},'2').cr])
|
176
|
+
text = [
|
177
|
+
ul,
|
178
|
+
element(:p, {}, [ 'Now some text ',
|
179
|
+
element(:comment, {}, ul),
|
180
|
+
'interrupted by a comment',
|
181
|
+
] ).cr
|
182
|
+
]
|
183
|
+
assert_equal_filecontent( "expected/#{__method__}.html", text.to_doc(:html, @opt))
|
184
|
+
assert_equal_filecontent( "expected/#{__method__}.latex", text.to_doc(:latex, @opt))
|
185
|
+
$log.warn("#{__method__}: to_context")
|
186
|
+
#~ assert_equal_filecontent( "expected/#{__method__}.context", text.to_doc(:context, @opt))
|
187
|
+
$log.warn("#{__method__}: to_creole")
|
188
|
+
#~ assert_equal_filecontent( "expected/#{__method__}.creole", text.to_doc(:creole, @opt))
|
189
|
+
#~ assert_equal_filecontent( "expected/#{__method__}.wiki", text.to_doc(:wiki,@opt))
|
190
|
+
$log.warn("#{__method__}: to_text")
|
191
|
+
#~ assert_equal_filecontent( "expected/#{__method__}.text", text.to_doc(:text, @opt)) #not good
|
192
|
+
end
|
193
|
+
|
152
194
|
end #Test_elements
|
153
195
|
|
154
196
|
class Test_lists < Test::Unit::TestCase
|
@@ -315,8 +357,9 @@ class Test_tabular < Test::Unit::TestCase
|
|
315
357
|
#~ assert_equal_filecontent( "expected/test_tabular_doc.html", text.to_doc(:html, @opt))
|
316
358
|
|
317
359
|
#The row ends in tabulars are \\.
|
318
|
-
#When used in documents, \\
|
319
|
-
#So there
|
360
|
+
#When used in documents, \\ was converted into \.
|
361
|
+
#So there was a special rule to double the \\ when used in combination with a filename.
|
362
|
+
#2012-06-07: Regexp in documen.rb was replaced with block version.
|
320
363
|
assert_equal_filecontent( "expected/test_tabular_doc.latex", doc.to_doc(:latex,
|
321
364
|
{ :log => doc.log, :template=> DocumentTemplate[:article], :filename => 'test'}
|
322
365
|
) )
|