wortsammler 0.0.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wortsammler/class.Traceable.md.rb +90 -90
- data/lib/wortsammler/class.Traceable.rb +4 -2
- data/lib/wortsammler/class.proolib.rb +39 -17
- data/lib/wortsammler/exe.wortsammler.rb +5 -5
- data/lib/wortsammler/latex_helper.rb +244 -0
- data/lib/wortsammler/version.rb +1 -1
- data/lib/wortsammler.rb +30 -14
- data/resources/default.wortsammler.latex +4 -0
- data/spec/test_mkindex.md +22 -0
- data/spec/wortsammler_spec.rb +42 -10
- data/testresults/wortsammler_testresults.html +129 -121
- data/testresults/wortsammler_testresults.log +12 -8
- data/wortsammler.gemspec +1 -1
- metadata +6 -3
data/lib/wortsammler.rb
CHANGED
@@ -4,22 +4,22 @@ require "wortsammler/class.proolib"
|
|
4
4
|
|
5
5
|
##
|
6
6
|
# This represents the high level API of Wortsammler
|
7
|
-
|
7
|
+
|
8
8
|
module Wortsammler
|
9
9
|
|
10
10
|
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# execute Wortsammler after parsing the command line
|
13
|
-
#
|
14
|
-
# @param options [Hash] The parsed commandline arguments.
|
15
|
-
#
|
13
|
+
#
|
14
|
+
# @param options [Hash] The parsed commandline arguments.
|
15
|
+
#
|
16
16
|
# The key of each entry is the argument name as a symbol
|
17
|
-
#
|
17
|
+
#
|
18
18
|
# The value of each entry is the value of the argument
|
19
19
|
#
|
20
20
|
# No default handling is performed, since defaulting of arguments has been done
|
21
21
|
# on the commandline processor.
|
22
|
-
#
|
22
|
+
#
|
23
23
|
# @return [Nil] No Return
|
24
24
|
def self.execute(options)
|
25
25
|
|
@@ -31,14 +31,20 @@ module Wortsammler
|
|
31
31
|
# print version info
|
32
32
|
#
|
33
33
|
if options[:version] then
|
34
|
-
puts "#{Wortsammler::PROGNAME} #{Wortsammler::VERSION}"
|
34
|
+
puts "this is #{Wortsammler::PROGNAME} version #{Wortsammler::VERSION}\n"
|
35
35
|
|
36
36
|
pandoc=`pandoc -v`.split("\n")[0] rescue pandoc="error running pandoc"
|
37
37
|
xetex=`xelatex -v`.split("\n")[0] rescue pandoc="error running xelatex"
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
$log.info "found #{pandoc}"
|
40
|
+
$log.info "found #{xetex}"
|
41
41
|
|
42
|
+
$log.debug("debug mode turned on")
|
43
|
+
|
44
|
+
l= "-----------------"
|
45
|
+
$log.info l
|
46
|
+
options.each {|k,v| $log.info "#{k}: #{v}"}
|
47
|
+
$log.info l
|
42
48
|
end
|
43
49
|
|
44
50
|
##
|
@@ -75,7 +81,7 @@ module Wortsammler
|
|
75
81
|
if File.file?(inputpath) #(RS_Mdc)
|
76
82
|
input_files=[inputpath]
|
77
83
|
elsif File.exists?(inputpath)
|
78
|
-
input_files=Dir["#{inputpath}/**/*.md", "#{inputpath}/**/*.markdown"]
|
84
|
+
input_files=Dir["#{inputpath}/**/*.md", "#{inputpath}/**/*.markdown", "#{inputpath}/**/*.plantuml"]
|
79
85
|
end
|
80
86
|
end
|
81
87
|
|
@@ -226,14 +232,14 @@ module Wortsammler
|
|
226
232
|
cleaner = PandocBeautifier.new($log)
|
227
233
|
plantumljar=File.dirname(__FILE__)+"/../resources/plantuml.jar"
|
228
234
|
|
229
|
-
paths.each{|f|
|
235
|
+
paths.each{|f|
|
230
236
|
cmd = "java -jar \"#{plantumljar}\" -v \"#{f}\" 2>&1"
|
231
237
|
r=`#{cmd}`
|
232
238
|
no_of_images = r.split($/).grep(/Number of image/).first.split(":")[1]
|
233
239
|
|
234
240
|
$log.info("#{no_of_images} uml diagram(s) in #{File.basename(f)}")
|
235
241
|
$log.info(r) unless $?.success?
|
236
|
-
|
242
|
+
}
|
237
243
|
nil
|
238
244
|
end
|
239
245
|
|
@@ -420,6 +426,16 @@ module Wortsammler
|
|
420
426
|
end
|
421
427
|
end
|
422
428
|
|
429
|
+
unless options[:outputfolder] then
|
430
|
+
outputfolder="."
|
431
|
+
inputpath=options[:inputpath]
|
432
|
+
unless inputpath.nil? then
|
433
|
+
outputfolder = inputpath if File.directory?(inputpath)
|
434
|
+
outputfolder = File.dirname(inputpath) if File.file?(inputpath)
|
435
|
+
end
|
436
|
+
options[:outputfolder] = outputfolder
|
437
|
+
end
|
438
|
+
|
423
439
|
if options[:inputpath] and options[:process] then
|
424
440
|
unless options[:outputfolder] then
|
425
441
|
$log.error "no output folder specified for input path"
|
@@ -432,4 +448,4 @@ module Wortsammler
|
|
432
448
|
|
433
449
|
|
434
450
|
|
435
|
-
end # module
|
451
|
+
end # module
|
@@ -256,6 +256,10 @@ $if(linenumbers)$
|
|
256
256
|
\setlength\linenumbersep{1mm}
|
257
257
|
\modulolinenumbers[5]
|
258
258
|
$endif$
|
259
|
+
|
260
|
+
\usepackage{makeidx}
|
261
|
+
\makeindex
|
262
|
+
|
259
263
|
%
|
260
264
|
%\renewcommand{Befehl der Gliederungsebene z.B. \chapter}{\@startsection{Name z.B. chapter}{Ebene z.B. 0}{Einrückung z.B. 0pt}{Abstand zum vorigen Text z.B. 3.5ex plus 1ex minus 0pt\relax}{Abstand zum nachfolgenden Text z.B. 2.5ex plus 0.5ex minus 0pt\relax}{Schrift z.B. \normalfont\Large\bfseries}}
|
261
265
|
%
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Das ist ein Test zur Indexerstellung
|
2
|
+
|
3
|
+
Dies ist ein Typoblindtext\index{Typoblindtext}. An ihm kann man sehen, ob alle Buchstaben da sind und wie sie aussehen. Manchmal benutzt man Worte wie Hamburgefonts, Rafgenduks oder Handgloves, um Schriften zu testen.
|
4
|
+
|
5
|
+
Manchmal Sätze\index{Sätze}, die alle Buchstaben des Alphabets enthalten - man nennt diese Sätze »Pangrams«. Sehr bekannt ist dieser: The quick brown fox jumps over the lazy old dog. Oft werden in Typoblindtexte auch fremdsprachige Satzteile eingebaut (AVAIL® and Wefox™ are testing aussi la Kerning), um die Wirkung in anderen Sprachen zu testen. In Lateinisch sieht zum Beispiel fast jede Schrift gut aus. Quod erat demonstrandum. Seit 1975 fehlen in den meisten Testtexten die Zahlen, weswegen nach TypoGb. 204 § ab dem Jahr 2034 Zahlen in 86 der Texte zur Pflicht werden. Nichteinhaltung wird mit bis zu 245 € oder 368 $ bestraft. Genauso wichtig in sind mittlerweile auch Âçcèñtë, die in neueren Schriften aber fast immer enthalten sind. Ein wichtiges aber schwierig zu integrierendes Feld sind OpenType-Funktionalitäten. Je nach Software und Voreinstellungen können eingebaute Kapitälchen, Kerning oder Ligaturen (sehr pfiffig) nicht richtig dargestellt werden.Dies ist ein Typoblindtext. An ihm kann man sehen, ob alle Buchstaben da sind und wie sie aussehen. Manchmal benutzt man Worte wie Hamburgefonts, Rafgenduks
|
6
|
+
|
7
|
+
\index{Über}\index{Uder}\index{Ufer}\index{Äpfelchen}
|
8
|
+
\clearpage
|
9
|
+
|
10
|
+
Dies ist ein Typoblindtext\index{Typoblindtext}. An ihm kann man sehen, ob alle Buchstaben da sind und wie sie aussehen. Manchmal benutzt man Worte wie Hamburgefonts, Rafgenduks oder Handgloves, um Schriften zu testen. Manchmal Sätze, die alle Buchstaben des Alphabets enthalten - man nennt diese Sätze »Pangrams«. Sehr bekannt ist dieser: The quick brown fox jumps over the lazy old dog. Oft werden in Typoblindtexte auch fremdsprachige Satzteile eingebaut (AVAIL® and Wefox™ are testing aussi la Kerning), um die Wirkung in anderen Sprachen zu testen. In Lateinisch sieht zum Beispiel fast jede Schrift gut aus. Quod erat demonstrandum. Seit 1975 fehlen in den meisten Testtexten die Zahlen, weswegen nach TypoGb. 204 § ab dem Jahr 2034 Zahlen in 86 der Texte zur Pflicht werden. Nichteinhaltung wird mit bis zu 245 € oder 368 $ bestraft. Genauso wichtig in sind mittlerweile auch Âçcèñtë, die in neueren Schriften aber fast immer enthalten sind. Ein wichtiges aber schwierig zu integrierendes Feld sind OpenType-Funktionalitäten. Je nach Software und Voreinstellungen können eingebaute Kapitälchen, Kerning oder Ligaturen (sehr pfiffig) nicht richtig dargestellt werden.Dies ist ein Typoblindtext. An ihm kann man sehen, ob alle Buchstaben da sind und wie sie aussehen. Manchmal benutzt man Worte wie Hamburgefonts, Rafgenduks
|
11
|
+
|
12
|
+
|
13
|
+
\clearpage
|
14
|
+
|
15
|
+
hier kommt der Index
|
16
|
+
|
17
|
+
\printindex
|
18
|
+
|
19
|
+
ende des Index
|
20
|
+
|
21
|
+
|
22
|
+
|
data/spec/wortsammler_spec.rb
CHANGED
@@ -11,12 +11,29 @@ testoutput = "#{specdir}/../testoutput"
|
|
11
11
|
|
12
12
|
describe "Wortsammler generic issues" do
|
13
13
|
|
14
|
-
it "provides a help" do
|
14
|
+
it "provides a help", :exp => false do
|
15
15
|
result = `#{wortsammler} -h`
|
16
16
|
result.should include("Usage: Wortsammler [options]")
|
17
17
|
$?.success?.should==true
|
18
18
|
end
|
19
19
|
|
20
|
+
it "runs silent", :exp => false do
|
21
|
+
result = `#{wortsammler}`
|
22
|
+
result.empty?.should==true
|
23
|
+
end
|
24
|
+
|
25
|
+
it "reports version numbers", :exp => false do
|
26
|
+
result = `#{wortsammler} -v`
|
27
|
+
result.should include "wortsammler"
|
28
|
+
result.should include "pandoc"
|
29
|
+
result.should include "XeTeX"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "turns on vervbose mode", :exp => false do
|
33
|
+
result = `#{wortsammler} -v`
|
34
|
+
result.should include "DEBUG"
|
35
|
+
end
|
36
|
+
|
20
37
|
it "can create a new project folder", :exp => false do
|
21
38
|
FileUtils.rm_rf(testprojectdir)
|
22
39
|
system "#{wortsammler} -n #{testprojectdir}"
|
@@ -33,7 +50,7 @@ describe "Wortsammler generic issues" do
|
|
33
50
|
end
|
34
51
|
|
35
52
|
it "controls the pandoc options by document class" do
|
36
|
-
pending "
|
53
|
+
pending "implement test to control pandoc options by document class"
|
37
54
|
end
|
38
55
|
end
|
39
56
|
|
@@ -43,11 +60,7 @@ describe "Wortsammler options validator" do
|
|
43
60
|
$?.success?.should==false
|
44
61
|
end
|
45
62
|
|
46
|
-
|
47
|
-
system "#{wortsammler} -pi ." do
|
48
|
-
$?.success?.should==false
|
49
|
-
end
|
50
|
-
end
|
63
|
+
|
51
64
|
end
|
52
65
|
|
53
66
|
describe "Wortsammler beautifier features" do
|
@@ -130,6 +143,7 @@ describe "Wortsammler conversion" do
|
|
130
143
|
Dir["#{tempdir}/*"].map{|f|File.basename(f)}.should== ["single.docx",
|
131
144
|
"single.html",
|
132
145
|
"single.latex",
|
146
|
+
"single.log",
|
133
147
|
"single.md",
|
134
148
|
"single.pdf"
|
135
149
|
]
|
@@ -144,7 +158,8 @@ describe "Wortsammler conversion" do
|
|
144
158
|
$?.success?.should==true
|
145
159
|
|
146
160
|
|
147
|
-
Dir["#{tempdir}/*"].map{|f|File.basename(f)}.should== ["single.
|
161
|
+
Dir["#{tempdir}/*"].map{|f|File.basename(f)}.should== ["single.log",
|
162
|
+
"single.md",
|
148
163
|
"single.pdf"
|
149
164
|
]
|
150
165
|
end
|
@@ -176,6 +191,7 @@ describe "Wortsammler conversion" do
|
|
176
191
|
Dir["#{tempdir}/chapternesting*"].map{|f|File.basename(f)}.sort.should== ["chapternesting.md",
|
177
192
|
"chapternesting.pdf",
|
178
193
|
"chapternesting.latex",
|
194
|
+
"chapternesting.log",
|
179
195
|
"chapternesting.md.bak"
|
180
196
|
].sort
|
181
197
|
end
|
@@ -209,6 +225,7 @@ describe "Wortsammler conversion" do
|
|
209
225
|
Dir["#{tempdir}/listnesting*"].map{|f|File.basename(f)}.sort.should== ["listnesting.md",
|
210
226
|
"listnesting.pdf",
|
211
227
|
"listnesting.latex",
|
228
|
+
"listnesting.log",
|
212
229
|
"listnesting.md.bak"
|
213
230
|
].sort
|
214
231
|
end
|
@@ -259,7 +276,7 @@ describe "Wortsammler conversion" do
|
|
259
276
|
|
260
277
|
it "extracts plantuml from a single file", :exp => false do
|
261
278
|
outfile="#{testoutput}/authentification.png"
|
262
|
-
FileUtils.rm(outfile)
|
279
|
+
FileUtils.rm(outfile) if File.exists?(outfile)
|
263
280
|
system "#{wortsammler} -ui \"#{specdir}/TC_EXP_002.md\""
|
264
281
|
$?.success?.should==true
|
265
282
|
File.exist?(outfile).should==true
|
@@ -267,7 +284,7 @@ describe "Wortsammler conversion" do
|
|
267
284
|
|
268
285
|
it "extracts plantuml from a folder", :exp => false do
|
269
286
|
outfile="#{testoutput}/authentification.png"
|
270
|
-
FileUtils.rm(outfile)
|
287
|
+
FileUtils.rm(outfile) if File.exists?(outfile)
|
271
288
|
system "#{wortsammler} -ui \"#{specdir}\""
|
272
289
|
$?.success?.should==true
|
273
290
|
File.exist?(outfile).should==true
|
@@ -403,4 +420,19 @@ describe "Wortsammler syntax extensions", :exp => false do
|
|
403
420
|
ref.should==result
|
404
421
|
end
|
405
422
|
|
423
|
+
it "generates an index", exp: false do
|
424
|
+
system "wortsammler -pi \"#{specdir}/test_mkindex.md\" -f pdf:latex"
|
425
|
+
system "pdftotext \"#{specdir}/test_mkindex.pdf\""
|
426
|
+
ref = File.open("#{specdir}/test_mkindex_reference.txt").read
|
427
|
+
result = File.open("#{specdir}/test_mkindex.txt").read
|
428
|
+
ref.should==result
|
429
|
+
end
|
430
|
+
|
431
|
+
it "reports TeX messages", exp: false do
|
432
|
+
system "wortsammler -pi \"#{specdir}/test_mkindex.md\" -f pdf:latex >> \"#{specdir}/test_mkindex.lst\""
|
433
|
+
system "pdftotext \"#{specdir}/test_mkindex.pdf\""
|
434
|
+
result = File.open("#{specdir}/test_mkindex.lst").read
|
435
|
+
result.include?("[WARN]").should==true
|
436
|
+
end
|
437
|
+
|
406
438
|
end
|