html2tex 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@ class HTML2TeX
23
23
  def next_element
24
24
  if scanner.eos?
25
25
  nil
26
- elsif s = scanner.scan(/<[^>]+>/)
26
+ elsif s = scanner.scan(/<!--|<[^>]+>/)
27
27
  tag(s[/<([^>\s]+)/, 1].downcase)
28
28
  elsif scanner.scan(/\s+/)
29
29
  whitespace
@@ -79,11 +79,25 @@ class HTML2TeX
79
79
  "\\end{itemize}\n"
80
80
  when "li"
81
81
  "\\item "
82
- when "/li"
82
+ when "/li", "/dd"
83
83
  "\n"
84
+ when "dl"
85
+ "\\begin{description}\n"
86
+ when "/dl"
87
+ "\\end{description}\n"
88
+ when "dt"
89
+ "\\item["
90
+ when "/dt"
91
+ "]"
92
+ when "dd"
93
+ " "
84
94
  when /^h\d/
85
95
  @squash_next = true
86
96
  HeadingProcessor.new(scanner, t, @options).to_tex + "\n\n"
97
+ when "script"
98
+ NullProcessor.new(scanner, "</script>", @options).to_tex
99
+ when "!--"
100
+ NullProcessor.new(scanner, "-->", @options).to_tex
87
101
  else
88
102
  ""
89
103
  end
@@ -96,3 +110,4 @@ class HTML2TeX
96
110
  end
97
111
 
98
112
  require "html2tex/heading_processor"
113
+ require "html2tex/null_processor"
@@ -0,0 +1,16 @@
1
+ class HTML2TeX
2
+ class NullProcessor
3
+ attr_reader :scanner, :options
4
+
5
+ def initialize(scanner, end_on, options)
6
+ @scanner = scanner
7
+ @end_on = end_on
8
+ @options = options
9
+ end
10
+
11
+ def to_tex(buffer="")
12
+ scanner.scan(%r{.*?#{Regexp.escape(@end_on)}}im)
13
+ ""
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  class HTML2TeX
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html2tex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Battley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-16 00:00:00 +01:00
12
+ date: 2010-05-23 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -58,6 +58,7 @@ files:
58
58
  - lib/html2tex/basic_processor.rb
59
59
  - lib/html2tex/cli.rb
60
60
  - lib/html2tex/preamble_processor.rb
61
+ - lib/html2tex/null_processor.rb
61
62
  - lib/html2tex/heading_processor.rb
62
63
  - lib/html2tex/tex.rb
63
64
  - README.md