to_ascii_latex 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ToAsciiLatex
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -2,6 +2,17 @@ require "to_ascii_latex/version"
2
2
  require 'to_latex'
3
3
 
4
4
  module ToAsciiLatex
5
+ @@smartquotes = false
6
+
7
+ def self.smartquotes
8
+ @@smartquotes
9
+ end
10
+
11
+ def self.smartquotes=(v)
12
+ raise "Unexpected value #{v.inspect} for smartquotes" unless [true, false].include(v)
13
+ @@smartquotes = v
14
+ end
15
+
5
16
  # http://www.fileformat.info/info/unicode/char/fb01/index.htm
6
17
  MAPPING = { "\u2014" => "--",
7
18
  "\u2018" => "`",
@@ -22,6 +33,8 @@ module ToAsciiLatex
22
33
  "\u0B0C" => '?',
23
34
  "\u00B0" => '\ensuremath{^{\circ}}',
24
35
  "\u00A7" => '\S{}',
36
+ "\u20AC" => '\euro{}',
37
+ "\u00A2" => '\textcent{}'
25
38
  }
26
39
  MAPPING_RE = /#{MAPPING.keys.join('|')}/
27
40
 
@@ -37,6 +50,12 @@ module ToAsciiLatex
37
50
  def self.new_escape(s)
38
51
  x = old_escape(s).gsub(MAPPING_RE){|c| MAPPING[c]}.gsub('\backslash{}', '\ensuremath{\backslash}')
39
52
  warn "Unicode in #{x.inspect}" if x.delete("^\u{0000}-\u{007F}") != x
53
+
54
+ if @@smartquotes
55
+ i = 0
56
+ x.gsub!('"'){|q| i += 1; (i % 2 == 0) ? "''" : "``"}
57
+ end
58
+
40
59
  return x
41
60
  end
42
61
 
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.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-19 00:00:00.000000000 Z
12
+ date: 2013-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: to_latex
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  segments:
92
92
  - 0
93
- hash: 19788211
93
+ hash: 460787917
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: 19788211
102
+ hash: 460787917
103
103
  requirements: []
104
104
  rubyforge_project:
105
105
  rubygems_version: 1.8.24