rubbr 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,7 @@
1
+ == 1.0.4 / 2008-03-07
2
+
3
+ * Added support for the pdflatex engine.
4
+
1
5
  == 1.0.3 / 2008-02-28
2
6
 
3
7
  * Rerun latex when labels are updated.
@@ -2,7 +2,7 @@ require 'optparse'
2
2
  $:.unshift File.dirname(__FILE__)
3
3
 
4
4
  module Rubbr
5
- VERSION = '1.0.3'
5
+ VERSION = '1.0.4'
6
6
 
7
7
  autoload :Options, 'rubbr/options'
8
8
  autoload :Cli, 'rubbr/cli'
@@ -32,6 +32,11 @@ module Rubbr
32
32
  options[:format] = format
33
33
  end
34
34
 
35
+ opts.on('-e', '--engine [ENGINE]', [:pdflatex, :ps, :pdf],
36
+ 'Select processing engine (latex, pdflatex)') do |engine|
37
+ options[:engine] = engine
38
+ end
39
+
35
40
  opts.on('-v', '--view', 'View the document') do
36
41
  options[:view] = true
37
42
  end
@@ -56,20 +61,24 @@ module Rubbr
56
61
  if options[:spell]
57
62
  spell
58
63
  elsif options[:view]
59
- view(options[:format])
64
+ view(options[:format], options[:engine])
60
65
  else
61
- build(options[:format])
66
+ build(options[:format], options[:engine])
62
67
  end
63
68
  end
64
69
 
65
70
  private
66
71
 
67
- def build(format)
68
- Rubbr::Builder.build(format)
72
+ def build(format, engine)
73
+ if engine
74
+ Rubbr::Builder.build(format, engine)
75
+ else
76
+ Rubbr::Builder.build(format)
77
+ end
69
78
  end
70
79
 
71
- def view(format)
72
- build(format)
80
+ def view(format, engine)
81
+ build(format, engine)
73
82
  Rubbr::Viewer.view(format)
74
83
  end
75
84
 
@@ -11,7 +11,7 @@ module Rubbr
11
11
  module Builder
12
12
 
13
13
  # Build to the spesified format.
14
- def self.build(format)
14
+ def self.build(format = :pdf, engine = :latex)
15
15
  case format
16
16
  when :dvi
17
17
  Rubbr::Builder::Tex.build
@@ -19,9 +19,11 @@ module Rubbr
19
19
  Rubbr::Builder::Tex.build
20
20
  Rubbr::Builder::Dvi.build
21
21
  else
22
- Rubbr::Builder::Tex.build
23
- Rubbr::Builder::Dvi.build
24
- Rubbr::Builder::Ps.build
22
+ Rubbr::Builder::Tex.build(engine)
23
+ if engine == :latex
24
+ Rubbr::Builder::Dvi.build
25
+ Rubbr::Builder::Ps.build
26
+ end
25
27
  end
26
28
  end
27
29
 
@@ -2,18 +2,20 @@ module Rubbr
2
2
  module Builder
3
3
  class Tex < Base
4
4
  class << self
5
- def build(output_format = 'dvi')
6
- @output_format = output_format
5
+ def build(engine = :latex)
7
6
 
8
7
  clean_build_dir
9
8
 
10
9
  base_latex_file = Rubbr.options[:base_latex_file]
11
10
  base_bibtex_file = Rubbr.options[:base_bibtex_file]
12
11
 
13
- if output_format == 'pdf'
14
- preprocessor = Rubbr::Runner::PdfLaTeX
15
- else
12
+ case engine
13
+ when :latex
14
+ @output_format = :dvi
16
15
  preprocessor = Rubbr::Runner::LaTeX
16
+ when :pdflatex
17
+ @output_format = :pdf
18
+ preprocessor = Rubbr::Runner::PdfLaTeX
17
19
  end
18
20
 
19
21
  build_dir do
@@ -37,6 +37,18 @@ module Rubbr
37
37
  end
38
38
 
39
39
  def run
40
+ disable_stdinn do
41
+ messages = /^(Overfull|Underfull|No file|Package \w+ Warning:|LaTeX Warning:)/
42
+ run = `#@executable #@input_file`
43
+ @warnings = run.grep(messages).sort
44
+ lines = run.split("\n")
45
+ while lines.shift
46
+ if lines.first =~ /^!/ # LaTeX Error, processing halted
47
+ 3.times { @errors << lines.shift }
48
+ end
49
+ end
50
+ feedback
51
+ end
40
52
  end
41
53
 
42
54
  def feedback
@@ -4,21 +4,6 @@ module Rubbr
4
4
  def initialize(input_file, silent=false, executable='latex')
5
5
  super
6
6
  end
7
-
8
- def run
9
- disable_stdinn do
10
- messages = /^(Overfull|Underfull|No file|Package \w+ Warning:|LaTeX Warning:)/
11
- run = `#@executable #@input_file`
12
- @warnings = run.grep(messages).sort
13
- lines = run.split("\n")
14
- while lines.shift
15
- if lines.first =~ /^!/ # LaTeX Error, processing halted
16
- 3.times { @errors << lines.shift }
17
- end
18
- end
19
- feedback
20
- end
21
- end
22
7
  end
23
8
  end
24
9
  end
@@ -4,21 +4,6 @@ module Rubbr
4
4
  def initialize(input_file, silent=false, executable='pdflatex')
5
5
  super
6
6
  end
7
-
8
- def run
9
- disable_stdinn do
10
- messages = /^(Overfull|Underfull|No file|Package \w+ Warning:)/
11
- run = `#@executable #@input_file`
12
- @warnings = run.grep(messages)
13
- lines = run.split("\n")
14
- while lines.shift
15
- if lines.first =~ /^!/
16
- 3.times { @errors << lines.shift }
17
- end
18
- end
19
- feedback
20
- end
21
- end
22
7
  end
23
8
  end
24
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eivind Uggedal
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-28 00:00:00 +01:00
12
+ date: 2008-03-07 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency