latex-decode 0.3.2 → 0.4.0

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: 9192df4a57585120960f5b8f6e2aba62bd900cdd8c649a15cefca04f4819f2f3
4
- data.tar.gz: 6d692566a583b9bb70a67763c6c803f4b7e98c2e9c50b006a720cee30b39c72d
3
+ metadata.gz: 1c01f8f064a264d72d7d3a94e4f1b1b9f911756390eb2bc669e4586674b4d2ae
4
+ data.tar.gz: 8305a76f2fe47be9c3027f24d7c9354fdafebf90c8a1c4e3b27421934517cfb0
5
5
  SHA512:
6
- metadata.gz: 6a52d3db67061ed7c206cfa9b52d99ea181ff02bc2be8a21b6b55ebab19f8528565f3b4a882cef8c3b84f0319b99c63e5eef16d7c779ed80fc3405871bf95379
7
- data.tar.gz: 0ac36cc1adaeff8d919ab78dc98fcecaadb663519ae6c3bd201327041a704c7e24b170f1143d700be8b999bb1561eb4c36e723b8aaf640fc4f78fb2b9ebfa5c8
6
+ metadata.gz: e53e8ee74e70d711b337a5ef81734a921b5dd89ef9e41e50d94f4a6f2cbd8b9834ff0930a822659a42b87b6c2771104e947d5315a2cd5c22c9b4d66d451daf6e
7
+ data.tar.gz: c50fa7ef133fdb373b2ea9399dd46c1a7181cd01a697a11299735956525fec8e551028d7db018f4e02deb81fb91bf6f4b2d717196002c4593ee6932c1f9c801a
@@ -0,0 +1,40 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ build:
11
+ environment: CI
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ ruby-version:
17
+ - '2.7'
18
+ - '3.0'
19
+ - '3.1'
20
+ - 'jruby'
21
+
22
+ steps:
23
+ - name: Git checkout
24
+ uses: actions/checkout@v2
25
+
26
+ - name: Setup Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true
31
+
32
+ - name: Run tests
33
+ run: bundle exec rake
34
+
35
+ - name: Upload coverage results
36
+ if: matrix.ruby-version == '3.1'
37
+ continue-on-error: true
38
+ uses: coverallsapp/github-action@master
39
+ with:
40
+ github-token: ${{ github.token }}
data/.simplecov ADDED
@@ -0,0 +1,18 @@
1
+ require 'simplecov-lcov'
2
+
3
+ SimpleCov::Formatter::LcovFormatter.config do |c|
4
+ c.output_directory = 'coverage'
5
+ c.lcov_file_name = 'lcov.info'
6
+ c.report_with_single_file = true
7
+ end
8
+
9
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
10
+ SimpleCov::Formatter::HTMLFormatter,
11
+ SimpleCov::Formatter::LcovFormatter
12
+ ])
13
+
14
+ SimpleCov.start do
15
+ add_filter 'features/'
16
+
17
+ enable_coverage :branch
18
+ end
data/Gemfile CHANGED
@@ -3,19 +3,14 @@ gemspec
3
3
 
4
4
  group :test do
5
5
  gem 'rake'
6
- gem 'rspec', '~> 3.0'
7
- gem 'cucumber', '~> 1.3'
6
+ gem 'rspec'
7
+ gem 'cucumber'
8
+ gem 'simplecov', platform: 'mri'
9
+ gem 'simplecov-lcov', platform: 'mri'
8
10
  end
9
11
 
10
12
  group :debug do
11
- gem 'debugger', :platforms => :mri_19
12
- gem 'byebug', :platforms => :mri if RUBY_VERSION > '2.0'
13
-
14
- gem 'rubinius-debugger', :require => false, :platforms => :rbx
15
- gem 'rubinius-compiler', :require => false, :platforms => :rbx
13
+ gem 'debug', platform: 'mri'
16
14
  end
17
15
 
18
- gem 'unicode', '~> 0.4', :platforms => [:mri, :rbx, :mswin, :mingw] if RUBY_VERSION < '2.4'
19
16
  gem 'ritex', '~> 1.0.1'
20
-
21
- gem 'rubysl', '~> 2.0', :platforms => :rbx
data/README.md CHANGED
@@ -1,38 +1,30 @@
1
1
  LaTeX::Decode
2
2
  =============
3
+ [![ci](https://github.com/inukshuk/latex-decode/actions/workflows/ci.yml/badge.svg)](https://github.com/inukshuk/latex-decode/actions/workflows/ci.yml)
4
+ [![coverage](https://coveralls.io/repos/github/inukshuk/latex-decode/badge.svg?branch=main)](https://coveralls.io/github/inukshuk/latex-decode?branch=main)
3
5
 
4
- [![Build Status](https://travis-ci.org/inukshuk/latex-decode.png?branch=master)](https://travis-ci.org/inukshuk/latex-decode)
5
-
6
- LaTeX::Decode is a Ruby gem to convert LaTeX input to Unicode. Its original
7
- use was as an input filter for [BibTeX-Ruby](http://rubygems.org/gems/bibtex-ruby)
8
- but can be used independently to decode LaTeX. Many of the patterns used by
9
- this Ruby gem are based on François Charette's equivalent Perl module
10
- [LaTeX::Decode](https://github.com/fc7/LaTeX-Decode).
6
+ LaTeX::Decode is a Ruby gem to convert LaTeX input to Unicode.
7
+ Its original use was as an input filter for [BibTeX-Ruby][]
8
+ but it can be used independently to decode LaTeX.
9
+ Many of the patterns used by this Ruby gem
10
+ are based on François Charette's equivalent Perl module [LaTeX::Decode][].
11
11
 
12
12
  Quickstart
13
13
  ----------
14
-
15
14
  $ [sudo] gem install latex-decode
16
15
  $ irb
17
16
  >> require 'latex/decode'
18
17
  >> LaTeX.decode "dipl\\^{o}me d'\\'{e}tudes sup\\'erieures"
19
18
  => "diplôme d'études supérieures"
20
19
 
21
- Compatibility
22
- -------------
23
-
24
- Unicode handling is one of the major differences between Ruby 1.8 and newer
25
- version; LaTeX::Decode; nevertheless, we try to support 1.8 as best as possible.
26
20
 
27
21
  Issues
28
22
  ------
29
-
30
- Please use the tracker of the project's
31
- [GitHub repository](https://github.com/inukshuk/latex-decode) to report any
32
- issues. When describing intended behaviour, please use the extremely simple
33
- syntax of the Cucumber features used by LaTeX::Decode; for instance, you could
34
- describe the example above as:
35
-
23
+ Please use the tracker of the project's [repository][] to report any issues.
24
+ When describing intended behaviour,
25
+ please use the syntax of the Cucumber features used by LaTeX::Decode.
26
+ For instance, you could describe the example above as:
27
+ ```Gherkin
36
28
  Feature: Decode LaTeX accents
37
29
  As a hacker who works with LaTeX
38
30
  I want to be able to decode LaTeX accents
@@ -40,26 +32,19 @@ describe the example above as:
40
32
  Scenario: A French sentence
41
33
  When I decode the string "dipl\\^{o}me d'\\'{e}tudes sup\\'erieures"
42
34
  Then the result should be "diplôme d'études supérieures"
35
+ ```
43
36
 
44
37
  Credits
45
38
  -------
39
+ Kudos and thanks to all [contributors][] who have made LaTeX::Decode possible!
46
40
 
47
- Kudos and thanks to all [contributors](https://github.com/inukshuk/latex-decode/contributors)
48
- who have made LaTeX::Decode possible!
49
-
50
- Copyright (C) 2011-2015 [Sylvester Keil](sylvester.keil.or.at)
51
-
41
+ Copyright (C) 2011-2022 Sylvester Keil
52
42
  Copyright (C) 2010 François Charette
53
43
 
54
- This program is free software: you can redistribute it and/or modify
55
- it under the terms of the GNU General Public License as published by
56
- the Free Software Foundation, either version 3 of the License, or
57
- (at your option) any later version.
58
44
 
59
- This program is distributed in the hope that it will be useful,
60
- but WITHOUT ANY WARRANTY; without even the implied warranty of
61
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62
- GNU General Public License for more details.
45
+ [BibTeXRuby]: http://rubygems.org/gems/bibtex-ruby
46
+ [LaTeX::Decode]: https://github.com/fc7/LaTeX-Decode
63
47
 
64
- You should have received a copy of the GNU General Public License
65
- along with this program. If not, see <http://www.gnu.org/licenses/>.
48
+ [repository]: https://github.com/inukshuk/latex-decode
49
+ [contributors]: https://github.com/inukshuk/latex-decode/contributors
50
+ [LICENSE]: https://github.com/inukshuk/latex-decode/blob/main/LICENSE
data/Rakefile CHANGED
@@ -29,13 +29,10 @@ Cucumber::Rake::Task.new(:cucumber)
29
29
 
30
30
  task :release do |t|
31
31
  system "gem build latex-decode.gemspec"
32
- system "git tag #{LaTeX::Decode::VERSION}"
32
+ system "git tag v#{LaTeX::Decode::VERSION}"
33
33
  system "git push --tags"
34
34
  system "gem push latex-decode-#{LaTeX::Decode::VERSION}.gem"
35
35
  system "rm latex-decode-#{LaTeX::Decode::VERSION}.gem"
36
- system "jgem build latex-decode.gemspec"
37
- system "jgem push latex-decode-#{LaTeX::Decode::VERSION}.gem"
38
- system "rm latex-decode-#{LaTeX::Decode::VERSION}-java.gem"
39
36
  end
40
37
 
41
38
  task :default => :cucumber
data/cucumber.yml CHANGED
@@ -1 +1 @@
1
- default: --format progress --require features --color
1
+ default: --format progress --require features --color --publish-quiet
@@ -5,3 +5,8 @@ end
5
5
  Then /^the result should be ('|")(.*)\1$/ do |quote,value|
6
6
  expect(@result).to eq(value)
7
7
  end
8
+
9
+ # For whitespace or other characters that are hard to read in source code:
10
+ Then /^I should get '([^']*)' \+ U\+(\h{4,}) \+ '([^']*)'$/ do |pre,code,post|
11
+ expect(@result).to eq(pre + code.hex.chr(Encoding::UTF_8) + post)
12
+ end
@@ -1,12 +1,11 @@
1
1
  begin
2
- case
3
- when defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
4
- require 'rubinius/debugger'
5
- when RUBY_VERSION > '2.0'
6
- require 'byebug'
7
- else
8
- require 'debugger'
9
- end
2
+ require 'simplecov'
3
+ rescue LoadError
4
+ # ignore
5
+ end
6
+
7
+ begin
8
+ require 'debug'
10
9
  rescue LoadError
11
10
  # ignore
12
11
  end
@@ -12,10 +12,3 @@ Feature: Decode LaTeX symbol directives
12
12
  | \\uparrow | ↑ |
13
13
  | \\downarrow | ↓ |
14
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
-
@@ -0,0 +1,28 @@
1
+ Feature: Decode LaTeX whitespace directives
2
+ As a hacker who works with LaTeX
3
+ I want to be able to decode LaTeX whitespace
4
+
5
+ Scenario Outline: LaTeX to Unicode transformation
6
+ When I decode the string '<latex>'
7
+ Then I should get <pre> + U+<code> + <post>
8
+
9
+ Scenarios: Whitespace
10
+ | latex | pre | code | post | description |
11
+ | x~x | 'x' | 00A0 | 'x' | non-breaking space |
12
+ | ~y | '' | 00A0 | 'y' | leading non-breaking space |
13
+ | z\\,z | 'z' | 202F | 'z' | narrow no-break space |
14
+
15
+ # In LaTeX, `\,` produces a kern that is ⅙ em wide. A kern is a
16
+ # non-breaking space that is not subject to compression or expansion when
17
+ # determining optimal line breaks. The ideal representation might be a
18
+ # non-breaking variant of U+2006 Six-Per-Em Space, but the best option
19
+ # that exists seems to be U+202F Narrow No-Break Space. While U+202F
20
+ # doesn't have an explicit width, Unicode Standard Annex #14, “Unicode
21
+ # Line Breaking Algorithm,” revision 47, says:
22
+ #
23
+ # > When expanding or compressing interword space according to common
24
+ # > typographical practice, only the spaces marked by U+0020 SPACE and
25
+ # > U+00A0 NO-BREAK SPACE are subject to compression, and only spaces
26
+ # > marked by U+0020 SPACE, U+00A0 NO-BREAK SPACE, and occasionally spaces
27
+ # > marked by U+2009 THIN SPACE are subject to expansion. All other space
28
+ # > characters normally have fixed width.
data/latex-decode.gemspec CHANGED
@@ -8,17 +8,11 @@ Gem::Specification.new do |s|
8
8
  s.name = 'latex-decode'
9
9
  s.version = LaTeX::Decode::VERSION.dup
10
10
  s.authors = ['Sylvester Keil']
11
- s.email = ['http://sylvester.keil.or.at']
12
11
  s.homepage = 'http://github.com/inukshuk/latex-decode'
13
12
  s.summary = 'Decodes LaTeX to Unicode.'
14
13
  s.description = 'Decodes strings formatted in LaTeX to equivalent Unicode strings.'
15
14
  s.license = 'GPL-3.0'
16
-
17
- if RUBY_PLATFORM =~ /java/
18
- s.platform = 'java'
19
- else
20
- s.platform = 'ruby'
21
- end
15
+ s.platform = 'ruby'
22
16
 
23
17
  s.files = `git ls-files`.split("\n")
24
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -211,7 +211,7 @@ module LaTeX
211
211
  tone2 ˨
212
212
  tone1 ˩
213
213
  ss ß
214
- , \u2009
214
+ , \u202F
215
215
  }.map { |s| LaTeX.to_unicode(s) }].freeze
216
216
 
217
217
 
@@ -1,5 +1,5 @@
1
1
  module LaTeX
2
2
  module Decode
3
- VERSION = '0.3.2'.freeze
3
+ VERSION = '0.4.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,26 +1,26 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: latex-decode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-14 00:00:00.000000000 Z
11
+ date: 2022-07-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Decodes strings formatted in LaTeX to equivalent Unicode strings.
14
14
  email:
15
- - http://sylvester.keil.or.at
16
15
  executables: []
17
16
  extensions: []
18
17
  extra_rdoc_files:
19
18
  - README.md
20
19
  - LICENSE
21
20
  files:
21
+ - ".github/workflows/ci.yml"
22
22
  - ".gitignore"
23
- - ".travis.yml"
23
+ - ".simplecov"
24
24
  - Gemfile
25
25
  - LICENSE
26
26
  - README.md
@@ -37,6 +37,7 @@ files:
37
37
  - features/support/env.rb
38
38
  - features/symbols.feature
39
39
  - features/umlauts.feature
40
+ - features/whitespace.feature
40
41
  - latex-decode.gemspec
41
42
  - lib/latex/decode.rb
42
43
  - lib/latex/decode/accents.rb
@@ -74,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0'
76
77
  requirements: []
77
- rubygems_version: 3.1.2
78
+ rubygems_version: 3.2.15
78
79
  signing_key:
79
80
  specification_version: 4
80
81
  summary: Decodes LaTeX to Unicode.
@@ -90,3 +91,4 @@ test_files:
90
91
  - features/support/env.rb
91
92
  - features/symbols.feature
92
93
  - features/umlauts.feature
94
+ - features/whitespace.feature
data/.travis.yml DELETED
@@ -1,22 +0,0 @@
1
- language: ruby
2
- bundler_args: --without debug
3
- sudo: false
4
- cache: bundler
5
- before_install:
6
- - gem update --system
7
- - gem update bundler
8
- rvm:
9
- - 2.3
10
- - 2.4
11
- - 2.5
12
- - 2.6
13
- - 2.7
14
- - jruby-19mode
15
- - jruby-head
16
- #- rbx-2
17
- notifications:
18
- email:
19
- recipients:
20
- - sylvester@keil.or.at
21
- on_success: change
22
- on_failure: always