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
@@ -122,8 +122,6 @@ opts.on("-v", "--version", "Version") { |v|
|
|
122
122
|
puts "Rake4LaTeX-Caller Version #{Rake4LaTeX::VERSION}"
|
123
123
|
}
|
124
124
|
|
125
|
-
|
126
|
-
|
127
125
|
#Parsen der Parameter mit Exception bei ung�ltigen Parametern
|
128
126
|
begin
|
129
127
|
opts.parse!
|
@@ -139,7 +137,7 @@ begin
|
|
139
137
|
task (:default => :touch)
|
140
138
|
when :dependecies
|
141
139
|
puts "Build dependecies for #{target.ext('tex')}" if PARSE_MESSAGES
|
142
|
-
|
140
|
+
TeXfile.new(target.ext('tex')).includes(:recursive, :uniq).each{|dep|
|
143
141
|
puts " => #{dep.inspect}" if PARSE_MESSAGES
|
144
142
|
task (target => dep)
|
145
143
|
}
|
@@ -166,3 +164,8 @@ TASK_AFTER_TeX.each{|task|
|
|
166
164
|
|
167
165
|
app = Rake.application
|
168
166
|
app[:default].invoke
|
167
|
+
|
168
|
+
if $0 == __FILE__
|
169
|
+
puts "Finished, please enter any key"
|
170
|
+
STDIN.getc
|
171
|
+
end
|
File without changes
|
data/lib/rake4latex.rb
CHANGED
@@ -26,7 +26,11 @@ A not-so minimal rakefile looks like this:
|
|
26
26
|
|
27
27
|
You can generate a rakefile template with:
|
28
28
|
require 'rake4latex'
|
29
|
-
puts Rake4LaTeX.
|
29
|
+
puts Rake4LaTeX.build_rakefile( [basename, :all ] )
|
30
|
+
|
31
|
+
The method will print a rakefile definition.
|
32
|
+
|
33
|
+
More about the task can be found in section 'Special Tasks'
|
30
34
|
|
31
35
|
===call_rake4latex.rb
|
32
36
|
When you think, your project is too small to create a rakefile,
|
@@ -98,24 +102,15 @@ You must define your dependencies your own (but there is a help to do so, see ne
|
|
98
102
|
Example:
|
99
103
|
file 'testdocument.dvi' => ['testdocument.tex', 'testincludes/testinclude1.tex']
|
100
104
|
|
101
|
-
|
102
|
-
===Determine Dependecies: LaTeXDependencies.get_dependecies( )
|
105
|
+
===Determine Dependecies
|
103
106
|
You can automatically compute dependencies for the latex task:
|
104
|
-
|
105
|
-
Options may be:
|
106
|
-
* :inputs:
|
107
|
-
|
108
|
-
The input file (the one which is passed to latex) is read, and the arguments of the
|
109
|
-
<tt>\includeonly</tt>, <tt>\include</tt> and <tt>\input</tt> latex commands are
|
110
|
-
extracted. Each of this these files is scanned again for dependecies.
|
111
|
-
|
112
|
-
The result is a nested array with all dependecies.
|
113
|
-
|
114
|
-
* :flat:
|
115
|
-
The (nested) result is flatted and double entries are deleted.
|
107
|
+
Rake4LaTeX::TeXfile.new(filename).includes( [options] )
|
116
108
|
|
117
109
|
You can use it already direct in your dependecies definition:
|
118
|
-
file 'testdocument.dvi' =>
|
110
|
+
file 'testdocument.dvi' => Rake4LaTeX::TeXfile.new('testdocument.tex').includes(:recursive, :uniq )
|
111
|
+
|
112
|
+
Alternative you can generate your rakefile:
|
113
|
+
Rake4LaTeX.build_rakefile( filename )
|
119
114
|
|
120
115
|
===Dependecies for BibTeX
|
121
116
|
BibTeX depends on two files:
|
@@ -135,18 +130,14 @@ The bbl-dependecy is needed to start a new BibTeX-run.
|
|
135
130
|
The following tools are supported by rake4latex:
|
136
131
|
* Makeindex with makeidx.sty
|
137
132
|
* BibTeX
|
133
|
+
* Rail[http://www.ctan.org/tex-archive/support/rail/]
|
138
134
|
|
139
135
|
===Supported (checked) packages
|
140
136
|
The rake process to generate the document is independent of any
|
141
137
|
package.
|
142
|
-
But some packages requires additional
|
143
|
-
|
144
|
-
The following packages are tested and work fine:
|
145
|
-
* minitoc
|
146
|
-
* longtable
|
147
|
-
* supertabular
|
138
|
+
But some packages requires additional actions.
|
148
139
|
|
149
|
-
For the following packages
|
140
|
+
For the following packages exist special solutions:
|
150
141
|
* splitindex (splitindex is replaced by internal routines)
|
151
142
|
http://www.ctan.org/tex-archive/macros/latex/contrib/splitindex/
|
152
143
|
* gloss (glossary based on bibTeX)
|
@@ -154,6 +145,97 @@ For the following packages exists special solutions:
|
|
154
145
|
* rail (creating rail-diagramms)
|
155
146
|
http://www.ctan.org/tex-archive/support/rail/
|
156
147
|
|
148
|
+
==Special Tasks
|
149
|
+
===basefile
|
150
|
+
There are some tasks in Rake4LaTeX who needs a connected TeX-file.
|
151
|
+
The task basefile defines such a connection.
|
152
|
+
|
153
|
+
From rakes view, it's just a dummy-task to define prerequisites
|
154
|
+
for other tasks.
|
155
|
+
|
156
|
+
Tasks using basefile are:
|
157
|
+
* touch
|
158
|
+
* statistic
|
159
|
+
* log_overview
|
160
|
+
* log_archive
|
161
|
+
* clean
|
162
|
+
* clobber
|
163
|
+
|
164
|
+
If you build a pdf (or dvi), basefile-actions are done in background.
|
165
|
+
|
166
|
+
It is recommended to define your main-file as basefile.
|
167
|
+
Without this, clean... may not work correct.
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
===touch
|
172
|
+
The touch task changes the modification data for the touched file.
|
173
|
+
In the result you can force a new TeX-run.
|
174
|
+
|
175
|
+
Usage:
|
176
|
+
task :touch => 'myfile.tex'
|
177
|
+
task :default => touch
|
178
|
+
|
179
|
+
With
|
180
|
+
task :basefile => 'myfile'
|
181
|
+
touch is also connected with your sourcefile.
|
182
|
+
|
183
|
+
===statistic
|
184
|
+
Get a very short overview on the log-content.
|
185
|
+
Errors and warnings are counted for each log (TeX, bibTeX, makeindex...)
|
186
|
+
|
187
|
+
Usage:
|
188
|
+
task :basefile => 'myfile'
|
189
|
+
task :statistic
|
190
|
+
task :default => [ 'myfile.pdf', :statistic ]
|
191
|
+
|
192
|
+
See also Rake4LaTeX#TeX_Statistic#stat_summary
|
193
|
+
|
194
|
+
===log_overview
|
195
|
+
A log-file is created with a log-summary (TeX_Statistic#stat_summary),
|
196
|
+
all errors and warnings from TeX and the tools and
|
197
|
+
a detailed analyse for the TeX-log.
|
198
|
+
|
199
|
+
You should do this task always _before_ a clean-task.
|
200
|
+
|
201
|
+
Usage:
|
202
|
+
task :basefile => 'myfile'
|
203
|
+
task :log_overview
|
204
|
+
task :default => [ 'myfile.pdf', :log_overview ]
|
205
|
+
|
206
|
+
|
207
|
+
See also Rake4LaTeX#TeX_Statistic#overview
|
208
|
+
|
209
|
+
===clean
|
210
|
+
TeX and the related tools build a lot of auxiliary files.
|
211
|
+
When you have them, you can delete the auxiliary files.
|
212
|
+
|
213
|
+
The task _clean_ does exactly this.
|
214
|
+
|
215
|
+
If you also want to delete the results (pdf...) you can use the task
|
216
|
+
_clobber_.
|
217
|
+
|
218
|
+
Usage:
|
219
|
+
task :basefile => 'myfile'
|
220
|
+
task :default => [ 'myfile.pdf', :clean ]
|
221
|
+
|
222
|
+
|
223
|
+
===log_archive
|
224
|
+
With _clean_ you loose all logs.
|
225
|
+
With _log_archive_ you create a zip-file with all logs.
|
226
|
+
|
227
|
+
_log_archive_ makes only sense in combination with _clean_.
|
228
|
+
First archive the logs, then delete them with _clean_.
|
229
|
+
After this you have _one_ file with all your logs and
|
230
|
+
in case of errors you can make analyses in the archived logs.
|
231
|
+
|
232
|
+
You should do this task always _before_ a clean-task.
|
233
|
+
|
234
|
+
Usage:
|
235
|
+
task :basefile => 'myfile'
|
236
|
+
task :default => [ 'myfile.pdf', :log_archive, :clean ]
|
237
|
+
|
238
|
+
|
157
239
|
==Adding new tasks
|
158
240
|
===Normal tasks
|
159
241
|
Task to generate pictures or other stuff needed to
|
@@ -213,33 +295,15 @@ See also section 'Multiple runs'
|
|
213
295
|
* No plan to solve it.
|
214
296
|
Not a big problem, and why you need a rakefile for such simple tex-files?
|
215
297
|
|
216
|
-
* No usage of kpsewhich.
|
217
|
-
|
218
|
-
LaTeXDependencies#get_dependecies checks dependecies only relative to
|
219
|
-
the file location.
|
220
|
-
kpsewhich is not used.
|
221
|
-
* Would be nice escpecially for BibTeX and scan for \bibliography{xxx}
|
222
|
-
* Low priority
|
223
|
-
|
224
298
|
===Packages with problems
|
225
299
|
There are additional packages requiring additonal runs.
|
226
300
|
|
227
|
-
* glossaries (glossary based on makeindex) -
|
301
|
+
* glossaries (glossary based on makeindex) - see test cases or use gloss.sty.
|
228
302
|
* multiind/index (multiple index) - support not planned.
|
229
303
|
Please use splitindex or inform me about your need.
|
230
|
-
* rail (rail syntax diagramms) - see tests, the rakefile includes the solution.
|
231
|
-
|
232
|
-
|
233
304
|
|
234
305
|
=end
|
235
306
|
|
236
|
-
<<weiter
|
237
|
-
fixmes
|
238
|
-
- glossaries
|
239
|
-
|
240
|
-
task statistic/log-analyse ausbauen.
|
241
|
-
task pack unpack logarchive
|
242
|
-
weiter
|
243
307
|
|
244
308
|
#
|
245
309
|
#Load the base functions and load subfiles.
|
@@ -0,0 +1,375 @@
|
|
1
|
+
|
2
|
+
if $0 == __FILE__
|
3
|
+
require 'rake4latex'
|
4
|
+
end
|
5
|
+
|
6
|
+
module Rake4LaTeX
|
7
|
+
=begin rdoc
|
8
|
+
This class collects informations for an existing (La)TeX-File.
|
9
|
+
|
10
|
+
It can be used to determine dependecies of a LaTeX project.
|
11
|
+
|
12
|
+
What's not done:
|
13
|
+
* check kpsewhich if files are not found
|
14
|
+
* Analyse styles
|
15
|
+
*
|
16
|
+
|
17
|
+
=end
|
18
|
+
class TeXfile
|
19
|
+
|
20
|
+
#fixme: global logger
|
21
|
+
@@log = Log4r::Logger.new("LaTeXRunner", Log4r::ERROR)
|
22
|
+
@@log.outputters = Log4r::StdoutOutputter.new('log_stdout')
|
23
|
+
|
24
|
+
=begin rdoc
|
25
|
+
Define a TeXfile.
|
26
|
+
|
27
|
+
If the include-analyse should work correct,
|
28
|
+
the work directory should be the place, where you find your file.
|
29
|
+
|
30
|
+
If filename is :dummy, you get a dummy-file for little extracts.
|
31
|
+
=end
|
32
|
+
def initialize( filename )
|
33
|
+
|
34
|
+
@filename = filename
|
35
|
+
@@log.debug("TeXfile to analyse: #{@filename}")
|
36
|
+
#~ @@log.warn("Start TeXfile analyse in foreign directory") unless File.dirname(filename) == '.'
|
37
|
+
|
38
|
+
#List of filenames of the includes
|
39
|
+
@includes = []
|
40
|
+
#Hash with the objects for the include files.
|
41
|
+
@include_object = {}
|
42
|
+
@bibliography = []
|
43
|
+
@gloss = {} #bib-files for gloss.sty
|
44
|
+
@splitindex = {}
|
45
|
+
|
46
|
+
if @filename != :dummy
|
47
|
+
@basename = File.basename(filename)
|
48
|
+
raise ArgumentError, "File #{@filename} not found" unless File.exist?(@filename)
|
49
|
+
analyse( File.read(@filename) )
|
50
|
+
end
|
51
|
+
end
|
52
|
+
=begin rdoc
|
53
|
+
List of all includes.
|
54
|
+
|
55
|
+
Options:
|
56
|
+
* :recurssive - get all includes, including includes of includes
|
57
|
+
* :uniq - delete double includes
|
58
|
+
=end
|
59
|
+
def includes( *options )
|
60
|
+
if options.include?(:recursive)
|
61
|
+
includes = tree.flatten - [ @filename ]
|
62
|
+
else
|
63
|
+
includes = @includes
|
64
|
+
end
|
65
|
+
includes.uniq! if options.include?(:uniq)
|
66
|
+
includes
|
67
|
+
end
|
68
|
+
=begin rdoc
|
69
|
+
If bibTeX is used, this Array contains all bibliography.
|
70
|
+
=end
|
71
|
+
attr_reader :bibliography
|
72
|
+
=begin rdoc
|
73
|
+
If gloss.sty is used, this Hash contains all glossaries and there bibliography.
|
74
|
+
=end
|
75
|
+
attr_reader :gloss
|
76
|
+
=begin rdoc
|
77
|
+
If splitindex is used, this Array contains all indeces.
|
78
|
+
=end
|
79
|
+
attr_reader :splitindex
|
80
|
+
|
81
|
+
=begin rdoc
|
82
|
+
Analyse the file.
|
83
|
+
|
84
|
+
Search dependecies by sanning for
|
85
|
+
* \input/\include
|
86
|
+
* \bibliography
|
87
|
+
* \printgloss (gloss.sty, like bibliography)
|
88
|
+
* \newindex (splitindex, like makeindex)
|
89
|
+
=end
|
90
|
+
def analyse(content )
|
91
|
+
|
92
|
+
content.each{ |line|
|
93
|
+
#Skip comments
|
94
|
+
#Remarks/Bug:
|
95
|
+
#* \% is not detected.
|
96
|
+
#* \iffalse...\fi is not detected.
|
97
|
+
line.sub!(/%.*/, '')
|
98
|
+
break if line =~ %r{\\endinput(\s|\Z)} #Stop at \endinput
|
99
|
+
#Detect \macro[]{}
|
100
|
+
line.scan(/\\(include|input|includeonly|bibliography|printgloss|newindex)(\[.*?\])?\{([^}]+)\}/){|m|
|
101
|
+
case m[0]
|
102
|
+
#~ when 'includeonly'
|
103
|
+
when 'include', 'input'
|
104
|
+
includename = m[2].ext('tex') #add the extension tex if not already done.
|
105
|
+
@includes << includename
|
106
|
+
when 'bibliography'
|
107
|
+
#~ @bibliography << m[2].ext('bib')
|
108
|
+
@bibliography << m[2].split(/,/).map{|f| f.ext('bib')}
|
109
|
+
@bibliography.flatten!
|
110
|
+
when 'printgloss'
|
111
|
+
m[1] = 'gls' unless m[1]
|
112
|
+
@gloss[m[1]] ||= [] << m[2].split(/,/).map{|f| f.ext('bib')}
|
113
|
+
@gloss[m[1]].flatten!
|
114
|
+
when 'newindex'
|
115
|
+
#m[1] contains the optional name
|
116
|
+
@splitindex[m[2]] = m[1]
|
117
|
+
end #case m[0]
|
118
|
+
}#line.scan
|
119
|
+
}#File.foreach
|
120
|
+
|
121
|
+
@includes.each{|includename|
|
122
|
+
if File.exist?(includename)
|
123
|
+
if @include_object[includename]
|
124
|
+
#fixme recursiv...
|
125
|
+
#This check detects only a double input in one file.
|
126
|
+
@@log.warn("Double input of #{includename} in #{@filename}")
|
127
|
+
else
|
128
|
+
@include_object[includename] = TeXfile.new(includename)
|
129
|
+
end
|
130
|
+
else
|
131
|
+
@@log.warn("Include-File #{includename} not found")
|
132
|
+
end
|
133
|
+
}
|
134
|
+
|
135
|
+
#Check the bibTeX-File in the TeXMF-trees (using kpsewhich)
|
136
|
+
@bibliography.map!{|bib| kpsewhich(bib) }
|
137
|
+
@gloss.each{|key,bibs| bibs.map!{|bib| kpsewhich(bib) }}
|
138
|
+
end
|
139
|
+
=begin rdoc
|
140
|
+
Check with kpsewhich to get a file location.
|
141
|
+
|
142
|
+
If nothing is found, take the original name.
|
143
|
+
=end
|
144
|
+
def kpsewhich( filename )
|
145
|
+
hit = `kpsewhich #{filename}`
|
146
|
+
@@log.warn("Include-File #{filename} not found") if hit.empty?
|
147
|
+
hit.empty? ? filename : hit.strip
|
148
|
+
end
|
149
|
+
=begin
|
150
|
+
Get a tree-like view of all includes.
|
151
|
+
=end
|
152
|
+
def tree()
|
153
|
+
tree = [@filename]
|
154
|
+
#Only first occurence and without a sequence
|
155
|
+
#~ @include_object.each{|name, inc|
|
156
|
+
#~ tree << inc.tree
|
157
|
+
#~ }
|
158
|
+
|
159
|
+
@includes.each{|name|
|
160
|
+
if @include_object[name]
|
161
|
+
tree << @include_object[name].tree
|
162
|
+
else
|
163
|
+
tree << name
|
164
|
+
end
|
165
|
+
}
|
166
|
+
|
167
|
+
tree
|
168
|
+
end
|
169
|
+
def inspect()
|
170
|
+
"<TeXfile #{@filename}>"
|
171
|
+
end
|
172
|
+
end #TeXfile
|
173
|
+
|
174
|
+
|
175
|
+
#List of all options for Rake4LaTeX.build_rakefile
|
176
|
+
BUILD_RAKEFILE_OPTIONS = [
|
177
|
+
:pdf, #add rule to create a pdf
|
178
|
+
:dvi, #add rule to create a dvi
|
179
|
+
:dependecies, #Analyse dependecies and add them
|
180
|
+
:bib, #Add bibliography-dependecies (1)
|
181
|
+
:gloss, #Add gloss.sty-dependecies
|
182
|
+
:splitindex
|
183
|
+
]
|
184
|
+
#
|
185
|
+
#Build a rakefile
|
186
|
+
#
|
187
|
+
#Options:
|
188
|
+
#* :pdf - add rule to create a pdf
|
189
|
+
#* :dvi - add rule to create a dvi
|
190
|
+
#* :dependecies - Analyse dependecies and add them
|
191
|
+
#* :bib: Add bibliography-dependecies (1)
|
192
|
+
#* :gloss: Add gloss.sty-dependecies
|
193
|
+
#* :splitindex
|
194
|
+
#* :all - all options,
|
195
|
+
#
|
196
|
+
#Remarks:
|
197
|
+
#
|
198
|
+
#(1) The bibTeX-files are searched via kpsewhich.
|
199
|
+
#local files get a "./" in froint of hte name.
|
200
|
+
#
|
201
|
+
def self.build_rakefile( filename, *options )
|
202
|
+
|
203
|
+
options.concat(BUILD_RAKEFILE_OPTIONS) if options.delete(:all )
|
204
|
+
( options - BUILD_RAKEFILE_OPTIONS ).each{|opt|
|
205
|
+
Rake4LaTeX::Logger.warn("Undefined option #{opt} in Rake4LaTeX.build_rakefile")
|
206
|
+
}
|
207
|
+
basename = filename.ext()
|
208
|
+
tex_name = filename.ext('tex')
|
209
|
+
pdf_name = filename.ext('pdf')
|
210
|
+
dvi_name = filename.ext('dvi')
|
211
|
+
aux_name = filename.ext('aux')
|
212
|
+
texfile = Rake4LaTeX::TeXfile.new(tex_name)
|
213
|
+
#
|
214
|
+
#Template for a basic rakefile
|
215
|
+
#
|
216
|
+
template = <<Template
|
217
|
+
=begin
|
218
|
+
Rakefile for LaTeX-project #{basename}
|
219
|
+
|
220
|
+
Generated by Rake4LaTeX.build_rakefile, #{Date.today}
|
221
|
+
|
222
|
+
=end
|
223
|
+
require 'rake4latex'
|
224
|
+
|
225
|
+
#Needed for some actions without a previous TeX-call
|
226
|
+
task :basefile => '#{tex_name}'
|
227
|
+
|
228
|
+
Template
|
229
|
+
|
230
|
+
template << <<Template
|
231
|
+
#
|
232
|
+
# Define Dependecies
|
233
|
+
#
|
234
|
+
Template
|
235
|
+
|
236
|
+
template << "file '#{pdf_name}' => '#{tex_name}'\n" if options.include?(:pdf)
|
237
|
+
template << "file '#{dvi_name}' => '#{tex_name}'\n" if options.include?(:dvi)
|
238
|
+
if options.include?(:dependecies)
|
239
|
+
includes = texfile.includes(:uniq, :recursive)
|
240
|
+
if ! includes.empty?
|
241
|
+
template << <<Template
|
242
|
+
#{texfile.tree.to_yaml.map{|line| "# #{line}"}}
|
243
|
+
dependecies = [
|
244
|
+
#{includes.map{|f| " \"#{f}\",\n"}}]
|
245
|
+
Template
|
246
|
+
template << "file '#{pdf_name}' => dependecies\n" if options.include?(:pdf)
|
247
|
+
template << "file '#{dvi_name}' => dependecies\n" if options.include?(:dvi)
|
248
|
+
end
|
249
|
+
end #options.include?(:dependecies)
|
250
|
+
|
251
|
+
if options.include?(:bib) and ! texfile.bibliography.empty?
|
252
|
+
template << <<Template
|
253
|
+
|
254
|
+
=begin
|
255
|
+
bib-file dependecies
|
256
|
+
=end
|
257
|
+
Template
|
258
|
+
template << "file '#{basename}.bbl' => #{texfile.bibliography.uniq.inspect}\n"
|
259
|
+
template << "file '#{pdf_name}' => #{texfile.bibliography.uniq.inspect}\n" if options.include?(:pdf)
|
260
|
+
template << "file '#{dvi_name}' => #{texfile.bibliography.uniq.inspect}\n" if options.include?(:dvi)
|
261
|
+
end #options.include?(:bib)
|
262
|
+
|
263
|
+
if options.include?(:gloss) and ! texfile.gloss.empty?
|
264
|
+
template << <<Template
|
265
|
+
|
266
|
+
=begin
|
267
|
+
bib-file dependecies for gloss-style
|
268
|
+
=end
|
269
|
+
Template
|
270
|
+
texfile.gloss.each{|glossar, bib|
|
271
|
+
template << "# glossar #{glossar}\n"
|
272
|
+
template << "file '#{basename}.#{glossar}.bbl' => #{bib.uniq.inspect}\n"
|
273
|
+
template << "file '#{basename}.#{glossar}.bbl' => '#{aux_name}'\n"
|
274
|
+
|
275
|
+
template << "file '#{pdf_name}' => #{bib.uniq.inspect}\n" if options.include?(:pdf)
|
276
|
+
template << "file '#{dvi_name}' => #{bib.uniq.inspect}\n" if options.include?(:dvi)
|
277
|
+
}
|
278
|
+
end #options.include?(:bib)
|
279
|
+
|
280
|
+
if options.include?(:splitindex) and ! texfile.splitindex.empty?
|
281
|
+
template << <<Template
|
282
|
+
|
283
|
+
=begin
|
284
|
+
dependecies for splitindex
|
285
|
+
=end
|
286
|
+
Template
|
287
|
+
texfile.splitindex.each{|splitindex, indexname|
|
288
|
+
template << "# Index #{splitindex} #{indexname}\n"
|
289
|
+
template << "file '#{basename}-#{splitindex}.ind' => '#{basename}-#{splitindex}.idx'\n"
|
290
|
+
template << "file '#{pdf_name}' => '#{basename}-#{splitindex}.ind'\n" if options.include?(:pdf)
|
291
|
+
template << "file '#{dvi_name}' => '#{basename}-#{splitindex}.ind'\n" if options.include?(:dvi)
|
292
|
+
}
|
293
|
+
end #options.include?(:bib)
|
294
|
+
|
295
|
+
|
296
|
+
template << <<Template
|
297
|
+
|
298
|
+
#Force the compilation
|
299
|
+
task :touch => '#{tex_name}'
|
300
|
+
|
301
|
+
Template
|
302
|
+
|
303
|
+
template << <<Template
|
304
|
+
=begin
|
305
|
+
Define the default tasks
|
306
|
+
=end
|
307
|
+
#~ task :default => :touch #Force the first TeX-call
|
308
|
+
Template
|
309
|
+
|
310
|
+
template << "task :default => '#{pdf_name}' #build the pdf\n" if options.include?(:pdf)
|
311
|
+
template << "task :default => '#{dvi_name}' #build the dvi\n" if options.include?(:dvi)
|
312
|
+
|
313
|
+
template << <<Template
|
314
|
+
|
315
|
+
=begin
|
316
|
+
Closing Tasks
|
317
|
+
=end
|
318
|
+
task :default => :statistic #Get an overview on errors and warnings
|
319
|
+
task :default => :clean #delete helpfiles
|
320
|
+
|
321
|
+
Template
|
322
|
+
|
323
|
+
template << <<Template
|
324
|
+
=begin
|
325
|
+
Make the rakefile self-executable
|
326
|
+
=end
|
327
|
+
if $0 == __FILE__
|
328
|
+
app = Rake.application
|
329
|
+
#~ Rake4LaTeX.set_latexrunner_default(:texerrors_allowed, true)
|
330
|
+
app[:default].invoke #start default tasks
|
331
|
+
end
|
332
|
+
Template
|
333
|
+
|
334
|
+
template
|
335
|
+
end #self.template( filename = nil)
|
336
|
+
|
337
|
+
|
338
|
+
end #Rake4LaTeX
|
339
|
+
|
340
|
+
if $0 == __FILE__
|
341
|
+
#fixmes:
|
342
|
+
#Parameter "xx.sty" -> analyse also this style
|
343
|
+
|
344
|
+
#~ file = Rake4LaTeX::TeXfile.new(:dummy)
|
345
|
+
#~ file.analyse(<<'xx'
|
346
|
+
#~ \input{aaa}
|
347
|
+
#~ \bibliography{test}
|
348
|
+
#~ \bibliography{testdocument}
|
349
|
+
#~ xx
|
350
|
+
#~ )
|
351
|
+
#~ puts file
|
352
|
+
#~ puts file.includes.inspect
|
353
|
+
#~ puts file.bibliography.inspect
|
354
|
+
#~ puts file.splitindex.inspect
|
355
|
+
#~ puts file.tree.to_yaml
|
356
|
+
#~ exit
|
357
|
+
|
358
|
+
Dir.chdir('../../test'){
|
359
|
+
#~ Dir.chdir('gloss'){
|
360
|
+
Dir.chdir('bibtex'){
|
361
|
+
#~ Dir.chdir('includes'){
|
362
|
+
#~ Dir.chdir('splitindex'){
|
363
|
+
#~ file = Rake4LaTeX::TeXfile.new('testdocument.tex')
|
364
|
+
#~ puts file
|
365
|
+
#~ puts file.includes.inspect
|
366
|
+
#~ puts file.bibliography.inspect
|
367
|
+
#~ puts file.splitindex.inspect
|
368
|
+
#~ puts file.tree.to_yaml
|
369
|
+
|
370
|
+
#~ puts Rake4LaTeX.build_rakefile('testdocument.tex', :dvi, :pdf, :dependecies, :bib, :gloss, :splitindex )
|
371
|
+
puts Rake4LaTeX.build_rakefile('testdocument.tex', :all)
|
372
|
+
}
|
373
|
+
}
|
374
|
+
|
375
|
+
end
|