bibtex-ruby 6.1.0 → 6.2.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: fd8273ecbfc910f5944b9f471cf8eeda31e2052fbeeaf1c12335420f25d09371
4
- data.tar.gz: 11000b7d5bca33dc41a3c3d49abaeccecaaefb0457fa815998cbbaab6e1b2bb4
3
+ metadata.gz: 333784b37e105aee5f6f28e49793bd6cb4d969da35f34577007a48d496de7f5d
4
+ data.tar.gz: c2d544d145cfd202c099246ce91432746c535e49b38df9436adf043d4353e937
5
5
  SHA512:
6
- metadata.gz: c3403927d721d510d21b9ce5b0ea9b3507291cea43b62a4de00601b706d19401167e33d5696a8f6db1a276b9054e1d6b287f7de0b651ce9341609e83cde40986
7
- data.tar.gz: d2cea6ef667ffc50872c183a6f4dc6cf74039597987fea0747858cdb7850536b9af285e67f27a31748c691876d5029b97c8eb5525379711eab5b8c5bce8118b2
6
+ metadata.gz: fa8ff3fe9544b77d3c0de73e82ae1ff95f7708f0d63fa81b6e0a99e536170b550a275bb5321048463d4e301a31d467657b2f80876bc50e380498299fc0a99a2e
7
+ data.tar.gz: 4e08f81624ebec89855ad80b3cc7f5d1b7a40ca9bc64dcec44d8c091a3e38d4a93e9b0c8733954a8ff910c87ecda01d1f6e84e287dbf7f46afb75eae2ea0339f
data/Gemfile CHANGED
@@ -15,11 +15,6 @@ end
15
15
  group :test do
16
16
  gem 'cucumber'
17
17
  gem 'minitest', require: false
18
- gem 'unicode', '~>0.4', platforms: %i[mswin mingw mri]
19
- end
20
-
21
- group :extra do
22
- gem 'redcarpet', platforms: [:ruby]
23
18
  end
24
19
 
25
20
  group :profile do
@@ -32,7 +27,6 @@ group :coverage do
32
27
  end
33
28
 
34
29
  group :development do
35
- gem 'iconv', platforms: [:ruby]
36
30
  gem 'rake'
37
31
  gem 'yard'
38
32
  end
data/Rakefile CHANGED
@@ -26,7 +26,7 @@ end
26
26
  begin
27
27
  require 'cucumber/rake/task'
28
28
  Cucumber::Rake::Task.new(:features) do |t|
29
- t.cucumber_opts = '--format progress'
29
+ t.cucumber_opts = ['--format progress']
30
30
  end
31
31
  rescue LoadError
32
32
  desc 'Cucumber rake task not available'
data/bibtex-ruby.gemspec CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
 
28
28
  s.add_runtime_dependency('racc', ['~>1.7'])
29
29
  s.add_runtime_dependency('latex-decode', ['~>0.0'])
30
+ s.add_runtime_dependency('logger', ['~>1.7'])
30
31
 
31
32
  s.files = File.open('Manifest').readlines.map(&:chomp)
32
33
  s.test_files = Dir.glob('test/**/test*.rb')
@@ -1,23 +1,9 @@
1
1
  module BibTeX
2
- begin
3
- original_verbosity = $VERBOSE
4
- $VERBOSE = nil
5
-
6
- require 'iconv'
7
-
8
- @iconv = Iconv.new('ascii//translit//ignore', 'utf-8')
9
-
10
- def self.transliterate(str)
11
- @iconv.iconv(str)
12
- end
13
- rescue LoadError
14
- @iconv_replacements = Hash['ä', 'ae', 'ö', 'oe', 'ü', 'ue', 'Ä', 'Ae', 'Ö', 'Oe', 'Ü', 'Ue', 'ß', 'ss']
15
-
16
- # Returns +str+ transliterated containing only ASCII characters.
17
- def self.transliterate(str)
18
- str.gsub(/[äöüÄÖÜß]/, @iconv_replacements)
19
- end
20
- ensure
21
- $VERBOSE = original_verbosity
2
+ def self.transliterate(str)
3
+ str
4
+ .unicode_normalize(:nfkd)
5
+ .encode(Encoding::ASCII, invalid: :replace, undef: :replace, replace: '')
6
+ rescue
7
+ str.gsub(/[^\x20-\x7E]/, '')
22
8
  end
23
9
  end
@@ -1,11 +1,3 @@
1
- require 'uri/common'
2
-
3
- begin
4
- require 'rdf/vocab'
5
- rescue LoadError
6
- ::RDF::Vocab = RDF # support RDF on Ruby 1.9
7
- end
8
-
9
1
  class BibTeX::Entry::RDFConverter
10
2
  DEFAULT_REMOVE_FROM_FALLBACK = %w[
11
3
  bdsk-file-1
data/lib/bibtex/entry.rb CHANGED
@@ -676,12 +676,11 @@ module BibTeX
676
676
  def default_key
677
677
  k = names[0]
678
678
  k = k.respond_to?(:family) ? k.family : k.to_s
679
- k = BibTeX.transliterate(k).gsub(/["']/, '')
679
+ k = BibTeX.transliterate(k).tr('"\'', '')
680
680
  k = k[/[A-Za-z-]+/] || 'unknown'
681
681
  k << (year.to_s[/\d+/] || '-')
682
682
  k << 'a'
683
- k.downcase!
684
- k
683
+ k.downcase
685
684
  end
686
685
  end
687
686
  end
data/lib/bibtex/lexer.rb CHANGED
@@ -58,7 +58,7 @@ module BibTeX
58
58
  string: /string/io,
59
59
  comment: /comment\b/io,
60
60
  preamble: /preamble\b/io,
61
- key: %r{\s*[[:alpha:][:digit:] /:_!$\?\.%+;&\*'"-]+,}io,
61
+ key: %r{\s*[[:alpha:][:digit:] /:_!$\?\.%+;&\*'"{}-]+,}io,
62
62
  optional_key: %r{\s*[[:alpha:][:digit:] /:_!$\?\.%+;&\*'"-]*,}io
63
63
  }
64
64
 
@@ -19,7 +19,7 @@
19
19
  module BibTeX
20
20
  module Version
21
21
  MAJOR = 6
22
- MINOR = 1
22
+ MINOR = 2
23
23
  PATCH = 0
24
24
  BUILD = nil
25
25
 
data/lib/bibtex.rb CHANGED
@@ -79,6 +79,8 @@ end
79
79
 
80
80
  begin
81
81
  require 'rdf'
82
+ require 'rdf/vocab'
83
+ require 'uri/common'
82
84
  require 'bibtex/entry/rdf_converter'
83
85
  require 'bibtex/bibliography/rdf_converter'
84
86
  rescue LoadError
@@ -7,33 +7,47 @@ module BibTeX
7
7
  end
8
8
 
9
9
  it 'strips line breaks by default' do
10
- Lexer.new.analyse(%(@string{ x = "foo\nbar" })).stack[-3].must_be :==,
11
- [:STRING_LITERAL, 'foo bar']
10
+ assert_equal Lexer.new.analyse(%(@string{ x = "foo\nbar" })).stack[-3],
11
+ [:STRING_LITERAL, 'foo bar']
12
12
  end
13
13
 
14
14
  it 'strips whitespace after line breaks by default' do
15
- Lexer.new.analyse(%(@string{ x = "foo\n bar" })).stack[-3].must_be :==,
16
- [:STRING_LITERAL, 'foo bar']
15
+ assert_equal Lexer.new.analyse(%(@string{ x = "foo\n bar" })).stack[-3],
16
+ [:STRING_LITERAL, 'foo bar']
17
17
  end
18
18
 
19
19
  it 'matches KEY tokens' do
20
- Lexer.new.analyse('@misc{foo, }').symbols.must_be :==, [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
20
+ assert_equal Lexer.new.analyse('@misc{foo, }').symbols,
21
+ [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
21
22
  end
22
23
 
23
24
  it 'matches KEY tokens with non-ascii characters' do
24
- Lexer.new.analyse('@misc{löwe, }').symbols.must_be :==, [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
25
+ assert_equal Lexer.new.analyse('@misc{löwe, }').symbols,
26
+ [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
25
27
  end
26
28
 
27
29
  it 'matches KEY tokens after whitespace' do
28
- Lexer.new.analyse('@misc{ foo, }').symbols.must_be :==, [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
30
+ assert_equal Lexer.new.analyse('@misc{ foo, }').symbols,
31
+ [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
32
+ end
33
+
34
+ it 'matches KEY token with braces' do
35
+ assert_equal Lexer.new.analyse('@misc{fo{o, }').symbols,
36
+ [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
37
+ assert_equal Lexer.new.analyse('@misc{fo}o, }').symbols,
38
+ [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
39
+ assert_equal Lexer.new.analyse('@misc{foo:{bar}, }').symbols,
40
+ [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
29
41
  end
30
42
 
31
43
  it "doesn't start a comment for types starting with but not equal @comment" do
32
- Lexer.new.analyse('@commentary{staudinger, }').symbols.must_be :==, [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
44
+ assert_equal Lexer.new.analyse('@commentary{staudinger, }').symbols,
45
+ [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
33
46
  end
34
47
 
35
48
  it "doesn't start a preamble for types starting with but not equal @preamble" do
36
- Lexer.new.analyse('@preamblestring{ preamble }').symbols.must_be :==, [:AT, :NAME, :LBRACE, :NAME, :RBRACE, false]
49
+ assert_equal Lexer.new.analyse('@preamblestring{ preamble }').symbols,
50
+ [:AT, :NAME, :LBRACE, :NAME, :RBRACE, false]
37
51
  end
38
52
  end
39
53
  end
@@ -1,7 +1,7 @@
1
1
  require 'helper.rb'
2
2
 
3
3
  module BibTeX
4
- class TestBibtex < Minitest::Test
4
+ class TestUtilities < Minitest::Test
5
5
  def test_empty?
6
6
  assert BibTeX.open(Test.fixtures(:empty)).empty?
7
7
  refute BibTeX.open(Test.fixtures(:bibdesk)).empty?
data/test/test_bibtex.rb CHANGED
@@ -102,21 +102,17 @@ module BibTeX
102
102
 
103
103
  def test_missing_key
104
104
  assert_raises(BibTeX::ParseError) do
105
- BibTeX.parse(<<EOF)
106
- @article{}
107
- EOF
105
+ BibTeX.parse(<<-EOF)
106
+ @article{}
107
+ EOF
108
108
  end
109
- assert(
110
- BibTeX.parse(<<EOF, allow_missing_keys: true)
109
+ refute_empty BibTeX.parse(<<-EOF, allow_missing_keys: true)
111
110
  @article{}
112
- EOF
113
- )
114
- Timeout.timeout(2) do
115
- BibTeX.parse(<<EOF, allow_missing_keys: true)
111
+ EOF
112
+ refute_empty BibTeX.parse(<<-EOF, allow_missing_keys: true)
116
113
  @article{},
117
114
  @article{}
118
- EOF
119
- end
115
+ EOF
120
116
  end
121
117
  end
122
118
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibtex-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: racc
@@ -38,6 +37,20 @@ dependencies:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: logger
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.7'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.7'
41
54
  description: |
42
55
  BibTeX-Ruby is the Rubyist's swiss-army-knife for all things BibTeX. It
43
56
  includes a parser for all common BibTeX objects (@string, @preamble,
@@ -142,7 +155,6 @@ homepage: http://inukshuk.github.com/bibtex-ruby
142
155
  licenses:
143
156
  - GPL-3.0-or-later
144
157
  metadata: {}
145
- post_install_message:
146
158
  rdoc_options: []
147
159
  require_paths:
148
160
  - lib
@@ -157,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
169
  - !ruby/object:Gem::Version
158
170
  version: '0'
159
171
  requirements: []
160
- rubygems_version: 3.5.3
161
- signing_key:
172
+ rubygems_version: 3.7.0
162
173
  specification_version: 4
163
174
  summary: A BibTeX parser, converter and API for Ruby.
164
175
  test_files: