latex-decode 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +63 -0
- data/features/brackets.feature +11 -0
- data/features/diacritics.feature +29 -0
- data/features/non-latex.feature +15 -0
- data/features/punctuation.feature +38 -0
- data/features/step_definitions/latex.rb +2 -2
- data/features/umlauts.feature +7 -3
- data/latex-decode.gemspec +3 -2
- data/lib/latex/decode.rb +35 -2
- data/lib/latex/decode/accents.rb +36 -0
- data/lib/latex/decode/base.rb +57 -0
- data/lib/latex/decode/compatibility.rb +21 -0
- data/lib/latex/decode/diacritics.rb +40 -0
- data/lib/latex/decode/punctuation.rb +50 -0
- data/lib/latex/decode/symbols.rb +222 -0
- data/lib/latex/decode/version.rb +2 -2
- metadata +46 -10
data/README.md
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
LaTeX::Decode
|
2
|
+
=============
|
3
|
+
|
4
|
+
LaTeX::Decode is a Ruby gem to convert LaTeX input to Unicode. Its original
|
5
|
+
use was as an input filter for [BibTeX-Ruby](http://rubygems.org/gems/bibtex-ruby)
|
6
|
+
but can be used independently to decode LaTeX. Many of the patterns used by
|
7
|
+
this Ruby gem are based on François Charette's equivalent Perl module
|
8
|
+
[LaTeX::Decode](https://github.com/fc7/LaTeX-Decode).
|
9
|
+
|
10
|
+
Quickstart
|
11
|
+
----------
|
12
|
+
|
13
|
+
$ [sudo] gem install bibtex-ruby
|
14
|
+
$ irb
|
15
|
+
>> require 'latex/decode'
|
16
|
+
>> LaTeX.decode "dipl\\^{o}me d'\\'{e}tudes sup\\'erieures"
|
17
|
+
=> "diplôme d'études supérieures"
|
18
|
+
|
19
|
+
Compatibility
|
20
|
+
-------------
|
21
|
+
|
22
|
+
Unicode handling is one of the major differences between Ruby 1.8 and newer
|
23
|
+
version; LaTeX::Decode; nevertheless, we try to support 1.8 as best as possible.
|
24
|
+
|
25
|
+
Issues
|
26
|
+
------
|
27
|
+
|
28
|
+
Please use the tracker of the project's
|
29
|
+
[Github repository](https://github.com/inukshuk/latex-decode) to report any
|
30
|
+
issues. When describing intended behaviour, please use the extremely simple
|
31
|
+
syntax of the Cucumber features used by LaTeX::Decode; for instance, you could
|
32
|
+
describe the example above as:
|
33
|
+
|
34
|
+
Feature: Decode LaTeX accents
|
35
|
+
As a hacker who works with LaTeX
|
36
|
+
I want to be able to decode LaTeX accents
|
37
|
+
|
38
|
+
Scenario: A French sentence
|
39
|
+
When I decode the string "dipl\\^{o}me d'\\'{e}tudes sup\\'erieures"
|
40
|
+
Then the result should be "diplôme d'études supérieures"
|
41
|
+
|
42
|
+
Credits
|
43
|
+
-------
|
44
|
+
|
45
|
+
Kudos and thanks to all [contributors](https://github.com/inukshuk/latex-decode/contributors)
|
46
|
+
who have made LaTeX::Decode possible!
|
47
|
+
|
48
|
+
Copyright (C) 2011 [Sylvester Keil](sylvester.keil.or.at)
|
49
|
+
|
50
|
+
Copyright (C) 2010 François Charette
|
51
|
+
|
52
|
+
This program is free software: you can redistribute it and/or modify
|
53
|
+
it under the terms of the GNU General Public License as published by
|
54
|
+
the Free Software Foundation, either version 3 of the License, or
|
55
|
+
(at your option) any later version.
|
56
|
+
|
57
|
+
This program is distributed in the hope that it will be useful,
|
58
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
59
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
60
|
+
GNU General Public License for more details.
|
61
|
+
|
62
|
+
You should have received a copy of the GNU General Public License
|
63
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Feature: Decode LaTeX umlauts
|
2
|
+
As a hacker who works with LaTeX
|
3
|
+
I want to be able to remove brackets around single characters
|
4
|
+
|
5
|
+
Scenario: Single character in curly brackets
|
6
|
+
When I decode the string '{a}'
|
7
|
+
Then the result should be 'a'
|
8
|
+
|
9
|
+
Scenario: German umlauts in curly brackets
|
10
|
+
When I decode the string '{\"A}{\"o}{\"u}'
|
11
|
+
Then the result should be 'Äöü'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Decode LaTeX diacritics
|
2
|
+
As a hacker who works with LaTeX
|
3
|
+
I want to be able to decode LaTeX diacritics
|
4
|
+
|
5
|
+
Scenario Outline: LaTeX to Unicode transformation
|
6
|
+
When I decode the string '<latex>'
|
7
|
+
Then the result should be '<unicode>'
|
8
|
+
|
9
|
+
Scenarios: Diacritics
|
10
|
+
| latex | unicode | description |
|
11
|
+
| \\~{} | ~ | |
|
12
|
+
| \\\`{o} | ò | grave accent |
|
13
|
+
| \\\'{o} | ó | acute accent |
|
14
|
+
| \\^{o} | ô | circumflex |
|
15
|
+
| \\"{o} | ö | umlaut or dieresis |
|
16
|
+
| \\H{o} | ő | long Hungarian umlaut (double acute) |
|
17
|
+
| \\~{o} | õ | tilde |
|
18
|
+
| \\c{c} | ç | cedilla |
|
19
|
+
| \\k{a} | ą | ogonek |
|
20
|
+
| \\l | ł | l with stroke |
|
21
|
+
| \\={o} | ō | macron accent (a bar over the letter) |
|
22
|
+
| \\b{o} | o̱ | bar under the letter |
|
23
|
+
| \\.{o} | ȯ | dot over the letter |
|
24
|
+
| \\d{u} | ụ | dot under the letter |
|
25
|
+
| \\r{a} | å | ring over the letter |
|
26
|
+
| \\u{o} | ŏ | breve over the letter |
|
27
|
+
| \\v{s} | š | caron/hacek ("v") over the letter |
|
28
|
+
| \\t{oo} | o͡o | "tie" (inverted u) over the two letters |
|
29
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: Keep non-LaTeX markup as it is
|
2
|
+
As a hacker who works with LaTeX
|
3
|
+
I want to be preserve non-LaTeX text as it is
|
4
|
+
|
5
|
+
Scenario: Standalone escape characters
|
6
|
+
When I decode the string '\\'
|
7
|
+
Then the result should be '\\'
|
8
|
+
|
9
|
+
Scenario: Common markup in Regular Expressions
|
10
|
+
When I decode the string '.*'
|
11
|
+
Then the result should be '.*'
|
12
|
+
When I decode the string '^x$'
|
13
|
+
Then the result should be '^x$'
|
14
|
+
When I decode the string '\\\\2'
|
15
|
+
Then the result should be '\\\\2'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Feature: Decode LaTeX punctuation directives
|
2
|
+
As a hacker who works with LaTeX
|
3
|
+
I want to be able to decode LaTeX punctuation marks
|
4
|
+
|
5
|
+
Scenario Outline: LaTeX to Unicode transformation
|
6
|
+
When I decode the string '<latex>'
|
7
|
+
Then the result should be '<unicode>'
|
8
|
+
|
9
|
+
Scenarios: Punctuation macros
|
10
|
+
| latex | unicode |
|
11
|
+
| \\textendash | – |
|
12
|
+
| \\textemdash | — |
|
13
|
+
| \\textquoteleft | ‘ |
|
14
|
+
| \\textquoteright | ’ |
|
15
|
+
| \\quotesinglbase | ‚ |
|
16
|
+
| \\textquotedblleft | “ |
|
17
|
+
| \\textquotedblright | ” |
|
18
|
+
| \\quotedblbase | „ |
|
19
|
+
| \\dag | † |
|
20
|
+
| \\ddag | ‡ |
|
21
|
+
| \\textbullet | • |
|
22
|
+
| \\dots | … |
|
23
|
+
| \\textperthousand | ‰ |
|
24
|
+
| \\textpertenthousand | ‱ |
|
25
|
+
| \\guilsinglleft | ‹ |
|
26
|
+
| \\guilsinglright | › |
|
27
|
+
| \\textreferencemark | ※ |
|
28
|
+
| \\textinterrobang | ‽ |
|
29
|
+
| \\textoverline | ‾ |
|
30
|
+
| \\langle | ⟨ |
|
31
|
+
| \\rangle | ⟩ |
|
32
|
+
|
33
|
+
|
34
|
+
Scenarios: Punctuation symbols
|
35
|
+
| latex | unicode | description |
|
36
|
+
| - | - | hyphen |
|
37
|
+
| -- | – | en-dash |
|
38
|
+
| --- | — | em-dash |
|
@@ -1,7 +1,7 @@
|
|
1
|
-
When /^I decode the string
|
1
|
+
When /^I decode the string ('|")(.*)\1$/ do |quote,string|
|
2
2
|
@result = LaTeX.decode(string)
|
3
3
|
end
|
4
4
|
|
5
|
-
Then /^the result should be
|
5
|
+
Then /^the result should be ('|")(.*)\1$/ do |quote,value|
|
6
6
|
@result.should == value
|
7
7
|
end
|
data/features/umlauts.feature
CHANGED
@@ -2,6 +2,10 @@ Feature: Decode LaTeX umlauts
|
|
2
2
|
As a hacker who works with LaTeX
|
3
3
|
I want to be able to decode LaTeX umlauts
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
Scenario: Lowercase german umlauts
|
6
|
+
When I decode the string '\"a\"o\"u'
|
7
|
+
Then the result should be 'äöü'
|
8
|
+
|
9
|
+
Scenario: Uppercase german umlauts
|
10
|
+
When I decode the string '\"A\"O\"U'
|
11
|
+
Then the result should be 'ÄÖÜ'
|
data/latex-decode.gemspec
CHANGED
@@ -18,6 +18,9 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.required_rubygems_version = '>= 1.3.6'
|
19
19
|
s.rubyforge_project = s.name
|
20
20
|
|
21
|
+
s.add_runtime_dependency('unicode', '>= 0.4')
|
22
|
+
|
23
|
+
s.add_development_dependency('rake', '>= 0.8')
|
21
24
|
s.add_development_dependency('bundler', '>= 1.0')
|
22
25
|
s.add_development_dependency('rdoc', '>= 3.6')
|
23
26
|
s.add_development_dependency('rspec', '>= 2.6')
|
@@ -28,10 +31,8 @@ Gem::Specification.new do |s|
|
|
28
31
|
s.executables = []
|
29
32
|
s.require_path = 'lib'
|
30
33
|
|
31
|
-
s.has_rdoc = true
|
32
34
|
s.rdoc_options = %w{--line-numbers --inline-source --title "LaTeX-Decode Documentation" --main README.md --webcvs=http://github.com/inukshuk/latex-decode/tree/master/}
|
33
35
|
s.extra_rdoc_files = %w{README.md LICENSE}
|
34
|
-
|
35
36
|
end
|
36
37
|
|
37
38
|
# vim: syntax=ruby
|
data/lib/latex/decode.rb
CHANGED
@@ -1,13 +1,46 @@
|
|
1
|
-
|
1
|
+
#--
|
2
|
+
# LaTeX::Decode
|
3
|
+
# Copyright (C) 2011 Sylvester Keil <sylvester.keil.or.at>
|
4
|
+
# Copyright (C) 2010 François Charette
|
5
|
+
#
|
6
|
+
# This program is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'unicode'
|
2
21
|
|
3
22
|
require 'latex/decode/version'
|
23
|
+
require 'latex/decode/compatibility'
|
24
|
+
require 'latex/decode/base'
|
4
25
|
|
5
26
|
module LaTeX
|
27
|
+
|
6
28
|
class << self
|
7
29
|
def decode (string)
|
8
30
|
return string unless string.is_a? String
|
31
|
+
|
32
|
+
string = string.dup
|
33
|
+
|
34
|
+
Decode::Base.normalize(string)
|
35
|
+
|
36
|
+
Decode::Accents.decode!(string)
|
37
|
+
Decode::Diacritics.decode!(string)
|
38
|
+
Decode::Punctuation.decode!(string)
|
39
|
+
Decode::Symbols.decode!(string)
|
40
|
+
|
41
|
+
Decode::Base.strip_braces(string)
|
9
42
|
|
10
|
-
string
|
43
|
+
Unicode::normalize_C(string)
|
11
44
|
end
|
12
45
|
end
|
13
46
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
module LaTeX
|
4
|
+
module Decode
|
5
|
+
|
6
|
+
class Accents < Decoder
|
7
|
+
@map = Hash[*%W{
|
8
|
+
` \u0300
|
9
|
+
' \u0301
|
10
|
+
^ \u0302
|
11
|
+
~ \u0303
|
12
|
+
= \u0304
|
13
|
+
. \u0307
|
14
|
+
'' \u0308
|
15
|
+
" \u0308
|
16
|
+
}.map { |s| LaTeX.to_unicode(s) }].freeze
|
17
|
+
|
18
|
+
@patterns = [
|
19
|
+
ruby_18 {
|
20
|
+
/\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })\{([[:alpha:]]*)\}/ou
|
21
|
+
} ||
|
22
|
+
ruby_19 {
|
23
|
+
/\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })\{(\p{L}\p{M}*)\}/ou
|
24
|
+
},
|
25
|
+
ruby_18 {
|
26
|
+
/\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })([[:alpha:]])/ou
|
27
|
+
} ||
|
28
|
+
ruby_19 {
|
29
|
+
/\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })(\p{L}\p{M}*)/ou
|
30
|
+
}
|
31
|
+
].freeze
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
module LaTeX
|
4
|
+
module Decode
|
5
|
+
|
6
|
+
autoload :Accents, 'latex/decode/accents'
|
7
|
+
autoload :Diacritics, 'latex/decode/diacritics'
|
8
|
+
autoload :Punctuation, 'latex/decode/punctuation'
|
9
|
+
autoload :Symbols, 'latex/decode/symbols'
|
10
|
+
|
11
|
+
class Decoder
|
12
|
+
class << self
|
13
|
+
attr_reader :patterns, :map
|
14
|
+
|
15
|
+
def inherited (base)
|
16
|
+
subclasses << base
|
17
|
+
end
|
18
|
+
|
19
|
+
def subclasses
|
20
|
+
@subclasses ||= []
|
21
|
+
end
|
22
|
+
|
23
|
+
def decode (string)
|
24
|
+
decode!(string.dup)
|
25
|
+
end
|
26
|
+
|
27
|
+
def decode! (string)
|
28
|
+
puts name unless patterns
|
29
|
+
patterns.each do |pattern|
|
30
|
+
string.gsub!(pattern) { |m| [$2,map[$1],$3].compact.join }
|
31
|
+
end
|
32
|
+
string
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
module Base
|
38
|
+
|
39
|
+
module_function
|
40
|
+
|
41
|
+
def normalize (string)
|
42
|
+
string.gsub!(/\\(?:i|j)\b/) { |m| m == '\\i' ? 'ı' : 'ȷ' }
|
43
|
+
string.gsub!(/(\\[a-zA-Z]+)\\(\s+)/, '\1{}\2') # \foo\ bar -> \foo{} bar
|
44
|
+
string.gsub!(/([^{]\\\w)([;,.:%])/, '\1{}\2') #} Aaaa\o, -> Aaaa\o{},
|
45
|
+
string
|
46
|
+
end
|
47
|
+
|
48
|
+
def strip_braces (string)
|
49
|
+
string.gsub!(/(^|[^\\])([\{\}]+)/, '\1')
|
50
|
+
string.gsub!(/\\(\{|\})/, '\1')
|
51
|
+
string
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
if RUBY_VERSION < "1.9"
|
3
|
+
$KCODE = 'U'
|
4
|
+
|
5
|
+
module LaTeX
|
6
|
+
def self.to_unicode (string)
|
7
|
+
string.gsub(/\\?u([\da-f]{4})/i) { |m| [$1.to_i(16)].pack('U') }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def ruby_18; yield; end
|
12
|
+
def ruby_19; false; end
|
13
|
+
else
|
14
|
+
|
15
|
+
module LaTeX
|
16
|
+
def self.to_unicode (string); string; end
|
17
|
+
end
|
18
|
+
|
19
|
+
def ruby_18; false; end
|
20
|
+
def ruby_19; yield; end
|
21
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
module LaTeX
|
4
|
+
module Decode
|
5
|
+
|
6
|
+
class Diacritics < Decoder
|
7
|
+
@macros = Hash[*%W{
|
8
|
+
r \u030A
|
9
|
+
H \u030B
|
10
|
+
u \u0306
|
11
|
+
v \u030C
|
12
|
+
G \u030F
|
13
|
+
M \u0322
|
14
|
+
d \u0323
|
15
|
+
c \u0327
|
16
|
+
k \u0328
|
17
|
+
b \u0331
|
18
|
+
B \u0335
|
19
|
+
t \u0361
|
20
|
+
}.map { |s| LaTeX.to_unicode(s) }].freeze
|
21
|
+
|
22
|
+
@map = @macros.merge(Hash[*%w{
|
23
|
+
l ł
|
24
|
+
L Ł
|
25
|
+
}]).freeze
|
26
|
+
|
27
|
+
@patterns = [
|
28
|
+
ruby_18 {
|
29
|
+
/\\(#{ @macros.keys.map { |k| Regexp.escape(k) }.join('|') })\{([[:alpha:]]?)([[:alpha:]]*)\}/ou
|
30
|
+
} ||
|
31
|
+
ruby_19 {
|
32
|
+
/\\(#{ @macros.keys.map { |k| Regexp.escape(k) }.join('|') })\{(\p{L}\p{M}*)([[:alpha:]]*)\}/ou
|
33
|
+
},
|
34
|
+
/\\(l)\b/i
|
35
|
+
].freeze
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
module LaTeX
|
4
|
+
module Decode
|
5
|
+
|
6
|
+
class Punctuation < Decoder
|
7
|
+
|
8
|
+
@macros = Hash[*%W{
|
9
|
+
textendash –
|
10
|
+
textemdash —
|
11
|
+
textquoteleft ‘
|
12
|
+
textquoteright ’
|
13
|
+
quotesinglbase ‚
|
14
|
+
textquotedblleft “
|
15
|
+
textquotedblright ”
|
16
|
+
quotedblbase „
|
17
|
+
dag †
|
18
|
+
ddag ‡
|
19
|
+
textbullet •
|
20
|
+
dots …
|
21
|
+
textperthousand ‰
|
22
|
+
textpertenthousand ‱
|
23
|
+
guilsinglleft ‹
|
24
|
+
guilsinglright ›
|
25
|
+
textreferencemark ※
|
26
|
+
textinterrobang ‽
|
27
|
+
textoverline ‾
|
28
|
+
langle ⟨
|
29
|
+
rangle ⟩
|
30
|
+
}].freeze
|
31
|
+
|
32
|
+
@symbols = Hash[*%w[
|
33
|
+
- -
|
34
|
+
-- –
|
35
|
+
--- —
|
36
|
+
]].freeze
|
37
|
+
|
38
|
+
@map = @macros.merge(@symbols).freeze
|
39
|
+
|
40
|
+
@patterns = [
|
41
|
+
/\\(#{ @macros.keys.map { |k| Regexp.escape(k) }.compact.join('|') })(?:\{\}|\s+|\b)/ou,
|
42
|
+
/(-+)/,
|
43
|
+
/()\\([$%#_])(\{\})?/,
|
44
|
+
/()\\(~)\{\}/
|
45
|
+
].freeze
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,222 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
module LaTeX
|
4
|
+
module Decode
|
5
|
+
|
6
|
+
class Symbols < Decoder
|
7
|
+
@map = Hash[*%W{
|
8
|
+
textcolonmonetary ₡
|
9
|
+
textlira ₤
|
10
|
+
textnaira ₦
|
11
|
+
textwon ₩
|
12
|
+
textdong ₫
|
13
|
+
euro €
|
14
|
+
texteuro €
|
15
|
+
textnumero №
|
16
|
+
texttrademark ™
|
17
|
+
leftarrow ←
|
18
|
+
uparrow ↑
|
19
|
+
rightarrow →
|
20
|
+
downarrow ↓
|
21
|
+
leftrightarrow ↔
|
22
|
+
updownarrow ↕
|
23
|
+
leadsto ↝
|
24
|
+
rightleftharpoons ⇌
|
25
|
+
Rightarrow ⇒
|
26
|
+
Leftrightarrow ⇔
|
27
|
+
forall ∀
|
28
|
+
complement ∁
|
29
|
+
partial ∂
|
30
|
+
exists ∃
|
31
|
+
nexists ∄
|
32
|
+
set ∅
|
33
|
+
Delta ∆
|
34
|
+
nabla ∇
|
35
|
+
in ∈
|
36
|
+
notin ∉
|
37
|
+
ni ∋
|
38
|
+
prod ∏
|
39
|
+
coprod ∐
|
40
|
+
sum ∑
|
41
|
+
mp ∓
|
42
|
+
dotplus ∔
|
43
|
+
setminus ∖
|
44
|
+
ast ∗
|
45
|
+
circ ∘
|
46
|
+
bullet ∙
|
47
|
+
surd √
|
48
|
+
propto ∝
|
49
|
+
infty ∞
|
50
|
+
angle ∠
|
51
|
+
measuredangle ∡
|
52
|
+
sphericalangle ∢
|
53
|
+
mid ∣
|
54
|
+
nmid ∤
|
55
|
+
parallel ∥
|
56
|
+
nparallel ∦
|
57
|
+
wedge ∧
|
58
|
+
vee ∨
|
59
|
+
cap ∩
|
60
|
+
cup ∪
|
61
|
+
int ∫
|
62
|
+
iint ∬
|
63
|
+
iiint ∭
|
64
|
+
oint ∮
|
65
|
+
therefore ∴
|
66
|
+
because ∵
|
67
|
+
sim ∼
|
68
|
+
backsim ∽
|
69
|
+
wr ≀
|
70
|
+
nsim ≁
|
71
|
+
simeq ≃
|
72
|
+
cong ≅
|
73
|
+
ncong ≇
|
74
|
+
approx ≈
|
75
|
+
approxeq ≊
|
76
|
+
asymp ≍
|
77
|
+
Bumpeq ≎
|
78
|
+
bumpeq ≏
|
79
|
+
doteq ≐
|
80
|
+
doteqdot ≑
|
81
|
+
fallingdotseq ≒
|
82
|
+
risingdotseq ≓
|
83
|
+
eqcirc ≖
|
84
|
+
circeq ≗
|
85
|
+
triangleq ≜
|
86
|
+
neq ≠
|
87
|
+
equiv ≡
|
88
|
+
leq ≤
|
89
|
+
geq ≥
|
90
|
+
leqq ≦
|
91
|
+
geqq ≧
|
92
|
+
lneqq ≨
|
93
|
+
gneqq ≩
|
94
|
+
ll ≪
|
95
|
+
gg ≫
|
96
|
+
between ≬
|
97
|
+
nless ≮
|
98
|
+
ngtr ≯
|
99
|
+
nleq ≰
|
100
|
+
ngeq ≱
|
101
|
+
lesssim ≲
|
102
|
+
gtrsim ≳
|
103
|
+
lessgtr ≶
|
104
|
+
gtrless ≷
|
105
|
+
prec ≺
|
106
|
+
succ ≻
|
107
|
+
preccurlyeq ≼
|
108
|
+
succcurlyeq ≽
|
109
|
+
precsim ≾
|
110
|
+
succsim ≿
|
111
|
+
nprec ⊀
|
112
|
+
nsucc ⊁
|
113
|
+
subset ⊂
|
114
|
+
supset ⊃
|
115
|
+
subseteq ⊆
|
116
|
+
supseteq ⊇
|
117
|
+
nsubseteq ⊈
|
118
|
+
nsupseteq ⊉
|
119
|
+
subsetneq ⊊
|
120
|
+
supsetneq ⊋
|
121
|
+
uplus ⊎
|
122
|
+
sqsubset ⊏
|
123
|
+
sqsupset ⊐
|
124
|
+
sqsubseteq ⊑
|
125
|
+
sqsupseteq ⊒
|
126
|
+
sqcap ⊓
|
127
|
+
sqcup ⊔
|
128
|
+
oplus ⊕
|
129
|
+
ominus ⊖
|
130
|
+
otimes ⊗
|
131
|
+
oslash ⊘
|
132
|
+
odot ⊙
|
133
|
+
circledcirc ⊚
|
134
|
+
circledast ⊛
|
135
|
+
circleddash ⊝
|
136
|
+
boxplus ⊞
|
137
|
+
boxminus ⊟
|
138
|
+
boxtimes ⊠
|
139
|
+
boxdot ⊡
|
140
|
+
vdash ⊢
|
141
|
+
dashv ⊣
|
142
|
+
top ⊤
|
143
|
+
bot ⊥
|
144
|
+
Vdash ⊩
|
145
|
+
Vvdash ⊪
|
146
|
+
nVdash ⊮
|
147
|
+
lhd ⊲
|
148
|
+
rhd ⊳
|
149
|
+
unlhd ⊴
|
150
|
+
unrhd ⊵
|
151
|
+
multimap ⊸
|
152
|
+
intercal ⊺
|
153
|
+
veebar ⊻
|
154
|
+
barwedge ⊼
|
155
|
+
bigwedge ⋀
|
156
|
+
bigvee ⋁
|
157
|
+
bigcap ⋂
|
158
|
+
bigcup ⋃
|
159
|
+
diamond ⋄
|
160
|
+
cdot ⋅
|
161
|
+
star ⋆
|
162
|
+
divideontimes ⋇
|
163
|
+
bowtie ⋈
|
164
|
+
ltimes ⋉
|
165
|
+
rtimes ⋊
|
166
|
+
leftthreetimes ⋋
|
167
|
+
rightthreetimes ⋌
|
168
|
+
backsimeq ⋍
|
169
|
+
curlyvee ⋎
|
170
|
+
curlywedge ⋏
|
171
|
+
Subset ⋐
|
172
|
+
Supset ⋑
|
173
|
+
Cap ⋒
|
174
|
+
Cup ⋓
|
175
|
+
pitchfork ⋔
|
176
|
+
lessdot ⋖
|
177
|
+
gtrdot ⋗
|
178
|
+
lll ⋘
|
179
|
+
ggg ⋙
|
180
|
+
lesseqgtr ⋚
|
181
|
+
gtreqless ⋛
|
182
|
+
curlyeqprec ⋞
|
183
|
+
curlyeqsucc ⋟
|
184
|
+
lnsim ⋦
|
185
|
+
gnsim ⋧
|
186
|
+
precnsim ⋨
|
187
|
+
succnsim ⋩
|
188
|
+
ntriangleleft ⋪
|
189
|
+
ntriangleright ⋫
|
190
|
+
ntrianglelefteq ⋬
|
191
|
+
ntrianglerighteq ⋭
|
192
|
+
vdots ⋮
|
193
|
+
cdots ⋯
|
194
|
+
ddots ⋱
|
195
|
+
lceil ⌈
|
196
|
+
rceil ⌉
|
197
|
+
lfloor ⌊
|
198
|
+
rfloor ⌋
|
199
|
+
Box □
|
200
|
+
spadesuit ♠
|
201
|
+
heartsuit ♡
|
202
|
+
diamondsuit ♢
|
203
|
+
clubsuit ♣
|
204
|
+
flat ♭
|
205
|
+
natural ♮
|
206
|
+
sharp ♯
|
207
|
+
tone5 ˥
|
208
|
+
tone4 ˦
|
209
|
+
tone3 ˧
|
210
|
+
tone2 ˨
|
211
|
+
tone1 ˩
|
212
|
+
ss ß
|
213
|
+
}].freeze
|
214
|
+
|
215
|
+
@patterns = [
|
216
|
+
/\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })(?:\{\}|\s+|\b)/ou
|
217
|
+
].freeze
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
end
|
data/lib/latex/decode/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: latex-decode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sylvester Keil
|
@@ -10,53 +10,75 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-08 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: unicode
|
18
18
|
prerelease: false
|
19
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0.4"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0.8"
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: bundler
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
20
42
|
none: false
|
21
43
|
requirements:
|
22
44
|
- - ">="
|
23
45
|
- !ruby/object:Gem::Version
|
24
46
|
version: "1.0"
|
25
47
|
type: :development
|
26
|
-
version_requirements: *
|
48
|
+
version_requirements: *id003
|
27
49
|
- !ruby/object:Gem::Dependency
|
28
50
|
name: rdoc
|
29
51
|
prerelease: false
|
30
|
-
requirement: &
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
31
53
|
none: false
|
32
54
|
requirements:
|
33
55
|
- - ">="
|
34
56
|
- !ruby/object:Gem::Version
|
35
57
|
version: "3.6"
|
36
58
|
type: :development
|
37
|
-
version_requirements: *
|
59
|
+
version_requirements: *id004
|
38
60
|
- !ruby/object:Gem::Dependency
|
39
61
|
name: rspec
|
40
62
|
prerelease: false
|
41
|
-
requirement: &
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
42
64
|
none: false
|
43
65
|
requirements:
|
44
66
|
- - ">="
|
45
67
|
- !ruby/object:Gem::Version
|
46
68
|
version: "2.6"
|
47
69
|
type: :development
|
48
|
-
version_requirements: *
|
70
|
+
version_requirements: *id005
|
49
71
|
- !ruby/object:Gem::Dependency
|
50
72
|
name: cucumber
|
51
73
|
prerelease: false
|
52
|
-
requirement: &
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
53
75
|
none: false
|
54
76
|
requirements:
|
55
77
|
- - ">="
|
56
78
|
- !ruby/object:Gem::Version
|
57
79
|
version: "0.10"
|
58
80
|
type: :development
|
59
|
-
version_requirements: *
|
81
|
+
version_requirements: *id006
|
60
82
|
description: Decodes strings formatted in LaTeX to equivalent Unicode strings.
|
61
83
|
email: http://sylvester.keil.or.at
|
62
84
|
executables: []
|
@@ -71,11 +93,21 @@ files:
|
|
71
93
|
- Gemfile
|
72
94
|
- LICENSE
|
73
95
|
- README.md
|
96
|
+
- features/brackets.feature
|
97
|
+
- features/diacritics.feature
|
98
|
+
- features/non-latex.feature
|
99
|
+
- features/punctuation.feature
|
74
100
|
- features/step_definitions/latex.rb
|
75
101
|
- features/support/env.rb
|
76
102
|
- features/umlauts.feature
|
77
103
|
- latex-decode.gemspec
|
78
104
|
- lib/latex/decode.rb
|
105
|
+
- lib/latex/decode/accents.rb
|
106
|
+
- lib/latex/decode/base.rb
|
107
|
+
- lib/latex/decode/compatibility.rb
|
108
|
+
- lib/latex/decode/diacritics.rb
|
109
|
+
- lib/latex/decode/punctuation.rb
|
110
|
+
- lib/latex/decode/symbols.rb
|
79
111
|
- lib/latex/decode/version.rb
|
80
112
|
has_rdoc: true
|
81
113
|
homepage: http://github.com/inukshuk/latex-decode
|
@@ -113,6 +145,10 @@ signing_key:
|
|
113
145
|
specification_version: 3
|
114
146
|
summary: Decodes LaTeX to Unicode.
|
115
147
|
test_files:
|
148
|
+
- features/brackets.feature
|
149
|
+
- features/diacritics.feature
|
150
|
+
- features/non-latex.feature
|
151
|
+
- features/punctuation.feature
|
116
152
|
- features/step_definitions/latex.rb
|
117
153
|
- features/support/env.rb
|
118
154
|
- features/umlauts.feature
|