rake4latex 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/{call_rake4latex.rb → bin/call_rake4latex.rb} +6 -3
- data/{readme_call_rake4latex.txt → bin/readme_call_rake4latex.txt} +0 -0
- data/lib/rake4latex.rb +106 -42
- data/lib/rake4latex/analyse_texfile.rb +375 -0
- data/lib/rake4latex/base.rb +40 -10
- data/lib/rake4latex/latexrunner.rb +20 -7
- data/lib/rake4latex/rake4latex.yaml +4 -0
- data/lib/rake4latex/rules.rb +59 -26
- data/lib/rake4latex/tex_statistic.rb +405 -375
- data/lib/rake4latex_dtx.rb +83 -0
- data/readme.html +150 -28
- data/readme.txt +118 -20
- data/test/_expected/bibtex_test_build_rakefile.txt +49 -0
- data/test/_expected/dtx_test.txt +12 -0
- data/test/_expected/dtx_test_sty.txt +2 -0
- data/test/_expected/error_test.txt +4 -0
- data/test/_expected/error_test_ignore_error.txt +5 -0
- data/test/_expected/error_test_overview.txt +16 -0
- data/test/_expected/error_test_statistic.txt +3 -0
- data/test/_expected/gloss_test_build_rakefile.txt +56 -0
- data/test/_expected/includes_test_build_rakefile.txt +55 -0
- data/test/_expected/{rail_test_error.txt → rail_error_test.txt} +0 -0
- data/test/_expected/splitindex_test_build_rakefile.txt +56 -0
- data/test/_expected/supertabular_test_statistic.txt +2 -29
- data/test/_expected/varioref_test.txt +6 -0
- data/test/_expected/varioref_test_ignore_error.txt +11 -0
- data/test/_expected/z_complex_test_overview.txt +62 -0
- data/test/_expected/z_complex_test_statistic.txt +9 -0
- data/test/bibtex/rakefile.rb +6 -0
- data/test/dtx/rakefile.rb +31 -0
- data/test/error/rakefile.rb +32 -0
- data/test/error/testdocument.tex +14 -0
- data/test/gloss/rakefile.rb +9 -1
- data/test/includes/rakefile.rb +6 -0
- data/test/rail/rakefile.rb +1 -5
- data/test/rail_error/rakefile.rb +38 -0
- data/test/{rail → rail_error}/testrail_error.tex +0 -0
- data/test/splitindex/rakefile.rb +8 -1
- data/test/supertabular/rakefile.rb +2 -2
- data/test/unittest_rake4latex.rb +61 -72
- data/test/unittest_rake4latex_testcases.rb +79 -0
- data/test/varioref/rakefile.rb +37 -0
- data/test/varioref/testdocument.tex +33 -0
- data/test/z_complex/rakefile.rb +3 -1
- metadata +42 -10
- data/lib/rake4latex/latexdependencies.rb +0 -105
- data/lib/rake4latex/template.rb +0 -60
@@ -0,0 +1,33 @@
|
|
1
|
+
\documentclass[12pt,ngerman]{scrartcl}
|
2
|
+
\usepackage{babel}
|
3
|
+
\usepackage[ansinew]{inputenc}
|
4
|
+
\usepackage{blindtext}
|
5
|
+
\usepackage{hyperref}
|
6
|
+
\usepackage{varioref}
|
7
|
+
% ----------------------------------------------------------------
|
8
|
+
\begin{document}
|
9
|
+
|
10
|
+
\section{Start}
|
11
|
+
|
12
|
+
\label{start}
|
13
|
+
\blindtext[2]
|
14
|
+
|
15
|
+
\hrulefill
|
16
|
+
|
17
|
+
\blindtext[2]
|
18
|
+
|
19
|
+
\hrulefill
|
20
|
+
|
21
|
+
Jetzt muss etwas Text kommen um in die N�he des Zeilenumbruchs zu kommen.
|
22
|
+
% --
|
23
|
+
Jetzt muss etwas Text kommen um in die N�he des Zeilenumbruchs zu kommen.
|
24
|
+
% --
|
25
|
+
Jetzt muss etwas Text kommen um in die N�he des Zeilenumbruchs zu kommen.
|
26
|
+
Jetzt muss etwas Text kommen um in die N�he des Zeilenumbruchs zu kommen.
|
27
|
+
% ---
|
28
|
+
Die Startseite ist \vpageref{start}.
|
29
|
+
|
30
|
+
\blindtext
|
31
|
+
|
32
|
+
\end{document}
|
33
|
+
% ----------------------------------------------------------------
|
data/test/z_complex/rakefile.rb
CHANGED
@@ -41,6 +41,8 @@ task :default => :statistic
|
|
41
41
|
|
42
42
|
desc "Testtask for Unittest"
|
43
43
|
task :test => [ :touch, 'testdocument.pdf' ]
|
44
|
+
task :test_statistic => [ :statistic ]
|
45
|
+
task :test_overview => [ :log_overview ]
|
44
46
|
|
45
47
|
#
|
46
48
|
#There are errors
|
@@ -53,7 +55,7 @@ if $0 == __FILE__
|
|
53
55
|
#~ Rake4LaTeX.set_latexrunner_default(:loglevel, Log4r::DEBUG)
|
54
56
|
#~ app.set_latexrunner_default(:texerrors_allowed, true)
|
55
57
|
app[:default].invoke
|
56
|
-
#~ app[:clean].invoke
|
57
58
|
app[:statistic].invoke
|
59
|
+
#~ app[:clean].invoke
|
58
60
|
#~ app[:test].invoke
|
59
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake4latex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Knut Lickert
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-22 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,6 +42,16 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: "0"
|
44
44
|
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: more_unit_test
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
45
55
|
description: |
|
46
56
|
Rake4LaTeX contains rake-tasks to compile LaTeX-projects.
|
47
57
|
Necessary makeindex or bibliography-calls are done,
|
@@ -55,25 +65,25 @@ extensions: []
|
|
55
65
|
extra_rdoc_files: []
|
56
66
|
|
57
67
|
files:
|
58
|
-
- call_rake4latex.rb
|
68
|
+
- bin/call_rake4latex.rb
|
59
69
|
- lib/rake4latex.rb
|
60
|
-
- lib/
|
70
|
+
- lib/rake4latex_dtx.rb
|
61
71
|
- lib/rake4latex_dvipdfm.rb
|
62
72
|
- lib/rake4latex_lualatex.rb
|
63
73
|
- lib/rake4latex_pdflatex.rb
|
64
74
|
- lib/rake4latex_ps2pdf.rb
|
65
75
|
- lib/rake4latex_xelatex.rb
|
76
|
+
- lib/rake4latex/analyse_texfile.rb
|
66
77
|
- lib/rake4latex/base.rb
|
67
|
-
- lib/rake4latex/
|
78
|
+
- lib/rake4latex/clean.rb
|
68
79
|
- lib/rake4latex/latexrunner.rb
|
69
80
|
- lib/rake4latex/splitindex.rb
|
70
81
|
- lib/rake4latex/rules.rb
|
71
82
|
- lib/rake4latex/tex_statistic.rb
|
72
|
-
- lib/rake4latex/template.rb
|
73
83
|
- lib/rake4latex/rake4latex.yaml
|
74
84
|
- readme.txt
|
75
85
|
- readme.html
|
76
|
-
- readme_call_rake4latex.txt
|
86
|
+
- bin/readme_call_rake4latex.txt
|
77
87
|
- license.txt
|
78
88
|
has_rdoc: true
|
79
89
|
homepage: http://gems.rubypla.net/
|
@@ -98,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
108
|
version: "0"
|
99
109
|
version:
|
100
110
|
requirements:
|
101
|
-
- A (La)TeX-system
|
111
|
+
- A (La)TeX-system with bibTeX, makeindex...
|
102
112
|
rubyforge_project: rake4latex
|
103
113
|
rubygems_version: 1.3.5
|
104
114
|
signing_key:
|
@@ -107,27 +117,44 @@ summary: Rake4LaTeX contains rake-tasks to compile TeX-Documents.
|
|
107
117
|
test_files:
|
108
118
|
- test/_expected/bibtex_test.txt
|
109
119
|
- test/_expected/bibtex_test_bib.txt
|
120
|
+
- test/_expected/bibtex_test_build_rakefile.txt
|
121
|
+
- test/_expected/dtx_test.txt
|
122
|
+
- test/_expected/dtx_test_sty.txt
|
110
123
|
- test/_expected/dvipdfm_test.txt
|
124
|
+
- test/_expected/error_test.txt
|
125
|
+
- test/_expected/error_test_ignore_error.txt
|
126
|
+
- test/_expected/error_test_overview.txt
|
127
|
+
- test/_expected/error_test_statistic.txt
|
111
128
|
- test/_expected/gloss_test.txt
|
112
129
|
- test/_expected/gloss_test_bib.txt
|
130
|
+
- test/_expected/gloss_test_build_rakefile.txt
|
113
131
|
- test/_expected/includes_test.txt
|
132
|
+
- test/_expected/includes_test_build_rakefile.txt
|
114
133
|
- test/_expected/index_test.txt
|
115
134
|
- test/_expected/longtable_test.txt
|
116
135
|
- test/_expected/minitoc_test.txt
|
117
136
|
- test/_expected/ps2pdf_test.txt
|
137
|
+
- test/_expected/rail_error_test.txt
|
118
138
|
- test/_expected/rail_test.txt
|
119
|
-
- test/_expected/rail_test_error.txt
|
120
139
|
- test/_expected/splitindex_test.txt
|
140
|
+
- test/_expected/splitindex_test_build_rakefile.txt
|
121
141
|
- test/_expected/supertabular_test.txt
|
122
142
|
- test/_expected/supertabular_test_statistic.txt
|
143
|
+
- test/_expected/varioref_test.txt
|
144
|
+
- test/_expected/varioref_test_ignore_error.txt
|
123
145
|
- test/_expected/z_complex_test.txt
|
146
|
+
- test/_expected/z_complex_test_overview.txt
|
147
|
+
- test/_expected/z_complex_test_statistic.txt
|
124
148
|
- test/_test_call/test_call.rb
|
125
149
|
- test/_test_call/testdocument.tex
|
126
150
|
- test/bibtex/rakefile.rb
|
127
151
|
- test/bibtex/testdocument.bib
|
128
152
|
- test/bibtex/testdocument.tex
|
153
|
+
- test/dtx/rakefile.rb
|
129
154
|
- test/dvipdfm/rakefile.rb
|
130
155
|
- test/dvipdfm/testdocument.tex
|
156
|
+
- test/error/rakefile.rb
|
157
|
+
- test/error/testdocument.tex
|
131
158
|
- test/gloss/rakefile.rb
|
132
159
|
- test/gloss/test_gloss.bib
|
133
160
|
- test/gloss/testdocument.tex
|
@@ -145,7 +172,8 @@ test_files:
|
|
145
172
|
- test/ps2pdf/testdocument.tex
|
146
173
|
- test/rail/rakefile.rb
|
147
174
|
- test/rail/testrail.tex
|
148
|
-
- test/
|
175
|
+
- test/rail_error/rakefile.rb
|
176
|
+
- test/rail_error/testrail_error.tex
|
149
177
|
- test/splitindex/rakefile.rb
|
150
178
|
- test/splitindex/testdocument.tex
|
151
179
|
- test/supertabular/rakefile.rb
|
@@ -154,6 +182,10 @@ test_files:
|
|
154
182
|
- test/testdocument.tex
|
155
183
|
- test/unittest_rake4latex.rb
|
156
184
|
- test/unittest_rake4latex.rb
|
185
|
+
- test/unittest_rake4latex_testcases.rb
|
186
|
+
- test/unittest_rake4latex_testcases.rb
|
187
|
+
- test/varioref/rakefile.rb
|
188
|
+
- test/varioref/testdocument.tex
|
157
189
|
- test/z_complex/rakefile.rb
|
158
190
|
- test/z_complex/testdocument.bib
|
159
191
|
- test/z_complex/testdocument.tex
|
@@ -1,105 +0,0 @@
|
|
1
|
-
module Rake4LaTeX
|
2
|
-
#
|
3
|
-
#Class to determine dependecies of a LaTeX project.
|
4
|
-
#
|
5
|
-
#* \input/\include: searched recursive
|
6
|
-
#
|
7
|
-
#Not done (yet):
|
8
|
-
#* check kpsewhich if files are not found
|
9
|
-
#* scan for \bibliography{testdocument} and search via kpsewhich
|
10
|
-
# rule '.bbl' => 'xxx.bib'
|
11
|
-
#
|
12
|
-
class LaTeXDependencies
|
13
|
-
def self.get_dependecies(filename, *arguments)
|
14
|
-
new(filename).get_dependecies(*arguments)
|
15
|
-
end
|
16
|
-
#
|
17
|
-
#Define the main file for the dependecy-analyse.
|
18
|
-
def initialize( filename )
|
19
|
-
@filename = filename
|
20
|
-
raise ArgumentError, "File #{@filename} not found" unless File.exist?(@filename)
|
21
|
-
@basedir = File.dirname(filename)
|
22
|
-
@basename = File.basename(filename)
|
23
|
-
end
|
24
|
-
=begin rdoc
|
25
|
-
Get all dependecies.
|
26
|
-
|
27
|
-
Which dependecies you get is defined by the arguments:
|
28
|
-
* :inputs: All sub files, loaded with \input and \include
|
29
|
-
There are also predefined actions:
|
30
|
-
* :flat: flat the nested dependecies and delete double entries.
|
31
|
-
Missing dependecies:
|
32
|
-
*index (ind)
|
33
|
-
*bibliography (bbl? + bib)
|
34
|
-
*splitindex
|
35
|
-
=end
|
36
|
-
def get_dependecies(*arguments)
|
37
|
-
deps = [ @filename ]
|
38
|
-
arguments.each{|arg|
|
39
|
-
case arg
|
40
|
-
when :inputs; deps << find_included_files
|
41
|
-
when :flat #Action done at end
|
42
|
-
else
|
43
|
-
raise ArgumentError, "Unknown option #{arg}"
|
44
|
-
end
|
45
|
-
}
|
46
|
-
|
47
|
-
if arguments.include?(:flat)
|
48
|
-
return deps.flatten.uniq
|
49
|
-
else
|
50
|
-
return deps
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
=begin rdoc
|
55
|
-
Finds the files given as arguments to the <tt>\includeonly</tt>, <tt>\include</tt>
|
56
|
-
and <tt>\input</tt> latex command in file _file_ and returns a nested array of their
|
57
|
-
names (relative to the directory of file).
|
58
|
-
=end
|
59
|
-
def find_included_files()
|
60
|
-
deps = []
|
61
|
-
#Change to the basedir of the main_file and start from there the recursive analyse.
|
62
|
-
Dir.chdir(@basedir){
|
63
|
-
begin
|
64
|
-
deps = find_included_files_rec( @basename )
|
65
|
-
rescue Errno::EMFILE => err
|
66
|
-
raise "Recursive include structure in #{@filename}"
|
67
|
-
end
|
68
|
-
}
|
69
|
-
deps
|
70
|
-
end #self.find_included_files
|
71
|
-
#
|
72
|
-
=begin rdoc
|
73
|
-
There is a bit trouble with the basedir of TeX-files,
|
74
|
-
All includes must be located relative to the main_file.
|
75
|
-
|
76
|
-
There is no check on the file found by kpsewhich ##fixme##
|
77
|
-
=end
|
78
|
-
def find_included_files_rec( file )
|
79
|
-
|
80
|
-
raise ArgumentError, "File #{file} not found" unless File.exist?(file)
|
81
|
-
deps = []
|
82
|
-
|
83
|
-
File.foreach(file){ |line|
|
84
|
-
#Skip comments, then look for input macros
|
85
|
-
#Remarks:
|
86
|
-
#* A \% is not detected.
|
87
|
-
#* \endinput is not detected
|
88
|
-
line.sub(/%.*/, '').scan(/\\(?:include|input|includeonly)\{([^}]+)\}/){|m|
|
89
|
-
m.each{|ifile|
|
90
|
-
ifile = ifile.ext('tex') #add the extension tex if not already done.
|
91
|
-
deps << ifile
|
92
|
-
|
93
|
-
if File.exist?(ifile)
|
94
|
-
subdeps = find_included_files_rec(ifile) #Get includes in include file
|
95
|
-
deps << subdeps unless subdeps.empty? #add sub-includes if available
|
96
|
-
else
|
97
|
-
puts "Include-File #{ifile} not found" #fixme puts/log...
|
98
|
-
end
|
99
|
-
}#hit
|
100
|
-
}#line.scan
|
101
|
-
}#File.foreach
|
102
|
-
deps
|
103
|
-
end #self.find_included_files
|
104
|
-
end #LaTeXDependencies
|
105
|
-
end #Rake4LaTeX
|
data/lib/rake4latex/template.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
#
|
2
|
-
#Little helper to build the initial rakefile
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
#Little helper to build the initial rakefile
|
8
|
-
#
|
9
|
-
module Rake4LaTeX
|
10
|
-
#
|
11
|
-
#Template for a basic rakefile
|
12
|
-
#
|
13
|
-
Template = <<Template
|
14
|
-
require 'rake4latex'
|
15
|
-
|
16
|
-
#Needed for some actions without a previous TeX-call
|
17
|
-
task :basefile => 'testdocument.tex'
|
18
|
-
|
19
|
-
file 'testdocument.pdf' => 'testdocument.tex' #prerequisite for a PDF-file
|
20
|
-
file 'testdocument.dvi' => 'testdocument.tex' #prerequisite for a DVI-file
|
21
|
-
|
22
|
-
#Force the compilation
|
23
|
-
task :touch => 'testdocument.tex'
|
24
|
-
|
25
|
-
#Define the default tasks
|
26
|
-
#~ task :default => :touch #Force the first TeX-call
|
27
|
-
task :default => 'testdocument.pdf' #build the pdf
|
28
|
-
#~ task :default => 'testdocument.dvi' #build the dvi
|
29
|
-
task :default => :statistic #Get an overview on errors and warnings
|
30
|
-
task :default => :clean #delete helpfiles
|
31
|
-
|
32
|
-
#Make the rakefile self-executable
|
33
|
-
if $0 == __FILE__
|
34
|
-
app = Rake.application
|
35
|
-
app[:default].invoke #start default tasks
|
36
|
-
end
|
37
|
-
Template
|
38
|
-
|
39
|
-
#~ rake4LaTeX.set_latexrunner_default(:maxruns, 1)
|
40
|
-
#~ rake4LaTeX.set_latexrunner_default(:loglevel, Log4r::DEBUG)
|
41
|
-
#~ rake4LaTeX.set_latexrunner_default(:texerrors_allowed, true)
|
42
|
-
|
43
|
-
|
44
|
-
=begin rdoc
|
45
|
-
Build atemplate for a rakefile.
|
46
|
-
|
47
|
-
=end
|
48
|
-
def self.template( basename = nil)
|
49
|
-
basename = basename.ext()
|
50
|
-
template = Template.dup
|
51
|
-
template.gsub!( /testdocument/, basename ) if basename
|
52
|
-
template
|
53
|
-
end #self.template( filename = nil)
|
54
|
-
|
55
|
-
end #Rake4LaTeX
|
56
|
-
|
57
|
-
if $0 == __FILE__
|
58
|
-
require 'rake'
|
59
|
-
puts Rake4LaTeX.template('testdokument.pdf')
|
60
|
-
end
|