rake4latex 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/call_rake4latex.rb +156 -0
- data/lib/rake4latex.rb +377 -0
- data/lib/rake4latex/latexdependencies.rb +103 -0
- data/lib/rake4latex/latexrunner.rb +268 -0
- data/lib/rake4latex/rules.rb +134 -0
- data/lib/rake4latex/splitindex.rb +88 -0
- data/lib/rake4latex/tex_statistic.rb +509 -0
- data/readme.html +236 -0
- data/readme.txt +186 -0
- data/test/bibtex/rakefile.rb +59 -0
- data/test/bibtex/testdocument.bib +26 -0
- data/test/bibtex/testdocument.tex +16 -0
- data/test/includes/rakefile.rb +36 -0
- data/test/includes/testdocument.tex +24 -0
- data/test/includes/testincludes/testinclude1.tex +7 -0
- data/test/includes/testincludes/testinclude2.tex +2 -0
- data/test/index/rakefile.rb +36 -0
- data/test/index/testdocument.tex +18 -0
- data/test/longtable/rakefile.rb +43 -0
- data/test/longtable/testdocument.tex +28 -0
- data/test/minitoc/rakefile.rb +31 -0
- data/test/minitoc/testdocument.tex +30 -0
- data/test/rail/rakefile.rb +51 -0
- data/test/rail/testrail.tex +32 -0
- data/test/splitindex/rakefile.rb +36 -0
- data/test/splitindex/testdocument.tex +29 -0
- data/test/supertabular/rakefile.rb +48 -0
- data/test/supertabular/testdocument.tex +23 -0
- data/test/testdocument.tex +16 -0
- data/test/unittest_rake4latex.rb +116 -0
- data/test/z_complex/rakefile.rb +59 -0
- data/test/z_complex/testdocument.bib +26 -0
- data/test/z_complex/testdocument.tex +58 -0
- metadata +101 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
#
|
2
|
+
#Checks for a given idx-file if splitindx is used.
|
3
|
+
#
|
4
|
+
class Splitindex
|
5
|
+
def initialize( idx_basename, logger )
|
6
|
+
@basename = idx_basename
|
7
|
+
@logger = logger
|
8
|
+
|
9
|
+
|
10
|
+
if ! File.exist?( @basename )
|
11
|
+
@logger.error("Error: No idx-file for splitindex (#{@basename})")
|
12
|
+
@indices = ['idx']
|
13
|
+
return
|
14
|
+
end
|
15
|
+
|
16
|
+
@targets = {}
|
17
|
+
#Example:
|
18
|
+
#~ \indexentry[Fields]{MANDT!MARA|hyperpage}{4}
|
19
|
+
#~ \indexentry[DataElement]{MANDT!MARA-MANDT|hyperpage}{4}
|
20
|
+
File.readlines(@basename).each{|idx_line|
|
21
|
+
case idx_line
|
22
|
+
when /\indexentry\[(.+?)\]\{(.+?)\}\{(.+?)\}/
|
23
|
+
@targets[$1] ||= [] << "\\indexentry{#{$2}}{#{$3}}"
|
24
|
+
when /\indexentry\{(.+?)\}\{(.+?)\}/
|
25
|
+
@targets['idx'] ||= [] << "\\indexentry{#{$1}}{#{$2}}"
|
26
|
+
end
|
27
|
+
} #File.readlines(@basename)
|
28
|
+
|
29
|
+
@indices = ( @targets.keys << 'idx' ).uniq!
|
30
|
+
end
|
31
|
+
#
|
32
|
+
#Flag if it is no splitindex, but a "normal" index for makeindex.
|
33
|
+
def makeindex?()
|
34
|
+
@indices.size == 1 #idx always added
|
35
|
+
end
|
36
|
+
#Actions:
|
37
|
+
#* Build the splitted idx-files
|
38
|
+
#* add the help files to CLEAN
|
39
|
+
#* call makeindex for each file
|
40
|
+
def execute()
|
41
|
+
@logger.error("Splitindex#execute for normal index") if makeindex? and @logger.info?
|
42
|
+
@logger.info("Build splitindex-files for #{@targets.keys.inspect}") if @logger.info?
|
43
|
+
@targets.each{|target, content|
|
44
|
+
idxname = @basename.sub(/\.idx$/, "-#{target}.idx")
|
45
|
+
@logger.debug("Build Split-index #{target} (#{idxname})")
|
46
|
+
File.open(idxname, 'w'){| idx |
|
47
|
+
idx << content.join("\n")
|
48
|
+
}
|
49
|
+
CLEAN << idxname
|
50
|
+
CLEAN << idxname.ext('ind')
|
51
|
+
CLEAN << idxname.ext('ilg')
|
52
|
+
call_makeindex( idxname )
|
53
|
+
}
|
54
|
+
end
|
55
|
+
#
|
56
|
+
#Call makeindex for the given idx-file
|
57
|
+
def call_makeindex( idxname )
|
58
|
+
stdout, stderr = catch_screen_output{
|
59
|
+
puts `makeindex #{idxname}`
|
60
|
+
}
|
61
|
+
if $? != 0
|
62
|
+
@logger.fatal("There where Makeindex errors. for #{idxname}\n#{stderr}")
|
63
|
+
end
|
64
|
+
end #call_makeindex()
|
65
|
+
#~ #Loop on index names.
|
66
|
+
#~ def each_idxname()
|
67
|
+
#~ idxnames = []
|
68
|
+
#~ @indices.each{|index| #\jobname-index.idx
|
69
|
+
#~ idxnames << @basename.sub(/\.idx$/, "-#{index}.idx")
|
70
|
+
#~ yield index if block_given?
|
71
|
+
#~ }
|
72
|
+
#~ idxnames
|
73
|
+
#~ end
|
74
|
+
end #Splitindex
|
75
|
+
|
76
|
+
__END__
|
77
|
+
#Get existing index-data first
|
78
|
+
|
79
|
+
|
80
|
+
#Call makeindex for each element
|
81
|
+
#~ @job << Makeindex.new( @job,
|
82
|
+
#~ :name => "Sub-Index #{target}",
|
83
|
+
#~ :file_in => "#{@job.basename}-#{target}.idx",
|
84
|
+
#~ :file_out => "#{@job.basename}-#{target}.ind",
|
85
|
+
#~ :file_log => "#{@job.basename}-#{target}.ilg"
|
86
|
+
#~ :format => glossaries_format
|
87
|
+
#~ )
|
88
|
+
#~ }
|
@@ -0,0 +1,509 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
Build a quick overview on the logs for TeX-runs
|
3
|
+
=end
|
4
|
+
|
5
|
+
|
6
|
+
require 'knut_yaml' #fixme
|
7
|
+
|
8
|
+
class TeX_Statistic
|
9
|
+
#Define the main file for the log-analyse.
|
10
|
+
def initialize( filename )
|
11
|
+
@stat = {}
|
12
|
+
|
13
|
+
@texfile = filename.ext('tex')
|
14
|
+
if ! File.exist?(@texfile)
|
15
|
+
@stat['_'] ||= {}
|
16
|
+
@stat['_'][:tex] = "No TeX File #{@texfile} found"
|
17
|
+
end
|
18
|
+
|
19
|
+
#Analyse TeX-log
|
20
|
+
if File.exist?(@texfile.ext('log'))
|
21
|
+
@stat[@texfile.ext('log')] = log_analyse( File.read(@texfile.ext('log')))
|
22
|
+
else
|
23
|
+
@stat['_'] ||= {}
|
24
|
+
@stat['_'][:log] = "No log-file #{File.read(@texfile.ext('log'))} found"
|
25
|
+
end #File.exist?(@texfile.ext('log'))
|
26
|
+
|
27
|
+
#Analyse BibTeX-log
|
28
|
+
if File.exist?(@texfile.ext('blg'))
|
29
|
+
@stat[@texfile.ext('blg')] = blg_analyse(@texfile.ext('blg'))
|
30
|
+
end #File.exist?(@texfile.ext('log'))
|
31
|
+
|
32
|
+
#Analyse index-logs (multiple possible with splitindex)
|
33
|
+
#Example for dirpattern: testdokument{-*,}.ilg
|
34
|
+
Dir["#{@texfile.ext}{-*,}".ext('ilg')].each{|ilg_filename|
|
35
|
+
@stat[ilg_filename] = ilg_analyse(ilg_filename)
|
36
|
+
}
|
37
|
+
|
38
|
+
end
|
39
|
+
#
|
40
|
+
attr_reader :stat
|
41
|
+
#Analyse the TeX-log file.
|
42
|
+
#
|
43
|
+
#The log-text is splitted into files and pages and analysed separatly.
|
44
|
+
#
|
45
|
+
# ----TESTVERSION----
|
46
|
+
def log_analyse_by_file_page(logfilename)
|
47
|
+
log = File.read(logfilename)
|
48
|
+
stat = {}
|
49
|
+
|
50
|
+
#Analyse log for page and source file
|
51
|
+
page = nil #store the actual page
|
52
|
+
file = nil #store the actual file
|
53
|
+
filestack = [] #
|
54
|
+
filecount = Hash.new(0) #numbers of open ( in file, needed to detect end of file
|
55
|
+
filecontent = {nil => ''}#content of a file. The content of sub-includes are not part of this content.
|
56
|
+
|
57
|
+
#New pages looks like "[1.1\n" or [9.9]
|
58
|
+
page_pattern = /^\[(\d+\.\d+)[\]\s]/
|
59
|
+
# inputs looks like "(./filename_en.toc \n" or "(./filename.lot)"
|
60
|
+
file_pattern = /\(((?:\.|c:)\/.*?)[\)\n]/
|
61
|
+
|
62
|
+
#Splitt at the file- and page-patterns and at ( and )
|
63
|
+
#If the ( ) are balanced, then we can detect a file end with )
|
64
|
+
#
|
65
|
+
log.split(/(#{file_pattern}|\(|\)|#{page_pattern})/ ).each{|x|
|
66
|
+
case x #x[0]
|
67
|
+
when file_pattern
|
68
|
+
if x[-1,1] == ')'
|
69
|
+
#~ puts "open and close #{file} on page #{page} #{filestack.inspect}" if file =~ /^\./
|
70
|
+
else
|
71
|
+
file = x.strip.sub(/\(/,'')
|
72
|
+
filestack << file
|
73
|
+
filecount[file] += 1
|
74
|
+
filecontent[file] = ''
|
75
|
+
#~ puts "open #{file} on page #{page} #{filestack.inspect}" if file =~ /^\./
|
76
|
+
end
|
77
|
+
when page_pattern
|
78
|
+
page = $1
|
79
|
+
when '('
|
80
|
+
filecount[file] += 1
|
81
|
+
filecontent[file] << x
|
82
|
+
when ')'
|
83
|
+
filecount[file] = filecount[file] - 1
|
84
|
+
if filecount[file] == 0
|
85
|
+
filestack.pop
|
86
|
+
#~ puts "close #{file} on page #{page} #{filestack.inspect}" if file =~ /^\./
|
87
|
+
stat = log_analyse_content(filecontent[file], file, page)
|
88
|
+
if ! stat.empty?
|
89
|
+
#hier stats sammeln (je vor/hinter input gab es meldungen)
|
90
|
+
puts '============'
|
91
|
+
puts file
|
92
|
+
puts stat.to_yaml
|
93
|
+
end
|
94
|
+
#~ filecontent.delete(file)
|
95
|
+
filecontent[file] = ''
|
96
|
+
file = filestack.last
|
97
|
+
else
|
98
|
+
filecontent[file] << x
|
99
|
+
end
|
100
|
+
else
|
101
|
+
filecontent[file] << x
|
102
|
+
end
|
103
|
+
#~ puts "%6s : %s" % [page, file ]
|
104
|
+
}
|
105
|
+
puts filestack.inspect
|
106
|
+
end
|
107
|
+
|
108
|
+
#Analyse the content of an extract of the TeX-log file.
|
109
|
+
#
|
110
|
+
def log_analyse_content(log, file, page)
|
111
|
+
stat = {}
|
112
|
+
filepage = [" (",
|
113
|
+
file ? "in #{file}" : '',
|
114
|
+
page ? " on page #{page}" : '',
|
115
|
+
")"].join
|
116
|
+
|
117
|
+
log.each{|logline|
|
118
|
+
logline.strip!
|
119
|
+
case logline
|
120
|
+
when /Package (.*) Error: (.*)/
|
121
|
+
stat[:package_error] ||= {}
|
122
|
+
stat[:package_error][$1] ||= [] << $2
|
123
|
+
stat[:package_error][$1].last << filepage
|
124
|
+
when /LaTeX Error:\s*(.*)/
|
125
|
+
( stat[:latex_error] ||= [] ) << $1
|
126
|
+
stat[:latex_error].last << filepage
|
127
|
+
when /Error:/
|
128
|
+
(stat[:error] ||= [] ) << logline
|
129
|
+
stat[:error].last << filepage
|
130
|
+
#~ puts "!#{logline}"
|
131
|
+
when /Package (.*) Warning: (.*)/
|
132
|
+
stat[:package_warning] ||= {}
|
133
|
+
stat[:package_warning][$1] ||= [] << $2
|
134
|
+
stat[:package_warning][$1].last << filepage
|
135
|
+
when /LaTeX Warning:\s*(.*)/
|
136
|
+
(stat[:latex_warning] ||= [] ) << $1
|
137
|
+
stat[:latex_warning].last << filepage
|
138
|
+
when /Warning/
|
139
|
+
#~ puts "!#{logline}"
|
140
|
+
(stat[:warnings] ||= [] ) << logline
|
141
|
+
stat[:warnings].last << filepage
|
142
|
+
#~ when /Package (.*) Info: (.*)/ #A lot of messages
|
143
|
+
#~ stat[:package_info] ||= {}
|
144
|
+
#~ stat[:package_info][$1] ||= [] << $2
|
145
|
+
when /Output written on (.*) \((\d*) pages, (\d*) bytes\)/
|
146
|
+
raise "Double output in #{logfilename}" if stat[:output]
|
147
|
+
stat[:output] = {
|
148
|
+
:name => $1, :pages => $2, :bytes => $3,
|
149
|
+
:kbytes => ($3.to_i / 1024 )
|
150
|
+
}
|
151
|
+
when /Overfull \\hbox \((.*) too wide\) in paragraph at lines (.*)/
|
152
|
+
( stat[:overfull] ||= [] ) << "#{$1} at lines #{$2}"
|
153
|
+
stat[:overfull].last << filepage
|
154
|
+
#~ next if $1.to_i() < @options[:overfull]
|
155
|
+
#~ stat[:overfull] ||= [] << last_message = "#{$1} at lines #{$2}"
|
156
|
+
#~ get_next_lines = 1 #?test
|
157
|
+
when /Underfull (.*box) \(badness (.*)\) (detected|in paragraph) at lines? (.*)/
|
158
|
+
#~ next if $1.to_i() < @options[:underfull]
|
159
|
+
( stat[:underfull] ||= [] )<< last_message = "badness #{$2} at lines #{$4}"
|
160
|
+
stat[:underfull].last << filepage
|
161
|
+
#~ get_next_lines = 1 #?test
|
162
|
+
else
|
163
|
+
#~ puts " #{logline}"
|
164
|
+
end
|
165
|
+
}
|
166
|
+
stat
|
167
|
+
end #log_analyse
|
168
|
+
|
169
|
+
|
170
|
+
#Analyse the content of a TeX-log file.
|
171
|
+
#
|
172
|
+
def log_analyse(log)
|
173
|
+
stat = {}
|
174
|
+
|
175
|
+
log.each{|logline|
|
176
|
+
logline.strip!
|
177
|
+
case logline
|
178
|
+
when /Package (.*) Error: (.*)/
|
179
|
+
stat[:package_error] ||= {}
|
180
|
+
stat[:package_error][$1] ||= [] << $2
|
181
|
+
when /LaTeX Error:\s*(.*)/
|
182
|
+
( stat[:latex_error] ||= [] ) << $1
|
183
|
+
when /Error:/
|
184
|
+
(stat[:error] ||= [] ) << logline
|
185
|
+
#~ puts "!#{logline}"
|
186
|
+
when /Package (.*) Warning: (.*)/
|
187
|
+
stat[:package_warning] ||= {}
|
188
|
+
stat[:package_warning][$1] ||= [] << $2
|
189
|
+
when /LaTeX Warning:\s*(.*)/
|
190
|
+
(stat[:latex_warning] ||= [] ) << $1
|
191
|
+
when /Warning/
|
192
|
+
#~ puts "!#{logline}"
|
193
|
+
(stat[:warnings] ||= [] ) << logline
|
194
|
+
#~ when /Package (.*) Info: (.*)/ #A lot of messages
|
195
|
+
#~ stat[:package_info] ||= {}
|
196
|
+
#~ stat[:package_info][$1] ||= [] << $2
|
197
|
+
when /Output written on (.*) \((\d*) pages, (\d*) bytes\)/
|
198
|
+
raise "Double output in #{logfilename}" if stat[:output]
|
199
|
+
stat[:output] = {
|
200
|
+
:name => $1, :pages => $2, :bytes => $3,
|
201
|
+
:kbytes => ($3.to_i / 1024 )
|
202
|
+
}
|
203
|
+
when /Overfull \\hbox \((.*) too wide\) in paragraph at lines (.*)/
|
204
|
+
( stat[:overfull] ||= [] ) << "#{$1} at lines #{$2}"
|
205
|
+
#~ next if $1.to_i() < @options[:overfull]
|
206
|
+
#~ stat[:overfull] ||= [] << last_message = "#{$1} at lines #{$2}"
|
207
|
+
#~ get_next_lines = 1 #?test
|
208
|
+
when /Underfull (.*box) \(badness (.*)\) (detected|in paragraph) at lines? (.*)/
|
209
|
+
#~ next if $1.to_i() < @options[:underfull]
|
210
|
+
( stat[:underfull] ||= [] )<< last_message = "badness #{$2} at lines #{$4}"
|
211
|
+
#~ get_next_lines = 1 #?test
|
212
|
+
else
|
213
|
+
#~ puts " #{logline}"
|
214
|
+
end
|
215
|
+
}
|
216
|
+
stat
|
217
|
+
end #log_analyse
|
218
|
+
#Analyse the BibTeX-Logfile
|
219
|
+
def blg_analyse(logfilename)
|
220
|
+
stat = {}
|
221
|
+
File.readlines(logfilename).each{ |logline|
|
222
|
+
case logline
|
223
|
+
when /Database file #(.*): (.*)/
|
224
|
+
stat[:info] ||= [] << "Database file #{$2} used"
|
225
|
+
when /Warning--I didn't find a database entry for "(.*)"/
|
226
|
+
stat[:warn] ||= [] << "Databaseentry #{$1} missing"
|
227
|
+
when /Warning--Empty definition in (.*)/
|
228
|
+
stat[:warn] ||= [] << "Empty definition #{$1}"
|
229
|
+
when /Warning--(.*)/
|
230
|
+
stat[:warn] ||= [] << "#{$1}"
|
231
|
+
when /I couldn't open (.*) file (.*)/
|
232
|
+
stat[:error] ||= [] << "#{$1} #{$2} not found"
|
233
|
+
when /I found no (.*) commands---while reading file(.*)/
|
234
|
+
stat[:warn] ||= [] << "found no #{$1} in #{$2}"
|
235
|
+
when /(.*)---line (.*) of file(.*)/
|
236
|
+
#line-number ist unsinnig
|
237
|
+
stat[:error] ||= [] << "#{$1} in #{$3}"
|
238
|
+
end
|
239
|
+
}
|
240
|
+
stat
|
241
|
+
end #log_analyse
|
242
|
+
#Analyse the makeindex-log
|
243
|
+
def ilg_analyse(logfilename)
|
244
|
+
stat = {}
|
245
|
+
error = nil
|
246
|
+
File.readlines(logfilename).each{ |logline|
|
247
|
+
if error #Index error announced in previous line
|
248
|
+
stat[:error] ||= [] << "#{logline.chomp.sub(/.*--/, "")} #{error}"
|
249
|
+
error = nil
|
250
|
+
else
|
251
|
+
case logline
|
252
|
+
when /Scanning input file (.*)\...done \((.*) entries accepted, (.*) rejected\)./
|
253
|
+
#~ stat[:info] ||= [] << "input file #{$1} (#{$2} entries accepted, #{$3} rejected)"
|
254
|
+
stat[:output] ||= []
|
255
|
+
stat[:output] << "Input file: #{$1}"
|
256
|
+
stat[:output] << "Entries accepted: #{$2}"
|
257
|
+
stat[:output] << "Entries rejected: #{$3}"
|
258
|
+
#~ when /done \((.*) entries accepted, (.*) rejected\)./
|
259
|
+
#~ result[:rejected] += $2.to_i() if $2.to_i() > 0
|
260
|
+
when /!! Input index error \(file = (.*), line = (.*)\):/
|
261
|
+
#Error-message on next line
|
262
|
+
error = "(file #{$1} line #{$2}: #{logline})"
|
263
|
+
end
|
264
|
+
end #if error
|
265
|
+
}
|
266
|
+
stat
|
267
|
+
end #log_analyse
|
268
|
+
|
269
|
+
def to_s()
|
270
|
+
<<stat
|
271
|
+
#{@texfile}:
|
272
|
+
#{@stat.to_yaml}
|
273
|
+
stat
|
274
|
+
end
|
275
|
+
end #TeX_Statistic
|
276
|
+
|
277
|
+
if $0 == __FILE__
|
278
|
+
require 'rake'
|
279
|
+
#~ puts TeX_Statistic.new('../testdocument.tex')
|
280
|
+
#~ puts TeX_Statistic.new('C:/usr/Festo/_Projects/PriceCatalog/PriceCatalogTool_en.pdf')
|
281
|
+
s = TeX_Statistic.new('logtest_pcat/PriceCatalogTool_en.pdf')
|
282
|
+
#~ puts s.stat['logtest_pcat/PriceCatalogTool_en.log'].to_yaml
|
283
|
+
|
284
|
+
#Test
|
285
|
+
#~ s.log_analyse_file_page('logtest_pcat/PriceCatalogTool_en.log')
|
286
|
+
s.log_analyse_by_file_page('logtest_pcat/PriceCatalogTool_en.log')
|
287
|
+
end
|
288
|
+
|
289
|
+
__END__
|
290
|
+
|
291
|
+
TeX:
|
292
|
+
logfile.each{|logline|
|
293
|
+
#The previous message is continued, get the rest here
|
294
|
+
if get_next_lines > 0
|
295
|
+
get_next_lines -= 1
|
296
|
+
case logline
|
297
|
+
#Get the line number
|
298
|
+
when /l\.([0-9]*) (.*)/
|
299
|
+
last_message << " #{$2} (line #{$1})".strip
|
300
|
+
#fixme: get also next line (pdflualatex/invalid utf?)
|
301
|
+
else
|
302
|
+
last_message << " (#{logline.chomp()})"
|
303
|
+
end
|
304
|
+
last_message = nil
|
305
|
+
next #continue with the next warning/error
|
306
|
+
end #last_message
|
307
|
+
|
308
|
+
#In case of errors, get the line number where it happens
|
309
|
+
if jump_to_numberline
|
310
|
+
case logline
|
311
|
+
#skip text
|
312
|
+
when /Type H <return> for immediate help./,
|
313
|
+
/^[\.\s]*$/ #empty line
|
314
|
+
#Get the line number
|
315
|
+
when /l\.([0-9]*) (.*)/
|
316
|
+
last_message << " #{$2} (line #{$1})".strip
|
317
|
+
jump_to_numberline = false #numberline reached, continue with log-analyses
|
318
|
+
#fixme: collect text in between?
|
319
|
+
when /See the (.*) package documentation for explanation./
|
320
|
+
last_message << " (package #{$1})"
|
321
|
+
else
|
322
|
+
last_message << " #{logline.strip} ||"
|
323
|
+
end
|
324
|
+
next #continue with the next warning/error
|
325
|
+
end #jump_to_numberline = true; last_message = result[:error].last
|
326
|
+
|
327
|
+
last_message = nil
|
328
|
+
$logline = logline #Only for test surposes
|
329
|
+
case logline
|
330
|
+
when /^! (.*)/
|
331
|
+
case $1
|
332
|
+
#Error messages with line code
|
333
|
+
when /LaTeX Error:\s*(.*)/,
|
334
|
+
/(Undefined control sequence.)/,
|
335
|
+
/(Missing [\$|\{|\}|\\cr] inserted.)/,
|
336
|
+
/(Dimension too large.)/,
|
337
|
+
/(Text line contains an invalid utf-8 sequence.)/, #pdflualatex
|
338
|
+
/(Argument of .* has an extra \})./,
|
339
|
+
/(Paragraph ended before .* was complete.)/,
|
340
|
+
/(Misplaced .+)/,
|
341
|
+
/(Extra \}, or forgotten [\$|\\\\endgroup])/,
|
342
|
+
/You can't use `\\\\end' in internal vertical mode/
|
343
|
+
#~ /(! Emergency stop.)/,
|
344
|
+
#~ /(! Huge page cannot be shipped out.)/
|
345
|
+
:last_entry_to_avoid_comma_error
|
346
|
+
result[:error] << last_message = $1
|
347
|
+
jump_to_numberline = true;
|
348
|
+
#LaTeX-Errors without line.
|
349
|
+
when /(Emergency stop|Huge page cannot be.*)/,
|
350
|
+
/(File ended while scanning use of .*)/,
|
351
|
+
/(==> Fatal error occurred, no output PDF file produced!)/
|
352
|
+
result[:error] << last_message = $1
|
353
|
+
when /Package (.*) Error: (.*)/
|
354
|
+
result[:error] << last_message = "#{$1}.sty:\t#{$2}"
|
355
|
+
jump_to_numberline = true
|
356
|
+
when /Extra alignment tab has been changed to \\cr./
|
357
|
+
result[:error] << last_message = "tabular: wrong alignment"
|
358
|
+
when /pdfTeX warning .*?: (.*)/
|
359
|
+
result[:warning] << last_message = "pdftex: #{$1}"
|
360
|
+
else
|
361
|
+
result[:error] << last_message = "New error to runtex: #{logline.strip}"
|
362
|
+
#~ jump_to_numberline = true; last_message = result[:error].last = result[:error].last
|
363
|
+
@job.log.warn( "#{__FILE__} Uncatched error? <#{$1.inspect}>") if @job.log.warn?
|
364
|
+
end
|
365
|
+
when /(job aborted, no legal \\end found)/,
|
366
|
+
/(==> Fatal error occurred, no output PDF file produced!)/
|
367
|
+
result[:error] << last_message = $1
|
368
|
+
when /Package gloss Info: Writing gloss file (.*).aux/ #Check for gloss.sty
|
369
|
+
@job << BibTeX.new( @job, :source => "#{$1}.aux", :target => "#{$1}.bbl", :log => "#{$1}.blg" )
|
370
|
+
when /Package hyperref Warning: old toc file detected, not used; run LaTeX again/
|
371
|
+
@job.please_rerun("(old toc)")
|
372
|
+
when /LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right./
|
373
|
+
@job.please_rerun("Labels/Toc changed")
|
374
|
+
when /Package longtable Warning: Table widths have changed. Rerun LaTeX./
|
375
|
+
@job.please_rerun("Longtable requires additional calculation)")
|
376
|
+
when /LaTeX Warning: Label (.*)/
|
377
|
+
result[:label]<< last_message = $1
|
378
|
+
when /LaTeX Warning: (Reference .*)/
|
379
|
+
result[:label]<< last_message = $1
|
380
|
+
when /LaTeX Warning: Citation (.*)/
|
381
|
+
result[:citation]<< last_message = $1
|
382
|
+
when /LaTeX Warning: (.*)/
|
383
|
+
result[:warning] << last_message = $1
|
384
|
+
when /Package hyperref Warning: (.*)/
|
385
|
+
result[:warning_hyper]<< last_message = "#{$1}"
|
386
|
+
when /Package rail Warning: Railroad diagram \{(\d*)\} doesn't match on input line (\d*)./
|
387
|
+
@job.log.debug( "#{@step} Rerun necessary (Rail diagram #{$1} on line #{$2})") if @job.log.debug?
|
388
|
+
if @job.stop_rerun?(:rail)
|
389
|
+
@job.log.warn( "#{@step} Rail-Rerun blocked by previous error") if @job.log.warn?
|
390
|
+
else
|
391
|
+
@job.please_rerun( "Rail diagram #{$1} on line #{$2} changed")
|
392
|
+
@job << Rail.new( @job, :source => "#{@job.basename}.rai", :target => "#{@job.basename}.rao" )
|
393
|
+
end
|
394
|
+
when /Package rail Warning: Railroad diagram\(s\) may have changed./
|
395
|
+
@job.log.debug( "#{@step} Rerun necessary (Rail diagram changed)") if @job.log.debug?
|
396
|
+
if @job.stop_rerun?(:rail)
|
397
|
+
@job.log.warn( "#{@step} Rail-Rerun blocked by previous error") if @job.log.warn?
|
398
|
+
else
|
399
|
+
@job.please_rerun( "Rail diagram changed")
|
400
|
+
@job << Rail.new( @job, :source => "#{@job.basename}.rai", :target => "#{@job.basename}.rao" )
|
401
|
+
end
|
402
|
+
#~ when /Package: rail / #Package: rail 1998/05/19
|
403
|
+
#~ @job.log.debug( "#{@step} Package rail detected") if @job.log.debug?
|
404
|
+
#~ @job << Rail.new( @job ) ??
|
405
|
+
when /Package (.*) Warning: (.*)/
|
406
|
+
result[:warning] << last_message = "#{$1}:\t#{$2}"
|
407
|
+
when /Using splitted index at (.*)/ ##Find Splittindex
|
408
|
+
@job.log.debug( "#{@step} Found splitindex for #{$1}") if @job.log.debug?
|
409
|
+
@job << Splitindex.new(@job, :source => $1 )
|
410
|
+
#This message is posted, if index2 is used.
|
411
|
+
#I hope the responsible person for index.sty will take my changes.
|
412
|
+
#If the name is very long, there is a break in the Filename.
|
413
|
+
when /Package index2 Info: (.*) (.*)/
|
414
|
+
@job.log.debug( "#{@step} Index #{$1} detected (->#{$2})") if @job.log.debug?
|
415
|
+
@job.log.warn( "#{@step} Warning: Name #{$2} perhaps cutted") if @job.log.warn? and $1.size != $2.size
|
416
|
+
@job << Makeindex.new( @job,
|
417
|
+
:name => "Index2-#{$1}",
|
418
|
+
:file_in => $1, #"#{@job.basename}.idx",
|
419
|
+
:file_out => $2, #"#{@job.basename}.ind",
|
420
|
+
:file_log => "#{$1}.ilg"
|
421
|
+
#~ :format => glossaries_format
|
422
|
+
)
|
423
|
+
#If you use index.sty:
|
424
|
+
#Unfortenalty there are some missing information to complete the task.
|
425
|
+
#Please use index2.sty
|
426
|
+
when /Writing index file (\S*)/
|
427
|
+
@job.log.debug( "#{@step} Index #{$1} detected") if @job.log.debug?
|
428
|
+
|
429
|
+
if $1 == @job.basename + '.idx' #'normal' standard index
|
430
|
+
name = 'Index'
|
431
|
+
format = nil
|
432
|
+
if @job.filename =~ /\.dtx$/
|
433
|
+
name << '/dtx'
|
434
|
+
format = 'gind.ist'
|
435
|
+
end
|
436
|
+
@job << Makeindex.new( @job,
|
437
|
+
:name => name,
|
438
|
+
:file_in => "#{@job.basename}.idx",
|
439
|
+
:file_out => "#{@job.basename}.ind",
|
440
|
+
:file_log => "#{@job.basename}.ilg",
|
441
|
+
:format => format
|
442
|
+
)
|
443
|
+
else
|
444
|
+
@job.log.warn( "#{@step} Warning: index.sty is not supported, please use index2 (#{$1})") if @job.log.warn?
|
445
|
+
@job.helpfiles << $1
|
446
|
+
end
|
447
|
+
#This message is created by
|
448
|
+
#- glossaries (-> already catched by aux-analyses)
|
449
|
+
#- ltxdoc.cls (for dtx.files)
|
450
|
+
when /Writing glossary file (\S*)/
|
451
|
+
glossfile = $1
|
452
|
+
@job.log.debug( "#{@step} Glossary #{glossfile} detected") if @job.log.debug?
|
453
|
+
|
454
|
+
if @job.filename =~ /\.dtx$/ and glossfile =~ /.glo$/ #ltxdoc.cls
|
455
|
+
@job << Makeindex.new( @job,
|
456
|
+
:name => 'Glossary/dtx',
|
457
|
+
:file_in => glossfile,
|
458
|
+
:file_out => "#{@job.basename}.gls",
|
459
|
+
:file_log => "#{@job.basename}.glg",
|
460
|
+
:format => 'gglo.ist'
|
461
|
+
)
|
462
|
+
else
|
463
|
+
#Possible with usage of glossaries.sty -> catched by aux-analyses
|
464
|
+
@job.log.debug( "#{@step} Glossary in non-dtx found #{glossfile}") if @job.log.debug?
|
465
|
+
end
|
466
|
+
#Add minitocs to helpfiles
|
467
|
+
when /\(minitoc\)\s*Writing (.*\.mtc\d*)/
|
468
|
+
@job.log.debug( "#{@step} Found minitoc-helpfile") if @job.log.debug?
|
469
|
+
@job.helpfiles << $1
|
470
|
+
when /Output written on (.*) \((.*) pages?, (.*) bytes\)/
|
471
|
+
result[:file] = $1
|
472
|
+
result[:pages] = $2.to_i
|
473
|
+
result[:size] = "#{$3.to_i / 1024}KB"
|
474
|
+
|
475
|
+
filedata = []
|
476
|
+
filedata << "#{result[:file]}"
|
477
|
+
filedata << "#{result[:pages]} Page#{'s' if result[:pages] > 1}" if result[:pages]
|
478
|
+
filedata << result[:size] if result[:size]
|
479
|
+
filedata << "#{result[:error].size} Error#{'s' if result[:error].size > 1}" unless result[:error].empty?
|
480
|
+
filedata << "#{result[:overfull].size} Overfull box#{'es' if result[:overfull].size > 1} (> #{@options[:overfull]})" unless result[:overfull].empty?
|
481
|
+
filedata << "#{result[:underfull].size} Underfull box#{'es' if result[:underfull].size > 1} (> #{@options[:underfull]})" unless result[:underfull].empty?
|
482
|
+
#~ result[:fileinfo] = "#{result[:file]} (#{filedata.join(', ')})" unless filedata.empty?
|
483
|
+
result[:fileinfo] = filedata
|
484
|
+
last_message = nil
|
485
|
+
end #case logline
|
486
|
+
} #each.loglines
|
487
|
+
return result
|
488
|
+
end #analyse_logfile
|
489
|
+
|
490
|
+
|
491
|
+
Rail:
|
492
|
+
stderr.each{ |errline|
|
493
|
+
case errline
|
494
|
+
when /(.*), line (.*): (.*)/
|
495
|
+
#$1: Filename (e.g. 'stdin')
|
496
|
+
@result[:error] << "Line #{$2}: #{$3}"
|
497
|
+
@job.stop_rerun( :rail, "Rail: #{$3} on line #{$2}") #block rerun for rail
|
498
|
+
end
|
499
|
+
}
|
500
|
+
|
501
|
+
stdout.each{ |stdout_line|
|
502
|
+
case stdout_line
|
503
|
+
when /This is Rail, Version (.*)\s/
|
504
|
+
@result[:info] << "Rail version #{$1} was called"
|
505
|
+
when /(Der Prozess kann nicht auf die Datei zugreifen, .*)/
|
506
|
+
@result[:error] << "#{$1}"
|
507
|
+
end
|
508
|
+
}
|
509
|
+
|