latex-decode 0.2.1-java → 0.2.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/punctuation.feature +8 -6
- data/features/symbols.feature +21 -0
- data/lib/latex/decode/base.rb +6 -3
- data/lib/latex/decode/symbols.rb +4 -2
- data/lib/latex/decode/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ceb13ebd92cba85b50895ae745e1a41055a00e4
|
4
|
+
data.tar.gz: 9a498a444f9c5797515fd10f310f3d2bb7210831
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d3be9bd198799c4fbaa2f87cac1780485edc3a1a87ae0c5f1f1c6f2f8427555c14790c2a787fc9cd868c7342069ee545b9cae3b26d3207fdc735dab5cf4fc66
|
7
|
+
data.tar.gz: 527f315e646ed37c70a34a6416f836bc89d9334ada5ca7343fe0ac04f5a640f97fcdb7656fd9fcacfe619168b02701f60f38c1335117410a5c95da926aca7c2e
|
@@ -33,12 +33,14 @@ Feature: Decode LaTeX punctuation directives
|
|
33
33
|
|
34
34
|
|
35
35
|
Scenarios: Punctuation symbols
|
36
|
-
| latex
|
37
|
-
| -
|
38
|
-
| --
|
39
|
-
| ---
|
40
|
-
| \\~{}
|
41
|
-
|
|
36
|
+
| latex | unicode | description |
|
37
|
+
| - | - | hyphen |
|
38
|
+
| -- | – | en-dash |
|
39
|
+
| --- | — | em-dash |
|
40
|
+
| \\~{} | ~ | tilde |
|
41
|
+
| \\textasciitilde{} | ~ | tilde |
|
42
|
+
| \\textasciitilde | ~ | tilde |
|
43
|
+
| X\\ X | X X | space |
|
42
44
|
|
43
45
|
Scenarios: Quotation marks
|
44
46
|
| latex | unicode | description |
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Decode LaTeX symbol directives
|
2
|
+
As a hacker who works with LaTeX
|
3
|
+
I want to be able to decode LaTeX symbol directives
|
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: Arrows
|
10
|
+
| latex | unicode |
|
11
|
+
| \\leftarrow | ← |
|
12
|
+
| \\uparrow | ↑ |
|
13
|
+
| \\downarrow | ↓ |
|
14
|
+
| \\rightarrow | → |
|
15
|
+
|
16
|
+
Scenarios: Whitespace
|
17
|
+
| latex | unicode | description |
|
18
|
+
| x\\,x | x x | small space |
|
19
|
+
| x~x | x x | non-breaking space |
|
20
|
+
| ~x | x | non-breaking space |
|
21
|
+
|
data/lib/latex/decode/base.rb
CHANGED
@@ -35,15 +35,18 @@ module LaTeX
|
|
35
35
|
def normalize (string)
|
36
36
|
string.gsub!(/\\(?:i|j)\b/) { |m| m == '\\i' ? 'ı' : 'ȷ' }
|
37
37
|
|
38
|
-
|
38
|
+
# \foo\ bar -> \foo{} bar
|
39
39
|
string.gsub!(/(\\[a-zA-Z]+)\\(\s+)/, '\1{}\2')
|
40
40
|
|
41
|
-
|
41
|
+
# Aaaa\o, -> Aaaa\o{},
|
42
42
|
string.gsub!(/([^{]\\\w)([;,.:%])/, '\1{}\2')
|
43
43
|
|
44
|
-
|
44
|
+
# \c cb -> \c{cb}
|
45
45
|
string.gsub!(/(\\[^\sij&#\$\{\}_~%])\s+([[:alpha:]]+)\b/i, '\1{\2}')
|
46
46
|
|
47
|
+
# non-breaking spaces
|
48
|
+
string.gsub!(/(\A|[^\\])~/, LaTeX.to_unicode("\\1\u00a0"))
|
49
|
+
|
47
50
|
string
|
48
51
|
end
|
49
52
|
|
data/lib/latex/decode/symbols.rb
CHANGED
@@ -4,7 +4,8 @@ module LaTeX
|
|
4
4
|
module Decode
|
5
5
|
|
6
6
|
class Symbols < Decoder
|
7
|
-
|
7
|
+
|
8
|
+
@map = Hash[*%W{
|
8
9
|
textcolonmonetary ₡
|
9
10
|
textlira ₤
|
10
11
|
textnaira ₦
|
@@ -211,7 +212,8 @@ module LaTeX
|
|
211
212
|
tone1 ˩
|
212
213
|
ss ß
|
213
214
|
, \u2009
|
214
|
-
}].freeze
|
215
|
+
}.map { |s| LaTeX.to_unicode(s) }].freeze
|
216
|
+
|
215
217
|
|
216
218
|
@patterns = [
|
217
219
|
/\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })(?:\{\}|\s+|\b)/ou
|
data/lib/latex/decode/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: latex-decode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Decodes strings formatted in LaTeX to equivalent Unicode strings.
|
14
14
|
email:
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- features/special_characters.feature
|
36
36
|
- features/step_definitions/latex.rb
|
37
37
|
- features/support/env.rb
|
38
|
+
- features/symbols.feature
|
38
39
|
- features/umlauts.feature
|
39
40
|
- latex-decode.gemspec
|
40
41
|
- lib/latex/decode.rb
|
@@ -88,4 +89,5 @@ test_files:
|
|
88
89
|
- features/special_characters.feature
|
89
90
|
- features/step_definitions/latex.rb
|
90
91
|
- features/support/env.rb
|
92
|
+
- features/symbols.feature
|
91
93
|
- features/umlauts.feature
|