latex-decode 0.4.0 → 0.4.1

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
  SHA256:
3
- metadata.gz: 1c01f8f064a264d72d7d3a94e4f1b1b9f911756390eb2bc669e4586674b4d2ae
4
- data.tar.gz: 8305a76f2fe47be9c3027f24d7c9354fdafebf90c8a1c4e3b27421934517cfb0
3
+ metadata.gz: 0ba2e090021db4b420e211c407dcd5f488b4febdaf1b622bfa3b95401b34a09a
4
+ data.tar.gz: 2df17e4f620af962d1540f5d90984470f606764510f2a1924cee8d6bb20ed19c
5
5
  SHA512:
6
- metadata.gz: e53e8ee74e70d711b337a5ef81734a921b5dd89ef9e41e50d94f4a6f2cbd8b9834ff0930a822659a42b87b6c2771104e947d5315a2cd5c22c9b4d66d451daf6e
7
- data.tar.gz: c50fa7ef133fdb373b2ea9399dd46c1a7181cd01a697a11299735956525fec8e551028d7db018f4e02deb81fb91bf6f4b2d717196002c4593ee6932c1f9c801a
6
+ metadata.gz: dfdf5d3eca1175d7808ebe581abf25cb01c1165115772743e438f3b3e04125cad0865c6c69a79a6bc7510a8a2b3f3cea306aa7d6a861464e26f67efad124768d
7
+ data.tar.gz: 22f11a0224dc3179de7406ce14b6ad874359cc7a75418ce8220542117bfcf71467a6362fd154f3cd3fe431c5a96c9f183bf2a354107bdd8e50405de362ca6fc0
@@ -1,11 +1,9 @@
1
1
  name: ci
2
-
3
2
  on:
4
3
  push:
5
4
  branches: [ main ]
6
5
  pull_request:
7
6
  branches: [ main ]
8
-
9
7
  jobs:
10
8
  build:
11
9
  environment: CI
@@ -14,27 +12,23 @@ jobs:
14
12
  strategy:
15
13
  matrix:
16
14
  ruby-version:
17
- - '2.7'
18
- - '3.0'
19
- - '3.1'
15
+ - '3.4'
16
+ - '3.3'
17
+ - '3.2'
20
18
  - 'jruby'
21
-
22
19
  steps:
23
20
  - name: Git checkout
24
- uses: actions/checkout@v2
25
-
21
+ uses: actions/checkout@v4
26
22
  - name: Setup Ruby
27
23
  uses: ruby/setup-ruby@v1
28
24
  with:
29
25
  ruby-version: ${{ matrix.ruby-version }}
30
26
  bundler-cache: true
31
-
32
27
  - name: Run tests
33
28
  run: bundle exec rake
34
-
35
29
  - name: Upload coverage results
36
- if: matrix.ruby-version == '3.1'
30
+ if: matrix.ruby-version == '3.3'
37
31
  continue-on-error: true
38
- uses: coverallsapp/github-action@master
32
+ uses: coverallsapp/github-action@v2
39
33
  with:
40
34
  github-token: ${{ github.token }}
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ Gemfile.lock
4
4
  .ruby-version
5
5
  *swp
6
6
  .bundle
7
+ coverage
data/latex-decode.gemspec CHANGED
@@ -11,8 +11,9 @@ Gem::Specification.new do |s|
11
11
  s.homepage = 'http://github.com/inukshuk/latex-decode'
12
12
  s.summary = 'Decodes LaTeX to Unicode.'
13
13
  s.description = 'Decodes strings formatted in LaTeX to equivalent Unicode strings.'
14
- s.license = 'GPL-3.0'
14
+ s.license = 'GPL-3.0-or-later'
15
15
  s.platform = 'ruby'
16
+ s.required_ruby_version = '>= 1.8'
16
17
 
17
18
  s.files = `git ls-files`.split("\n")
18
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -7,6 +7,10 @@ module LaTeX
7
7
  class << self
8
8
  attr_reader :patterns, :map
9
9
 
10
+ def id
11
+ name.split('::').last.downcase.to_sym
12
+ end
13
+
10
14
  def inherited(base)
11
15
  subclasses << base
12
16
  end
@@ -1,5 +1,5 @@
1
1
  module LaTeX
2
2
  module Decode
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.4.1'.freeze
4
4
  end
5
5
  end
data/lib/latex/decode.rb CHANGED
@@ -30,21 +30,28 @@ require 'latex/decode/greek'
30
30
 
31
31
  module LaTeX
32
32
 
33
+ @decoders = [
34
+ Decode::Maths,
35
+ Decode::Accents,
36
+ Decode::Diacritics,
37
+ Decode::Punctuation,
38
+ Decode::Symbols,
39
+ Decode::Greek
40
+ ]
41
+
33
42
  class << self
34
- def decode(string)
43
+ attr_reader :decoders
44
+
45
+ def decode(string, options = {})
35
46
  return string unless string.respond_to?(:to_s)
36
47
 
37
48
  string = string.is_a?(String) ? string.dup : string.to_s
38
49
 
39
50
  Decode::Base.normalize(string)
40
51
 
41
- Decode::Maths.decode!(string)
42
-
43
- Decode::Accents.decode!(string)
44
- Decode::Diacritics.decode!(string)
45
- Decode::Punctuation.decode!(string)
46
- Decode::Symbols.decode!(string)
47
- Decode::Greek.decode!(string)
52
+ decoders.each do |d|
53
+ d.decode! string unless options[d.id] == false
54
+ end
48
55
 
49
56
  Decode::Base.strip_braces(string)
50
57
 
metadata CHANGED
@@ -1,22 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: latex-decode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-07-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Decodes strings formatted in LaTeX to equivalent Unicode strings.
14
- email:
15
13
  executables: []
16
14
  extensions: []
17
15
  extra_rdoc_files:
18
- - README.md
19
16
  - LICENSE
17
+ - README.md
20
18
  files:
21
19
  - ".github/workflows/ci.yml"
22
20
  - ".gitignore"
@@ -51,9 +49,8 @@ files:
51
49
  - lib/latex/decode/version.rb
52
50
  homepage: http://github.com/inukshuk/latex-decode
53
51
  licenses:
54
- - GPL-3.0
52
+ - GPL-3.0-or-later
55
53
  metadata: {}
56
- post_install_message:
57
54
  rdoc_options:
58
55
  - "--line-numbers"
59
56
  - "--inline-source"
@@ -68,15 +65,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
68
65
  requirements:
69
66
  - - ">="
70
67
  - !ruby/object:Gem::Version
71
- version: '0'
68
+ version: '1.8'
72
69
  required_rubygems_version: !ruby/object:Gem::Requirement
73
70
  requirements:
74
71
  - - ">="
75
72
  - !ruby/object:Gem::Version
76
73
  version: '0'
77
74
  requirements: []
78
- rubygems_version: 3.2.15
79
- signing_key:
75
+ rubygems_version: 4.0.3
80
76
  specification_version: 4
81
77
  summary: Decodes LaTeX to Unicode.
82
78
  test_files: