rake4latex 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,7 +55,7 @@ opts.on('-e', "--enforce", "Enforce an initial TeX-run") { |v|
55
55
  }
56
56
 
57
57
  opts.on('-f', "--format FORMAT", "Set the format for TeX-run (pdflatex, xelatex, lualatex)") { |v|
58
- Rake4LaTeX.set_latexrunner_default(:program, v.to_sym)
58
+ Rake4LaTeX::DEFAULT_SETTINGS[:program] = v.to_sym
59
59
  }
60
60
 
61
61
  #
@@ -67,7 +67,7 @@ opts.on('--dep', "--dependecies", "Build dependecies (rakefile recommended)") {
67
67
  }
68
68
  opts.on("-i", "--ignore", "--ignore-error", "Allow LaTeX errors") { |v|
69
69
  puts "Allow LaTeX errors" if PARSE_MESSAGES
70
- Rake4LaTeX.set_latexrunner_default(:texerrors_allowed, true)
70
+ Rake4LaTeX::DEFAULT_SETTINGS[:texerrors_allowed] = true
71
71
  }
72
72
  opts.on("-s", "--statistic", "Show the statistic after TeX-run") { |v|
73
73
  puts "Show the statistic after TeX-run" if PARSE_MESSAGES
@@ -113,26 +113,26 @@ LaTeXRunner-options
113
113
  #
114
114
  opts.on("--maxrun MAXRUN", "Maximum MAXRUN TeX calls") { |v|
115
115
  puts "Set maximum TeX-Runs #{v.inspect}" if PARSE_MESSAGES
116
- Rake4LaTeX.set_latexrunner_default(:maxruns, v.to_i)
117
- #~ LaTeXRunner::DEFAULT_SETTINGS[:maxruns] =
116
+ Rake4LaTeX::DEFAULT_SETTINGS[:maxruns] = v.to_i
118
117
  }
119
118
 
120
119
  opts.on("-l", "--loglevel LEVEL", "Log Level for the logger (1=debug, 2=info(default), 3=warn 4=error)") { |v|
121
120
  puts "Set loglevel to #{v.inspect}" if PARSE_MESSAGES
122
- Rake4LaTeX.set_latexrunner_default(:loglevel, v.to_i)
121
+ Rake4LaTeX::DEFAULT_SETTINGS[:loglevel] = v.to_i
123
122
  }
124
123
 
125
124
  opts.on("-v", "--version", "Version") { |v|
126
125
  puts "Rake4LaTeX-Caller Version #{Rake4LaTeX::VERSION}"
127
126
  }
128
127
 
128
+ task :default #empty dummy task
129
+
129
130
  #Parsen der Parameter mit Exception bei ung�ltigen Parametern
130
131
  begin
131
132
  opts.parse!
132
133
  ARGV.each{|arg|
133
134
  target = arg.ext('pdf')
134
135
  puts "Define target #{target}"
135
- Rake4LaTeX.set4clean(arg)
136
136
  TASK_BEFORE_TeX.each{|task|
137
137
  case task
138
138
  when :enforce
@@ -172,6 +172,9 @@ app = Rake.application
172
172
  app[:default].invoke
173
173
 
174
174
  if $0 == __FILE__
175
- puts "Finished, please enter any key"
176
- STDIN.getc
175
+ if STDIN.tty?
176
+ puts "Finished, please enter any key"
177
+ STDOUT.flush
178
+ STDIN.getc
179
+ end
177
180
  end
@@ -180,23 +180,23 @@ BUILD_RAKEFILE_OPTIONS = [
180
180
  :gloss, #Add gloss.sty-dependecies
181
181
  :splitindex
182
182
  ]
183
- #
184
- #Build a rakefile
185
- #
186
- #Options:
187
- #* :pdf - add rule to create a pdf
188
- #* :dvi - add rule to create a dvi
189
- #* :dependecies - Analyse dependecies and add them
190
- #* :bib: Add bibliography-dependecies (1)
191
- #* :gloss: Add gloss.sty-dependecies
192
- #* :splitindex
193
- #* :all - all options,
194
- #
195
- #Remarks:
196
- #
197
- #(1) The bibTeX-files are searched via kpsewhich.
198
- #local files get a "./" in froint of hte name.
199
- #
183
+ =begin rdoc
184
+ Build a rakefile
185
+
186
+ Options:
187
+ * :pdf - add rule to create a pdf
188
+ * :dvi - add rule to create a dvi
189
+ * :dependecies - Analyse dependecies and add them
190
+ * :bib: Add bibliography-dependecies (1)
191
+ * :gloss: Add gloss.sty-dependecies
192
+ * :splitindex
193
+ * :all - all options,
194
+
195
+ Remarks:
196
+
197
+ (1) The bibTeX-files are searched via kpsewhich.
198
+ local files get a "./" in front of the name.
199
+ =end
200
200
  def self.build_rakefile( filename, *options )
201
201
 
202
202
  options.concat(BUILD_RAKEFILE_OPTIONS) if options.delete(:all )
@@ -222,6 +222,9 @@ Options: #{options.inspect}
222
222
  =end
223
223
  require 'rake4latex'
224
224
 
225
+ #Change default
226
+ #~ Rake4LaTeX::DEFAULT_SETTINGS[:texerrors_allowed] = true
227
+
225
228
  #Needed for some actions without a previous TeX-call
226
229
  task :basefile => '#{tex_name}'
227
230
 
@@ -328,7 +331,6 @@ Make the rakefile self-executable
328
331
  =end
329
332
  if $0 == __FILE__
330
333
  app = Rake.application
331
- #~ Rake4LaTeX.set_latexrunner_default(:texerrors_allowed, true)
332
334
  app[:default].invoke #start default tasks
333
335
  end
334
336
  Template
@@ -13,6 +13,7 @@ case RUBY_VERSION
13
13
  require 'yaml'
14
14
  else; raise "Undefined ruby version #{RUBY_VERSION}"
15
15
  end
16
+
16
17
  require 'log4r' #1.0.5
17
18
 
18
19
  module Rake
@@ -28,7 +29,7 @@ end
28
29
 
29
30
 
30
31
  module Rake4LaTeX
31
- VERSION = '0.1.2'
32
+ VERSION = '0.1.3'
32
33
 
33
34
  #With this creation we define the constants Log4r::DEBUG...
34
35
  Logger = Log4r::Logger.new("LaTeXRunner")
@@ -258,6 +259,7 @@ This method is called by task 'basename' (Basefile#initialize)
258
259
  cleanlist.add("#{@basename}.{rai,rao}") #rail/rail.sty
259
260
  cleanlist.add("#{@basename}.{tdo}") #tdo: todonotes.sty
260
261
  cleanlist.add("#{@basename}.{vrb}") #vrb: beamer.sty (verbatim)
262
+ cleanlist.add("#{@basename}.{lox}") #lox: fixme.sty
261
263
 
262
264
  clobberlist = FileList.new("#{@basename}.{dvi,pdf,ps}")
263
265
  #The * is needed.else the filename is added always. With '*' it is checked for existence
@@ -57,7 +57,7 @@ and Rake4LaTeX::LaTeXRunner#glossaries_format .
57
57
  desc "Build glossary with glossaries.sty"
58
58
  tex_postrule_check '.gls' do |args|
59
59
  gls = {}
60
- File.read(args[:task].name.ext('aux')).each{|auxline|
60
+ File.read(args[:task].name.ext('aux')).each_line{|auxline|
61
61
  case auxline
62
62
  when /\\@newglossary\{(.*)\}\{(.*)\}\{(.*)\}\{(.*)\}/
63
63
  args[:logger].debug("Found Glossary #{$1}-#{$2}-#{$3}-#{$4}")
@@ -58,7 +58,8 @@ ps2pdf:
58
58
  parameters:
59
59
  - value_key: :filename
60
60
  rail:
61
- cmd: C:/usr/texmf/tex/Latex/rail/rail.exe
61
+ # anywhere in path
62
+ cmd: rail.exe
62
63
  comment:
63
64
  - name: -t
64
65
  value_key: :railfile
@@ -194,6 +194,7 @@ tex_postrule '.rao' => '.rai' do |task|
194
194
  stdout, stderr = catch_screen_output{
195
195
  puts `#{cmd}`
196
196
  }
197
+
197
198
  error = false
198
199
  if $? != 0
199
200
  task.texrunner.logger.fatal("There where Rail errors.")
@@ -21,14 +21,18 @@ class Splitindex
21
21
  File.readlines(@basename).each{|idx_line|
22
22
  case idx_line
23
23
  when /\indexentry\[(.+?)\]\{(.+?)\}\{(.+?)\}/
24
- @targets[$1] ||= [] << "\\indexentry{#{$2}}{#{$3}}"
24
+ (@targets[$1] ||= []) << "\\indexentry{#{$2}}{#{$3}}"
25
25
  when /\indexentry\{(.+?)\}\{(.+?)\}/
26
- @targets['idx'] ||= [] << "\\indexentry{#{$1}}{#{$2}}"
26
+ (@targets['idx'] ||= []) << "\\indexentry{#{$1}}{#{$2}}"
27
27
  end
28
28
  } #File.readlines(@basename)
29
29
 
30
30
  @indices = ( @targets.keys << 'idx' ).uniq!
31
31
  end
32
+ #List of all indices
33
+ attr_reader :indices
34
+ #List of all targets and there content
35
+ attr_reader :targets
32
36
  #
33
37
  #Flag if it is no splitindex, but a "normal" index for makeindex.
34
38
  def makeindex?()
@@ -39,6 +43,7 @@ class Splitindex
39
43
  #* add the help files to CLEAN
40
44
  #* call makeindex for each file
41
45
  def execute()
46
+
42
47
  @logger.error("Splitindex#execute for normal index") if makeindex? and @logger.info?
43
48
  @logger.info("Build splitindex-files for #{@targets.keys.inspect}") if @logger.info?
44
49
  @targets.each{|target, content|
@@ -51,7 +56,7 @@ class Splitindex
51
56
  CLEAN << idxname.ext('ind')
52
57
  CLEAN << idxname.ext('ilg')
53
58
  call_makeindex( idxname )
54
- }
59
+ } #@targets.each
55
60
  end
56
61
  #
57
62
  #Call makeindex for the given idx-file
@@ -1,17 +1,17 @@
1
1
  <!--
2
2
 
3
- Build by c:/program files/ruby19/lib/ruby/gems/1.9.1/gems/docgenerator-1.2.0/lib/docgenerator/document.rb
4
- Dir: C:/usr/Script/rake4latex
5
- Creator: rakefile_rake4latex.rb
3
+ Build by c:/program files/ruby19/lib/ruby/gems/1.9.1/gems/docgenerator-2.0.0/lib/docgenerator/document.rb
4
+ Dir: C:/usr/script/rake4latex
5
+ Creator: Docgenerator 2.0.0 - http://rubygems.org/gems/docgenerator
6
6
  Target: readme.html
7
- 2010/09/14 17:46:52
7
+ 2011/08/19 22:08:43
8
8
 
9
9
  Generation-Info-End
10
10
  -->
11
11
  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
12
12
  <html>
13
13
  <head >
14
- <title>Rake4LaTeX V0.1.2</title>
14
+ <title>Rake4LaTeX V0.1.3</title>
15
15
  </head>
16
16
  <body ><h1 >rake4latex: TeX-Build-Tool</h1>
17
17
  <h2 >Introduction</h2>
@@ -48,11 +48,22 @@ You can generate a rakefile template with:
48
48
  </p>
49
49
  <pre>
50
50
  require 'rake4latex'
51
- puts Rake4LaTeX.build_rakefile( [basename] )
51
+ puts Rake4LaTeX.build_rakefile( basename, :pdf, :dependecies )
52
52
  </pre>
53
53
  <p >
54
54
  The method will print a rakefile definition.
55
55
  </p>
56
+ <p >
57
+ Supported options:
58
+ </p>
59
+ <ul >
60
+ <li > :pdf add rule to create a pdf </li>
61
+ <li > :dvi add rule to create a dvi </li>
62
+ <li > :dependecies Analyse dependecies and add them </li>
63
+ <li > :bib Add bibliography-dependecies (1) </li>
64
+ <li > :gloss Add gloss.sty-dependecies </li>
65
+ <li > :splitindex </li>
66
+ </ul>
56
67
  <h3 >call_rake4latex.rb</h3>
57
68
  <p >
58
69
  When you think, your project is too small to create a rakefile, then try call_rake4latex.rb.
@@ -407,7 +418,7 @@ There are additional packages requiring additonal runs.
407
418
  <li > Add tasks log_archive, :log_overview </li>
408
419
  </ul>
409
420
  <p >
410
- 0.1.2
421
+ 0.1.2 2010-09-15
411
422
  </p>
412
423
  <ul >
413
424
  <li > Minor changes in testcases </li>
@@ -419,5 +430,12 @@ There are additional packages requiring additonal runs.
419
430
  <li > Replaced Rake4LaTeX.set_latexrunner_default with Rake4LaTeX::Basefile#[]= </li>
420
431
  <li > Minor corrections for Ruby 1.9 </li>
421
432
  </ul>
433
+ <p >
434
+ 0.1.3 2011-08
435
+ </p>
436
+ <ul >
437
+ <li > clean: add fixme.sty (lox) </li>
438
+ <li > correction splitindex and unittest_splitindex.rb</li>
439
+ </ul>
422
440
  </body>
423
441
  </html>
data/readme.txt CHANGED
@@ -32,10 +32,18 @@ A not-so minimal rakefile looks like this:
32
32
 
33
33
  You can generate a rakefile template with:
34
34
  require 'rake4latex'
35
- puts Rake4LaTeX.build_rakefile( [basename] )
35
+ puts Rake4LaTeX.build_rakefile( basename, :pdf, :dependecies )
36
36
 
37
37
  The method will print a rakefile definition.
38
38
 
39
+ Supported options:
40
+ - :pdf add rule to create a pdf
41
+ - :dvi add rule to create a dvi
42
+ - :dependecies Analyse dependecies and add them
43
+ - :bib Add bibliography-dependecies (1)
44
+ - :gloss Add gloss.sty-dependecies
45
+ - :splitindex
46
+
39
47
  call_rake4latex.rb
40
48
  ------------------------------
41
49
 
@@ -322,7 +330,7 @@ Version History
322
330
  - Better log analyse and statistic
323
331
  - Add tasks log_archive, :log_overview
324
332
 
325
- 0.1.2
333
+ 0.1.2 2010-09-15
326
334
  - Minor changes in testcases
327
335
  - rename task :log_overview to :log_overview_file
328
336
  - task :log_overview shows log overview.
@@ -332,3 +340,7 @@ Version History
332
340
  - Replaced Rake4LaTeX.set_latexrunner_default with Rake4LaTeX::Basefile#[]=
333
341
  - Minor corrections for Ruby 1.9
334
342
 
343
+ 0.1.3 2011-08
344
+ - clean: add fixme.sty (lox)
345
+ - correction splitindex and unittest_splitindex.rb
346
+
@@ -8,6 +8,9 @@ Options: [:dvi, :pdf, :bib]
8
8
  =end
9
9
  require 'rake4latex'
10
10
 
11
+ #Change default
12
+ #~ Rake4LaTeX::DEFAULT_SETTINGS[:texerrors_allowed] = true
13
+
11
14
  #Needed for some actions without a previous TeX-call
12
15
  task :basefile => 'testdocument.tex'
13
16
 
@@ -47,6 +50,5 @@ Make the rakefile self-executable
47
50
  =end
48
51
  if $0 == __FILE__
49
52
  app = Rake.application
50
- #~ Rake4LaTeX.set_latexrunner_default(:texerrors_allowed, true)
51
53
  app[:default].invoke #start default tasks
52
54
  end
@@ -4,9 +4,9 @@ Log-overview for testdocument.tex
4
4
  ---
5
5
  testdocument.log:
6
6
  :latex_errors:
7
- - Undefined control sequence. [log#256]
7
+ - Undefined control sequence. [log#282]
8
8
  :output:
9
- - Output written on testdocument.pdf (1 pages) [log#279]
9
+ - Output written on testdocument.pdf (1 pages) [log#311]
10
10
 
11
11
  ========
12
12
  Detailed analyse of testdocument.log
@@ -15,7 +15,7 @@ testdocument.log:
15
15
  ##The following list may contain wrong line assignments
16
16
  ###########
17
17
  ---
18
- :latex_errors:
19
- - Undefined control sequence. (./testdocument.tex) [log#56] - []
20
18
  :output:
21
- - Output written on testdocument.pdf (1 pages) [page0] [log#17] - []
19
+ - Output written on testdocument.pdf (1 pages) [page0] [log#18] - []
20
+ :latex_errors:
21
+ - Undefined control sequence. (./testdocument.tex) [log#62] - []
@@ -8,6 +8,9 @@ Options: [:dvi, :pdf, :gloss]
8
8
  =end
9
9
  require 'rake4latex'
10
10
 
11
+ #Change default
12
+ #~ Rake4LaTeX::DEFAULT_SETTINGS[:texerrors_allowed] = true
13
+
11
14
  #Needed for some actions without a previous TeX-call
12
15
  task :basefile => 'testdocument.tex'
13
16
 
@@ -54,6 +57,5 @@ Make the rakefile self-executable
54
57
  =end
55
58
  if $0 == __FILE__
56
59
  app = Rake.application
57
- #~ Rake4LaTeX.set_latexrunner_default(:texerrors_allowed, true)
58
60
  app[:default].invoke #start default tasks
59
61
  end
@@ -8,6 +8,9 @@ Options: [:dvi, :pdf, :dependecies]
8
8
  =end
9
9
  require 'rake4latex'
10
10
 
11
+ #Change default
12
+ #~ Rake4LaTeX::DEFAULT_SETTINGS[:texerrors_allowed] = true
13
+
11
14
  #Needed for some actions without a previous TeX-call
12
15
  task :basefile => 'testdocument.tex'
13
16
 
@@ -53,6 +56,5 @@ Make the rakefile self-executable
53
56
  =end
54
57
  if $0 == __FILE__
55
58
  app = Rake.application
56
- #~ Rake4LaTeX.set_latexrunner_default(:texerrors_allowed, true)
57
59
  app[:default].invoke #start default tasks
58
60
  end
@@ -8,6 +8,9 @@ Options: [:pdf, :splitindex]
8
8
  =end
9
9
  require 'rake4latex'
10
10
 
11
+ #Change default
12
+ #~ Rake4LaTeX::DEFAULT_SETTINGS[:texerrors_allowed] = true
13
+
11
14
  #Needed for some actions without a previous TeX-call
12
15
  task :basefile => 'testdocument.tex'
13
16
 
@@ -54,6 +57,5 @@ Make the rakefile self-executable
54
57
  =end
55
58
  if $0 == __FILE__
56
59
  app = Rake.application
57
- #~ Rake4LaTeX.set_latexrunner_default(:texerrors_allowed, true)
58
60
  app[:default].invoke #start default tasks
59
61
  end
@@ -8,4 +8,4 @@
8
8
  FATAL testdocument: There where pdflatex errors. See testdocument.log for details
9
9
  INFO testdocument: TeX-run stopped after 2 runs
10
10
  Statistic for testdocument:
11
- Document : 2 pages, 1 error, 1 warning (testdocument.log)
11
+ Document : 2 pages, 1 error (testdocument.log)
@@ -3,11 +3,32 @@ Log-overview for testdocument.tex
3
3
  Document : 9 pages, 4 warnings (testdocument.log)
4
4
  Bibliography: Used testdocument.bib, 3 warnings (testdocument.blg)
5
5
  Index : 1 entry (testdocument-ani.ilg)
6
- Index : 1 entry (testdocument-fru.ilg)
7
- Index : 1 entry (testdocument-idx.ilg)
8
6
  Index : 1 entry (testdocument-veg.ilg)
9
7
  Index : 1 entry (testdocument-xxx.ilg)
8
+ Index : 2 entries (testdocument-fru.ilg)
9
+ Index : 3 entries (testdocument-idx.ilg)
10
10
  ---
11
+ testdocument.log:
12
+ :package_warnings:
13
+ minitoc(hints):
14
+ - W0030 [log#373]
15
+ - W0023 [log#378]
16
+ - W0039 [log#383]
17
+ - W0023 [log#388]
18
+ - W0024 [log#449]
19
+ :latex_warnings:
20
+ - No \author given. [log#397]
21
+ - Citation `irgendwas' on page 5 undefined on input line 57. [log#428]
22
+ - There were undefined references. [log#463]
23
+ :output:
24
+ - Output written on testdocument.pdf (9 pages) [log#481]
25
+ testdocument.blg:
26
+ :source_information:
27
+ - Database file testdocument.bib used
28
+ :warnings:
29
+ - string name "dtk" is undefined
30
+ - Databaseentry irgendwas missing
31
+ - empty journal in dtk00.4:lickert:blindtext
11
32
  testdocument-ani.ilg:
12
33
  :source_information:
13
34
  - "Input file: testdocument-ani.idx."
@@ -16,12 +37,12 @@ testdocument-ani.ilg:
16
37
  testdocument-fru.ilg:
17
38
  :source_information:
18
39
  - "Input file: testdocument-fru.idx."
19
- - "Entries accepted: 1"
40
+ - "Entries accepted: 2"
20
41
  - "Entries rejected: 0"
21
42
  testdocument-idx.ilg:
22
43
  :source_information:
23
44
  - "Input file: testdocument-idx.idx."
24
- - "Entries accepted: 1"
45
+ - "Entries accepted: 3"
25
46
  - "Entries rejected: 0"
26
47
  testdocument-veg.ilg:
27
48
  :source_information:
@@ -33,27 +54,6 @@ testdocument-xxx.ilg:
33
54
  - "Input file: testdocument-xxx.idx."
34
55
  - "Entries accepted: 1"
35
56
  - "Entries rejected: 0"
36
- testdocument.blg:
37
- :source_information:
38
- - Database file testdocument.bib used
39
- :warnings:
40
- - string name "dtk" is undefined
41
- - Databaseentry irgendwas missing
42
- - empty journal in dtk00.4:lickert:blindtext
43
- testdocument.log:
44
- :latex_warnings:
45
- - No \author given. [log#371]
46
- - Citation `irgendwas' on page 5 undefined on input line 57. [log#418]
47
- - There were undefined references. [log#447]
48
- :output:
49
- - Output written on testdocument.pdf (9 pages) [log#465]
50
- :package_warnings:
51
- minitoc(hints):
52
- - W0030 [log#347]
53
- - W0023 [log#352]
54
- - W0039 [log#357]
55
- - W0023 [log#362]
56
- - W0024 [log#441]
57
57
 
58
58
  ========
59
59
  Detailed analyse of testdocument.log
@@ -62,16 +62,16 @@ testdocument.log:
62
62
  ##The following list may contain wrong line assignments
63
63
  ###########
64
64
  ---
65
- :latex_warnings:
66
- - "No \\author given. (./testdocument.tex) [log#114] - "
67
- - "Citation `irgendwas' on page 5 undefined on input line 57. (./testdocument.tex) [log#145] - "
68
- - "There were undefined references. (./testdocument.tex) [log#166] - "
69
65
  :output:
70
- - "Output written on testdocument.pdf (9 pages) [page0] [log#22] - "
66
+ - Output written on testdocument.pdf (9 pages) [page0] [log#23] - []
71
67
  :package_warnings:
72
68
  minitoc(hints):
73
- - "W0030 (./testdocument.tex) [log#90] - "
74
- - "W0023 (./testdocument.tex) [log#95] - "
75
- - "W0039 (./testdocument.tex) [log#100] - "
76
- - "W0023 (./testdocument.tex) [log#105] - "
77
- - "W0024 (./testdocument.tex) [log#160] - "
69
+ - W0030 (./testdocument.tex) [log#96] - []
70
+ - W0023 (./testdocument.tex) [log#101] - []
71
+ - W0039 (./testdocument.tex) [log#106] - []
72
+ - W0023 (./testdocument.tex) [log#111] - []
73
+ - W0024 (./testdocument.tex) [log#163] - []
74
+ :latex_warnings:
75
+ - No \author given. (./testdocument.tex) [log#120] - []
76
+ - Citation `irgendwas' on page 5 undefined on input line 57. (./testdocument.tex) [log#150] - []
77
+ - There were undefined references. (./testdocument.tex) [log#177] - []