latex-decode 0.2.1-java → 0.2.2-java

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 060f0bb9a15e06e5d296bbe6adb5b67789e67194
4
- data.tar.gz: 96f01e66377cca5dcc40e7c55a3a2f8e7c700858
3
+ metadata.gz: 1ceb13ebd92cba85b50895ae745e1a41055a00e4
4
+ data.tar.gz: 9a498a444f9c5797515fd10f310f3d2bb7210831
5
5
  SHA512:
6
- metadata.gz: d79ea316e640e23d0123cb215f267226c85f86c17b455c09d1d32e0c11948af876117c6d513c1a50c418483edb7a51dfb230a4741f744238ae4a74a563b0cadc
7
- data.tar.gz: 0d986904c1e4b7ae92a1e284c506b8ec2427c3e40a75ec8a0379d72208b240415b5429a6cb687d2b179b0d094e8d1cd7cecf2bbed9a3d05421a8dcfa79438193
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 | unicode | description |
37
- | - | - | hyphen |
38
- | -- | – | en-dash |
39
- | --- | — | em-dash |
40
- | \\~{} | ~ | tilde |
41
- | X\\ X | X X | space |
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
+
@@ -35,15 +35,18 @@ module LaTeX
35
35
  def normalize (string)
36
36
  string.gsub!(/\\(?:i|j)\b/) { |m| m == '\\i' ? 'ı' : 'ȷ' }
37
37
 
38
- # \foo\ bar -> \foo{} bar
38
+ # \foo\ bar -> \foo{} bar
39
39
  string.gsub!(/(\\[a-zA-Z]+)\\(\s+)/, '\1{}\2')
40
40
 
41
- # Aaaa\o, -> Aaaa\o{},
41
+ # Aaaa\o, -> Aaaa\o{},
42
42
  string.gsub!(/([^{]\\\w)([;,.:%])/, '\1{}\2')
43
43
 
44
- # \c cb -> \c{cb}
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
 
@@ -4,7 +4,8 @@ module LaTeX
4
4
  module Decode
5
5
 
6
6
  class Symbols < Decoder
7
- @map = Hash[*%w{
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
@@ -1,5 +1,5 @@
1
1
  module LaTeX
2
2
  module Decode
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '0.2.2'.freeze
4
4
  end
5
5
  end
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.1
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-25 00:00:00.000000000 Z
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