latex-decode 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -3
- data/features/diacritics.feature +0 -1
- data/features/punctuation.feature +1 -0
- data/features/special_characters.feature +1 -1
- data/latex-decode.gemspec +0 -2
- data/lib/latex/decode.rb +1 -3
- data/lib/latex/decode/accents.rb +1 -1
- data/lib/latex/decode/compatibility.rb +38 -0
- data/lib/latex/decode/punctuation.rb +1 -0
- data/lib/latex/decode/version.rb +1 -1
- metadata +12 -23
data/Gemfile
CHANGED
@@ -2,6 +2,9 @@ source :rubygems
|
|
2
2
|
gemspec
|
3
3
|
|
4
4
|
group :development do
|
5
|
-
gem 'ruby-debug19', :require => 'ruby-debug', :platforms => [:
|
6
|
-
gem 'ruby-debug', :platforms => [:
|
7
|
-
end
|
5
|
+
gem 'ruby-debug19', :require => 'ruby-debug', :platforms => [:mri_19]
|
6
|
+
gem 'ruby-debug', :platforms => [:mri_18]
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
gem 'unicode', '~> 0.4', :platforms => [:mri, :rbx, :mswin, :mingw]
|
data/features/diacritics.feature
CHANGED
data/latex-decode.gemspec
CHANGED
@@ -15,8 +15,6 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.description = 'Decodes strings formatted in LaTeX to equivalent Unicode strings.'
|
16
16
|
s.license = 'GPL-3'
|
17
17
|
|
18
|
-
s.add_runtime_dependency('unicode', '~> 0.4')
|
19
|
-
|
20
18
|
s.add_development_dependency('rake', '~> 0.8')
|
21
19
|
s.add_development_dependency('bundler', '~> 1.0')
|
22
20
|
s.add_development_dependency('rdoc', '~> 3.6')
|
data/lib/latex/decode.rb
CHANGED
@@ -17,8 +17,6 @@
|
|
17
17
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
require 'unicode'
|
21
|
-
|
22
20
|
require 'latex/decode/version'
|
23
21
|
require 'latex/decode/compatibility'
|
24
22
|
require 'latex/decode/base'
|
@@ -45,7 +43,7 @@ module LaTeX
|
|
45
43
|
|
46
44
|
Decode::Base.strip_braces(string)
|
47
45
|
|
48
|
-
|
46
|
+
LaTeX.normalize_C(string)
|
49
47
|
end
|
50
48
|
end
|
51
49
|
end
|
data/lib/latex/decode/accents.rb
CHANGED
@@ -17,7 +17,7 @@ module LaTeX
|
|
17
17
|
|
18
18
|
@patterns = [
|
19
19
|
ruby_18 {
|
20
|
-
/\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })\{([[:alpha:]]
|
20
|
+
/\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })\{([[:alpha:]]+)\}/ou
|
21
21
|
} ||
|
22
22
|
ruby_19 {
|
23
23
|
/\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })\{(\p{L}\p{M}*)\}/ou
|
@@ -18,4 +18,42 @@ else
|
|
18
18
|
|
19
19
|
def ruby_18; false; end
|
20
20
|
def ruby_19; yield; end
|
21
|
+
end
|
22
|
+
|
23
|
+
if RUBY_PLATFORM == 'java'
|
24
|
+
require 'java'
|
25
|
+
|
26
|
+
# Use the Java native Unicode normalizer
|
27
|
+
module LaTeX
|
28
|
+
def self.normalize_C(string)
|
29
|
+
java.text.Normalizer.normalize(string, java.text.Normalizer::Form::NFC).to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
else
|
34
|
+
|
35
|
+
begin
|
36
|
+
require 'unicode'
|
37
|
+
|
38
|
+
# Use the Unicode gem
|
39
|
+
module LaTeX
|
40
|
+
def self.normalize_C(string)
|
41
|
+
Unicode::normalize_C(string)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
rescue LoadError
|
45
|
+
begin
|
46
|
+
require 'active_support/multibyte/chars'
|
47
|
+
|
48
|
+
# Use ActiveSupport's normalizer
|
49
|
+
module LaTeX
|
50
|
+
def self.normalize_C(string)
|
51
|
+
ActiveSupport::Multibyte::Chars.new(string).normalize(:c).to_s
|
52
|
+
end
|
53
|
+
end
|
54
|
+
rescue LoadError
|
55
|
+
fail "Failed to load unicode normalizer: please gem install unicode (or active_support)"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
21
59
|
end
|
data/lib/latex/decode/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: latex-decode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: unicode
|
16
|
-
requirement: &70305758476260 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0.4'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: *70305758476260
|
25
14
|
- !ruby/object:Gem::Dependency
|
26
15
|
name: rake
|
27
|
-
requirement: &
|
16
|
+
requirement: &70308628195760 !ruby/object:Gem::Requirement
|
28
17
|
none: false
|
29
18
|
requirements:
|
30
19
|
- - ~>
|
@@ -32,10 +21,10 @@ dependencies:
|
|
32
21
|
version: '0.8'
|
33
22
|
type: :development
|
34
23
|
prerelease: false
|
35
|
-
version_requirements: *
|
24
|
+
version_requirements: *70308628195760
|
36
25
|
- !ruby/object:Gem::Dependency
|
37
26
|
name: bundler
|
38
|
-
requirement: &
|
27
|
+
requirement: &70308628194620 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
29
|
requirements:
|
41
30
|
- - ~>
|
@@ -43,10 +32,10 @@ dependencies:
|
|
43
32
|
version: '1.0'
|
44
33
|
type: :development
|
45
34
|
prerelease: false
|
46
|
-
version_requirements: *
|
35
|
+
version_requirements: *70308628194620
|
47
36
|
- !ruby/object:Gem::Dependency
|
48
37
|
name: rdoc
|
49
|
-
requirement: &
|
38
|
+
requirement: &70308628193800 !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
40
|
requirements:
|
52
41
|
- - ~>
|
@@ -54,10 +43,10 @@ dependencies:
|
|
54
43
|
version: '3.6'
|
55
44
|
type: :development
|
56
45
|
prerelease: false
|
57
|
-
version_requirements: *
|
46
|
+
version_requirements: *70308628193800
|
58
47
|
- !ruby/object:Gem::Dependency
|
59
48
|
name: rspec
|
60
|
-
requirement: &
|
49
|
+
requirement: &70308628213200 !ruby/object:Gem::Requirement
|
61
50
|
none: false
|
62
51
|
requirements:
|
63
52
|
- - ~>
|
@@ -65,10 +54,10 @@ dependencies:
|
|
65
54
|
version: '2.6'
|
66
55
|
type: :development
|
67
56
|
prerelease: false
|
68
|
-
version_requirements: *
|
57
|
+
version_requirements: *70308628213200
|
69
58
|
- !ruby/object:Gem::Dependency
|
70
59
|
name: cucumber
|
71
|
-
requirement: &
|
60
|
+
requirement: &70308628210800 !ruby/object:Gem::Requirement
|
72
61
|
none: false
|
73
62
|
requirements:
|
74
63
|
- - ~>
|
@@ -76,7 +65,7 @@ dependencies:
|
|
76
65
|
version: '1.0'
|
77
66
|
type: :development
|
78
67
|
prerelease: false
|
79
|
-
version_requirements: *
|
68
|
+
version_requirements: *70308628210800
|
80
69
|
description: Decodes strings formatted in LaTeX to equivalent Unicode strings.
|
81
70
|
email:
|
82
71
|
- http://sylvester.keil.or.at
|