to_ascii_latex 0.0.14 → 0.0.15

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,3 @@
1
1
  module ToAsciiLatex
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -3,17 +3,25 @@ require 'to_latex'
3
3
 
4
4
  module ToAsciiLatex
5
5
  @@smartquotes = false
6
+ @@replace_nbsp = false
6
7
 
7
8
  def self.smartquotes
8
9
  @@smartquotes
9
10
  end
10
-
11
11
  def self.smartquotes=(v)
12
12
  raise "Unexpected value #{v.inspect} for smartquotes" unless [true, false].include?(v)
13
13
  @@smartquotes = v
14
14
  end
15
+ def self.replace_nbsp
16
+ @@replace_nbsp
17
+ end
18
+ def self.replace_nbsp=(v)
19
+ raise "Unexpected value #{v.inspect} for replace_nbsp" unless [true, false].include?(v)
20
+ @@replace_nbsp = v
21
+ end
15
22
 
16
23
  # http://www.fileformat.info/info/unicode/char/fb01/index.htm
24
+ NBSP = "\u00A0"
17
25
  MAPPING = { "\u2014" => "--",
18
26
  "\u2018" => "`",
19
27
  "\u2019" => "'",
@@ -49,6 +57,7 @@ module ToAsciiLatex
49
57
 
50
58
  # Define this new method
51
59
  def self.new_escape(s)
60
+ s = s.gsub(NBSP, ' ') if @@replace_nbsp
52
61
  x = old_escape(s).gsub(MAPPING_RE){|c| MAPPING[c]}.gsub('\backslash{}', '\ensuremath{\backslash}')
53
62
  warn "Unicode in #{x.inspect}" if x.delete("^\u{0000}-\u{007F}") != x
54
63
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_ascii_latex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  segments:
92
92
  - 0
93
- hash: 906972077
93
+ hash: 7342513
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  segments:
101
101
  - 0
102
- hash: 906972077
102
+ hash: 7342513
103
103
  requirements: []
104
104
  rubyforge_project:
105
105
  rubygems_version: 1.8.24