rake4latex 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/call_rake4latex.rb +7 -1
- data/bin/readme_call_rake4latex.txt +1 -0
- data/lib/rake4latex.rb +15 -14
- data/lib/rake4latex/analyse_texfile.rb +6 -4
- data/lib/rake4latex/base.rb +191 -63
- data/lib/rake4latex/clean.rb +9 -6
- data/lib/rake4latex/glossaries.rb +101 -0
- data/lib/rake4latex/latexrunner.rb +16 -27
- data/lib/rake4latex/rules.rb +81 -54
- data/lib/rake4latex/splitindex.rb +0 -1
- data/lib/rake4latex/tex_statistic.rb +18 -6
- data/lib/rake4latex_dtx.rb +3 -3
- data/lib/rake4latex_dvipdfm.rb +2 -2
- data/readme.html +32 -14
- data/readme.txt +21 -11
- data/test/_expected/bibtex_test.txt +9 -9
- data/test/_expected/bibtex_test_bib.txt +4 -4
- data/test/_expected/bibtex_test_build_rakefile.txt +3 -0
- data/test/_expected/dtx_test.txt +11 -11
- data/test/_expected/dvipdfm_test.txt +6 -6
- data/test/_expected/error_test.txt +3 -3
- data/test/_expected/error_test_ignore_error.txt +4 -4
- data/test/_expected/error_test_overview.txt +7 -2
- data/test/_expected/error_test_statistic.txt +2 -2
- data/test/_expected/gloss_test.txt +15 -15
- data/test/_expected/gloss_test_bib.txt +7 -7
- data/test/_expected/gloss_test_build_rakefile.txt +3 -0
- data/test/_expected/glossaries_test.txt +12 -0
- data/test/_expected/includes_test.txt +7 -7
- data/test/_expected/includes_test_build_rakefile.txt +3 -0
- data/test/_expected/index_test.txt +6 -6
- data/test/_expected/longtable_test.txt +5 -5
- data/test/_expected/minitoc_test.txt +7 -7
- data/test/_expected/ps2pdf_test.txt +7 -7
- data/test/_expected/rail_error_test.txt +9 -9
- data/test/_expected/rail_test.txt +6 -6
- data/test/_expected/splitindex_test.txt +7 -7
- data/test/_expected/splitindex_test_build_rakefile.txt +9 -6
- data/test/_expected/supertabular_test.txt +5 -5
- data/test/_expected/supertabular_test_statistic.txt +1 -1
- data/test/_expected/two_tasks_test.txt +15 -0
- data/test/_expected/two_tasks_test_statistic.txt +11 -0
- data/test/_expected/varioref_test.txt +5 -5
- data/test/_expected/varioref_test_ignore_error.txt +7 -7
- data/test/_expected/z_complex_test.txt +12 -11
- data/test/_expected/z_complex_test_overview.txt +24 -9
- data/test/_expected/z_complex_test_overview_file.txt +2 -0
- data/test/_expected/z_complex_test_statistic.txt +2 -2
- data/test/bibtex/rakefile.rb +4 -2
- data/test/dtx/rakefile.rb +3 -3
- data/test/dvipdfm/rakefile.rb +4 -2
- data/test/error/rakefile.rb +10 -6
- data/test/gloss/rakefile.rb +3 -2
- data/test/glossaries/rakefile.rb +50 -0
- data/test/glossaries/sample.tex +133 -0
- data/test/includes/rakefile.rb +7 -6
- data/test/index/rakefile.rb +3 -2
- data/test/longtable/rakefile.rb +3 -2
- data/test/minitoc/rakefile.rb +3 -2
- data/test/ps2pdf/rakefile.rb +3 -2
- data/test/rail/rakefile.rb +5 -4
- data/test/rail_error/rakefile.rb +3 -2
- data/test/splitindex/rakefile.rb +7 -5
- data/test/supertabular/rakefile.rb +3 -2
- data/test/two_tasks/rakefile.rb +50 -0
- data/test/two_tasks/testdocument_1.tex +10 -0
- data/test/two_tasks/testdocument_2.tex +10 -0
- data/test/unittest_rake4latex.rb +27 -4
- data/test/unittest_rake4latex_testcases.rb +27 -11
- data/test/varioref/rakefile.rb +11 -5
- data/test/z_complex/rakefile.rb +8 -6
- data/test/z_complex/testdocument.tex +12 -1
- metadata +149 -28
data/lib/rake4latex/clean.rb
CHANGED
@@ -18,21 +18,24 @@
|
|
18
18
|
# Changes:
|
19
19
|
# * Use File.delete (avoid stderr-messages of rm_r)
|
20
20
|
# * Use LaTeXRunner.logger if available.
|
21
|
-
# *
|
21
|
+
# * Use uniq to avoid warnings for just deleted files.
|
22
22
|
|
23
|
-
require 'rake'
|
23
|
+
require 'rake'
|
24
24
|
|
25
25
|
CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
26
26
|
CLEAN.clear_exclude.exclude { |fn|
|
27
27
|
fn.pathmap("%f") == 'core' && File.directory?(fn)
|
28
28
|
}
|
29
|
+
|
29
30
|
|
30
31
|
desc "Remove any temporary products."
|
31
32
|
#~ task :clean do
|
32
|
-
task :clean
|
33
|
-
|
33
|
+
task :clean do
|
34
|
+
Rake4LaTeX::Basefile.each{|file| file.set4clean } #late call is necessary. doc. says FileList would work without...
|
35
|
+
|
36
|
+
logger = Rake4LaTeX::Logger
|
34
37
|
logger.info("Clean: delete helpfiles #{CLEAN.inspect}") if logger.info?
|
35
|
-
CLEAN.each { |fn|
|
38
|
+
CLEAN.uniq.each { |fn|
|
36
39
|
#~ rm_r fn rescue nil
|
37
40
|
#~ logger.debug("Clean: delete #{fn}") if logger
|
38
41
|
File.delete(fn) rescue ( logger.warn("Clean: #{fn} not deleted") if logger )
|
@@ -45,7 +48,7 @@ desc "Remove any generated file."
|
|
45
48
|
task :clobber => :clean do
|
46
49
|
logger = Rake4LaTeX::Logger
|
47
50
|
logger.info("Clobber: delete helpfiles #{(CLEAN + CLOBBER).inspect}") if logger.info?
|
48
|
-
CLOBBER.each { |fn|
|
51
|
+
CLOBBER.uniq.each { |fn|
|
49
52
|
#~ rm_r fn rescue nil
|
50
53
|
#~ logger.debug("Clobber: delete #{fn}") if logger
|
51
54
|
File.delete(fn) rescue ( logger.warn("Clobber: #{fn} not deleted") if logger )
|
@@ -0,0 +1,101 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
Define tasks for usage of rake4latex with glossaries.sty
|
3
|
+
|
4
|
+
More about glossaries.sty:
|
5
|
+
* http://www.ctan.org/tex-archive/help/Catalogue/entries/glossaries.html
|
6
|
+
* http://www.ctan.org/tex-archive/macros/latex/contrib/glossaries/
|
7
|
+
* http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/glossaries/glossaries-manual.html
|
8
|
+
|
9
|
+
ToDo:
|
10
|
+
The logs from the glossaries are not analysed by Rake4LaTeX::TeXMessage
|
11
|
+
=end
|
12
|
+
|
13
|
+
|
14
|
+
=begin
|
15
|
+
AUX-File:
|
16
|
+
|
17
|
+
\@newglossary{label}{log}{out-ext}{in-ext}
|
18
|
+
|
19
|
+
\@newglossary{main}{glg}{gls}{glo}
|
20
|
+
\@newglossary{ext}{TeX-extensions}{glsext_in}{glsext_out}
|
21
|
+
\@istfilename{sample.ist}
|
22
|
+
|
23
|
+
Anschliessend makeindex rufen.
|
24
|
+
|
25
|
+
Statt ind/idx werden
|
26
|
+
- gls => glo (default)
|
27
|
+
- glsext_in => glsext_out (selbstdefiniert)
|
28
|
+
verwendet.
|
29
|
+
|
30
|
+
Zus�tzlich Index-file ist.
|
31
|
+
=end
|
32
|
+
|
33
|
+
|
34
|
+
module Rake4LaTeX
|
35
|
+
=begin
|
36
|
+
Extend the class by accessors for glossaries.sty.
|
37
|
+
=end
|
38
|
+
class LaTeXRunner
|
39
|
+
=begin rdoc
|
40
|
+
Store information from glossaries.sty to transport it from
|
41
|
+
tex_postrule_check to tex_postrule for 'gls'-task.
|
42
|
+
=end
|
43
|
+
attr_accessor :glossaries
|
44
|
+
=begin rdoc
|
45
|
+
Format for the makefindex call neeeded for glossaries.sty.
|
46
|
+
=end
|
47
|
+
attr_accessor :glossaries_format
|
48
|
+
end #LaTeXRunner
|
49
|
+
end #Rake4LaTeX
|
50
|
+
|
51
|
+
=begin
|
52
|
+
Check glossaries.sty-infos after a TeX-run.
|
53
|
+
|
54
|
+
The data are stored in Rake4LaTeX::LaTeXRunner#glossaries
|
55
|
+
and Rake4LaTeX::LaTeXRunner#glossaries_format .
|
56
|
+
=end
|
57
|
+
desc "Build glossary with glossaries.sty"
|
58
|
+
tex_postrule_check '.gls' do |args|
|
59
|
+
gls = {}
|
60
|
+
File.read(args[:task].name.ext('aux')).each{|auxline|
|
61
|
+
case auxline
|
62
|
+
when /\\@newglossary\{(.*)\}\{(.*)\}\{(.*)\}\{(.*)\}/
|
63
|
+
args[:logger].debug("Found Glossary #{$1}-#{$2}-#{$3}-#{$4}")
|
64
|
+
gls[$1] = { :log => $2, :out => $3, :in => $4 }
|
65
|
+
when /\\@istfilename\{(.*)\}/
|
66
|
+
args[:logger].debug("Found Glossary format definition #{$1}")
|
67
|
+
args[:texrunner].glossaries_format = $1
|
68
|
+
end
|
69
|
+
}
|
70
|
+
|
71
|
+
#Provide glossaries-data to gls-task.
|
72
|
+
args[:texrunner].glossaries = gls
|
73
|
+
gls.empty? ? false : true
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
=begin
|
78
|
+
Build the glossaries from glossaries.sty.
|
79
|
+
|
80
|
+
The data are taken from Rake4LaTeX::LaTeXRunner#glossaries
|
81
|
+
and Rake4LaTeX::LaTeXRunner#glossaries_format .
|
82
|
+
=end
|
83
|
+
desc "Call Makeindex for glossaries with glossaries.sty"
|
84
|
+
tex_postrule '.gls' => '.glo' do | t |
|
85
|
+
#fixme: check for t.texrunner.glossaries
|
86
|
+
t.texrunner.logger.info("Prepare glossaries #{t.texrunner.glossaries.keys.inspect}")
|
87
|
+
t.texrunner.logger.warn("No makeindex-style available for glossaries") unless t.texrunner.glossaries_format
|
88
|
+
t.texrunner.glossaries.each{|key, par|
|
89
|
+
cmd = Rake4LaTeX.build_cmd( 'makeindex',
|
90
|
+
:file_in => t.name.ext(par[:in]), :file_out => t.name.ext(par[:out]),
|
91
|
+
:file_log => t.name.ext(par[:log]), :format => t.texrunner.glossaries_format
|
92
|
+
)
|
93
|
+
#~ puts cmd
|
94
|
+
Rake4LaTeX::Logger.debug("Call #{cmd}")
|
95
|
+
stdout, stderr = catch_screen_output{
|
96
|
+
sh cmd
|
97
|
+
}
|
98
|
+
CLEAN.include(FileList.new("#{t.name.ext()}.{#{par[:in]},#{par[:out]},#{par[:log]}}"))
|
99
|
+
}#$gls.each
|
100
|
+
CLEAN.include(FileList.new(t.texrunner.glossaries_format)) if t.texrunner.glossaries_format
|
101
|
+
end
|
@@ -7,19 +7,7 @@ It calls (pdf|xe|lua)LaTeX and checks if additional tools are needed.
|
|
7
7
|
class LaTeXRunner
|
8
8
|
#Define Infinity (needed for option maxruns.
|
9
9
|
Infinity = 1.0/0
|
10
|
-
|
11
|
-
#Define the main settings for the runner.
|
12
|
-
#
|
13
|
-
#This values can be overwritten with
|
14
|
-
# Rake.application.set_latexrunner_default(:loglevel, Log4r::DEBUG)
|
15
|
-
#
|
16
|
-
DEFAULT_SETTINGS = {
|
17
|
-
:main_file => nil, #only needed for key-check. Must be defined later.
|
18
|
-
:maxruns => 5,
|
19
|
-
:program => :pdflatex, #Valid entries see PROGRAMS
|
20
|
-
:loglevel => Log4r::INFO,
|
21
|
-
:texerrors_allowed => false,
|
22
|
-
}
|
10
|
+
|
23
11
|
=begin rdoc
|
24
12
|
All tasks, which should be executed after a TeX-call.
|
25
13
|
|
@@ -56,15 +44,20 @@ Should return true or false.
|
|
56
44
|
=begin rdoc
|
57
45
|
Define a new runner.
|
58
46
|
|
59
|
-
The settings contain
|
60
|
-
* main_file, see LaTeXRunner#main_file
|
61
|
-
|
47
|
+
The settings must contain:
|
48
|
+
* main_file, see Rake4LaTeX::LaTeXRunner#main_file
|
49
|
+
It may contain the following values:
|
50
|
+
* maxruns, see Rake4LaTeX::LaTeXRunner#maxruns
|
51
|
+
Defaults are defined in Rake4LaTeX::Basefile#settings4LaTeXRunner
|
62
52
|
=end
|
63
53
|
def initialize( settings )
|
64
54
|
|
65
|
-
|
55
|
+
@main_file = settings[:main_file]
|
56
|
+
raise MainfileError, "main_file missing" unless @main_file
|
57
|
+
#Define or get Basefile
|
58
|
+
basefile = Rake4LaTeX::Basefile.set( @main_file )
|
66
59
|
|
67
|
-
@logger =
|
60
|
+
@logger = basefile.logger
|
68
61
|
#~ @logger = Log4r::Logger.new("LaTeXRunner #{settings[:main_file]}")
|
69
62
|
#~ @logger.outputters = Log4r::StdoutOutputter.new('log_stdout')
|
70
63
|
|
@@ -72,7 +65,7 @@ The settings contain the following values:
|
|
72
65
|
#This allows us to overwrite the program settings for a special LaTeXRunner.
|
73
66
|
@programms = Programms.dup
|
74
67
|
|
75
|
-
|
68
|
+
basefile.settings4LaTeXRunner.merge(settings).each{|key, value|
|
76
69
|
#~ puts "#{key}: #{value}"
|
77
70
|
case key
|
78
71
|
when :main_file; @main_file = value
|
@@ -87,7 +80,7 @@ The settings contain the following values:
|
|
87
80
|
raise ArgumentError, "Undefined key #{key} for LaTeXRunner"
|
88
81
|
end
|
89
82
|
}
|
90
|
-
|
83
|
+
|
91
84
|
raise MainfileError, "main_file #{@main_file} not found" unless File.exist?(@main_file)
|
92
85
|
raise ArgumentError, "Maxrun is no number" unless @maxruns.is_a?( Fixnum ) or @maxruns == Infinity
|
93
86
|
|
@@ -95,8 +88,6 @@ The settings contain the following values:
|
|
95
88
|
@input_dir = File.dirname(@main_file)
|
96
89
|
@full_input_dir = File.expand_path(@input_dir)
|
97
90
|
|
98
|
-
#This replacement is global in Rake4LaTeX::Logger -> May be a problem with multiple documents, parallel tasks...
|
99
|
-
@logger.name.replace("LaTeXRunner #{@basename}") #no, only one global Logger.
|
100
91
|
@logger.info( "StartLaTeXRunner for #{@main_file}")
|
101
92
|
|
102
93
|
@rerun_necessary = true #initialize
|
@@ -164,8 +155,6 @@ The settings contain the following values:
|
|
164
155
|
run_latex_once(cmd)
|
165
156
|
end
|
166
157
|
end
|
167
|
-
#Guarentee that help files are deleted in clean.
|
168
|
-
Rake4LaTeX.set4clean( @basename )
|
169
158
|
|
170
159
|
plural_s = "#{@texruns} run#{@texruns>1 ? 's': ''}"
|
171
160
|
if @rerun_necessary
|
@@ -187,7 +176,7 @@ The settings contain the following values:
|
|
187
176
|
checksums = {}
|
188
177
|
FileList["#{@basename.ext('*')}"].each do |file|
|
189
178
|
# Computes a MD5 digest for the given file, reading the file.
|
190
|
-
File.open(file){|f| checksums[file] = MD5.
|
179
|
+
File.open(file){|f| checksums[file] = Digest::MD5.hexdigest(f.read) }
|
191
180
|
end
|
192
181
|
|
193
182
|
@logger.info("Excute #{cmd}")
|
@@ -209,7 +198,7 @@ The settings contain the following values:
|
|
209
198
|
when nil
|
210
199
|
@logger.debug("new file #{file}")
|
211
200
|
checksums[file] = :changed
|
212
|
-
when File.open(file){|f|
|
201
|
+
when File.open(file){|f| Digest::MD5.hexdigest(f.read) }
|
213
202
|
#no message needed
|
214
203
|
#~ @logger.debug("Unchanged file #{file}")
|
215
204
|
else
|
@@ -280,7 +269,7 @@ The settings contain the following values:
|
|
280
269
|
@logger.info("Call target #{post_prereq.name} (#{reason4call})" )
|
281
270
|
post_prereq.invoke()
|
282
271
|
File.open(post_prereq.name){|f|
|
283
|
-
@rerun_necessary = (MD5.
|
272
|
+
@rerun_necessary = ( Digest::MD5.hexdigest(f.read) != checksums[f.path])
|
284
273
|
@logger.info("Rerun necessary (#{f.path} changed)" ) if @rerun_necessary
|
285
274
|
} unless @rerun_necessary #check not necessary, if we already need an additional run
|
286
275
|
break #Only one call necessary
|
data/lib/rake4latex/rules.rb
CHANGED
@@ -28,7 +28,7 @@ This may be done via different ways. You can select your version on your own:
|
|
28
28
|
|
29
29
|
#Some Tools have screen output.
|
30
30
|
#Rake4LaTeX should run silent in background, so we have to redirect the output.
|
31
|
-
require 'catch_output'
|
31
|
+
require 'knut_tools/catch_output'
|
32
32
|
include Catch_output
|
33
33
|
|
34
34
|
desc "Show compiled source in Adobe Acrobat Reader."
|
@@ -40,46 +40,16 @@ task :acroread do |t|
|
|
40
40
|
}
|
41
41
|
end
|
42
42
|
|
43
|
+
=begin
|
44
|
+
Alternative definition instead Rake4LaTeX::Basefile.set(filename)
|
45
|
+
=end
|
43
46
|
desc "Set the basefile - needed for clean and statistic"
|
44
47
|
task :basefile do |task|
|
45
48
|
task.prerequisites.each{|pre|
|
46
49
|
#~ puts "Set basefile #{pre.inspect}"
|
47
|
-
|
48
|
-
|
50
|
+
puts "Task basefile defined for #{pre.inspect} (Please replace it with: Rake4LaTeX::Basefile.set)"
|
51
|
+
Rake4LaTeX::Basefile.new(pre)
|
49
52
|
}
|
50
|
-
task.reenable() #If not the second call for clean will not work.
|
51
|
-
end
|
52
|
-
task :default => :basefile
|
53
|
-
|
54
|
-
desc "Build a log-overview file"
|
55
|
-
task :log_overview => :basefile do
|
56
|
-
Rake.application[:statistic].prerequisites.each{|pre|
|
57
|
-
next if pre == 'basefile' #exclude task :basefile
|
58
|
-
stat = Rake4LaTeX::TeX_Statistic.new(pre)
|
59
|
-
#Filename also used in set4clean
|
60
|
-
File.open("#{pre.ext()}.overview.txt", 'w'){|f|
|
61
|
-
f << stat.overview()
|
62
|
-
}
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
desc "Archive all log-files to zip-file"
|
67
|
-
task :log_archive => :basefile do
|
68
|
-
require 'zip/zipfilesystem'
|
69
|
-
Zip::ZipFile.open("rake4latex_log_archive.zip", Zip::ZipFile::CREATE ){|zip|
|
70
|
-
puts "Pack #{zip.name}"
|
71
|
-
#Store all Files to be deleted
|
72
|
-
CLEAN.each{|filename|
|
73
|
-
zip.file.open(File.basename(filename), 'w'){|f| f << File.open(filename,"rb") {|io| io.read} }
|
74
|
-
}
|
75
|
-
Rake.application[:statistic].prerequisites.each{|pre|
|
76
|
-
next if pre == 'basefile' #exclude task :basefile
|
77
|
-
stat = Rake4LaTeX::TeX_Statistic.new(pre)
|
78
|
-
zip.file.open("#{pre}.overview.txt", 'w'){|f|
|
79
|
-
f << stat.overview()
|
80
|
-
}
|
81
|
-
}
|
82
|
-
} #close zip-file
|
83
53
|
end
|
84
54
|
|
85
55
|
#
|
@@ -92,6 +62,9 @@ task :touch do |task|
|
|
92
62
|
}
|
93
63
|
end
|
94
64
|
|
65
|
+
=begin
|
66
|
+
Call LaTeX
|
67
|
+
=end
|
95
68
|
desc "Build a dvi-file with LaTeX"
|
96
69
|
rule '.dvi' => '.tex' do |task|
|
97
70
|
runner = Rake4LaTeX::LaTeXRunner.new(
|
@@ -102,9 +75,13 @@ rule '.dvi' => '.tex' do |task|
|
|
102
75
|
runner.execute #Does all the work and calls the "post-prerequisites"
|
103
76
|
end
|
104
77
|
|
78
|
+
=begin
|
79
|
+
Call dvips
|
80
|
+
=end
|
105
81
|
desc "Build a ps-file from dvi"
|
106
82
|
rule '.ps' => '.dvi' do |task|
|
107
|
-
|
83
|
+
|
84
|
+
Rake4LaTeX::Basefile.set(task.source).logger.info("Call dvips for <#{task.source}>")
|
108
85
|
cmd = Rake4LaTeX.build_cmd( 'dvips', :filename => task.source )
|
109
86
|
|
110
87
|
stdout, stderr = catch_screen_output{
|
@@ -113,16 +90,18 @@ rule '.ps' => '.dvi' do |task|
|
|
113
90
|
#stderr -> log.
|
114
91
|
}
|
115
92
|
if $? != 0
|
116
|
-
Rake4LaTeX::
|
93
|
+
Rake4LaTeX::Basefile.set(task.source).fatal("There where dvips errors. \n#{stdout}")
|
117
94
|
end
|
118
95
|
end
|
119
96
|
|
120
|
-
|
121
|
-
|
97
|
+
=begin
|
98
|
+
Call Makenindex
|
99
|
+
=end
|
122
100
|
desc "Call Makeindex"
|
123
101
|
tex_postrule '.ind' => '.idx' do |task|
|
124
102
|
#check for splitidx
|
125
|
-
|
103
|
+
#If you use index.sty you will get an error.
|
104
|
+
splitidx = Rake4LaTeX::Splitindex.new(task.source, task.texrunner.logger)
|
126
105
|
if splitidx.makeindex? #standard index, no splitidx
|
127
106
|
#makeindex writes to stderr -> catch it
|
128
107
|
cmd = Rake4LaTeX.build_cmd( 'makeindex', { :file_in => task.source }, task )
|
@@ -136,6 +115,9 @@ tex_postrule '.ind' => '.idx' do |task|
|
|
136
115
|
end
|
137
116
|
end
|
138
117
|
|
118
|
+
=begin
|
119
|
+
Call BibTeX
|
120
|
+
=end
|
139
121
|
desc "Call BibTeX"
|
140
122
|
#Define the precheck
|
141
123
|
tex_postrule_check '.bbl' do |args|
|
@@ -154,6 +136,13 @@ tex_postrule_check '.bbl' do |args|
|
|
154
136
|
else
|
155
137
|
args[:logger].warn("\t#{auxfile} not found in bbl-precheck")
|
156
138
|
end
|
139
|
+
|
140
|
+
#Check, if the bbl is missing.
|
141
|
+
#may occur, if the bbl-file was deleted manual, but no change in aux...
|
142
|
+
# fixme -- provoziert unn�tige bibtex-laeufe.
|
143
|
+
#~ bblfile = args[:task].name.ext('bbl')
|
144
|
+
#~ necessary = "#{bblfile} missing" unless File.exist?(bblfile)
|
145
|
+
|
157
146
|
#Check all prerequisites.
|
158
147
|
#This should be the aux-file and (optional) bib-files.
|
159
148
|
args[:task].prerequisites.each{|post_prereq_pre|
|
@@ -192,8 +181,10 @@ tex_postrule '.bbl' => '.aux' do |task|
|
|
192
181
|
end
|
193
182
|
end
|
194
183
|
|
195
|
-
|
196
|
-
|
184
|
+
=begin
|
185
|
+
Call Rail
|
186
|
+
http://www.ctan.org/tex-archive/support/rail/
|
187
|
+
=end
|
197
188
|
desc "Call Rail"
|
198
189
|
tex_postrule '.rao' => '.rai' do |task|
|
199
190
|
#Rail works only with filenames with 8 characters.
|
@@ -208,7 +199,7 @@ tex_postrule '.rao' => '.rai' do |task|
|
|
208
199
|
task.texrunner.logger.fatal("There where Rail errors.")
|
209
200
|
error = true
|
210
201
|
end
|
211
|
-
stderr.
|
202
|
+
stderr.each_line{|errline|
|
212
203
|
task.texrunner.logger.error("Rail error: #{errline.strip}")
|
213
204
|
error = true
|
214
205
|
}
|
@@ -225,15 +216,51 @@ tex_postrule '.rao' => '.rai' do |task|
|
|
225
216
|
CLEAN.include(task.name)
|
226
217
|
end
|
227
218
|
|
219
|
+
=begin
|
220
|
+
End Task and TeX-independend tasks.
|
228
221
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
end
|
222
|
+
This tasks require a previous Rake4LaTeX::Basefile.set
|
223
|
+
=end
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
=begin
|
228
|
+
Build Statistic.
|
229
|
+
|
230
|
+
The main action is defined in Rake4LaTeX::Basefile
|
231
|
+
=end
|
232
|
+
desc "Build a statistic for all TeX project"
|
233
|
+
task :statistic
|
234
|
+
|
235
|
+
=begin
|
236
|
+
Show the log-overview
|
237
|
+
=end
|
238
|
+
desc "Show the log-overview"
|
239
|
+
task :log_overview
|
240
|
+
|
241
|
+
=begin
|
242
|
+
Build a log-overview file
|
243
|
+
=end
|
244
|
+
desc "Build a log-overview file"
|
245
|
+
task :log_overview_file
|
239
246
|
|
247
|
+
=begin
|
248
|
+
Archive all log-files to zip-file
|
249
|
+
=end
|
250
|
+
desc "Archive all log-files to zip-file"
|
251
|
+
task :log_archive do
|
252
|
+
require 'zip/zipfilesystem'
|
253
|
+
Zip::ZipFile.open("rake4latex_log_archive.zip", Zip::ZipFile::CREATE ){|zip|
|
254
|
+
puts "Pack #{zip.name}"
|
255
|
+
#Store all Files to be deleted
|
256
|
+
CLEAN.each{|filename|
|
257
|
+
zip.file.open(File.basename(filename), 'w'){|f| f << File.open(filename,"rb") {|io| io.read} }
|
258
|
+
}
|
259
|
+
Rake4LaTeX::Basefile.each{|basefile|
|
260
|
+
stat = Rake4LaTeX::TeX_Statistic.new(basefile.basename)
|
261
|
+
zip.file.open("#{basefile.basename}.overview.txt", 'w'){|f|
|
262
|
+
f << stat.overview()
|
263
|
+
}
|
264
|
+
}
|
265
|
+
} #close zip-file
|
266
|
+
end
|