defmastership-core 1.5.1 → 1.5.3

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: e305c214cf30723ae670f46f1bf3ffbe4d00b1867581e1db5be79f2ab8155a35
4
- data.tar.gz: b00c8a4e447f269176696da0b743d184e594ffd5a8fb0a0b83787343917a4846
3
+ metadata.gz: 87ef2f8df723ddacc30b17efb600a7cfacde2566599dce03becfe3fe2cbe2b9a
4
+ data.tar.gz: 2d646e28f1792c32040dd005e16587bf4cfdd06e41fcc71eeca405a7912e592b
5
5
  SHA512:
6
- metadata.gz: 847be19dfe955889f38c8e07c23c5fe297d84aec7d0cd3b81a2a6d2188ab3f8cfc5c6d4330a17969b14068baa73524b85a37fe469136b720c6d2f7bd71e99be0
7
- data.tar.gz: 4645b59b7d0ed3b7497b5e38dc9a29c7fcb32c54a622bdc7cba22dede1be05719b818c991727aae4ff229ec2e46ab58834c74b5b449eea4ed4f30bf48cdab957
6
+ metadata.gz: 9d937b2b863453035dc44671a218f35ebcd0fb7a835475ad33adf408c8a199a34ab57c5343d8381965c26965c11eb7c45be66a634a3013687bdcd1bedeac0304
7
+ data.tar.gz: a683dee22f180c43bc611be760b25e17980286fe6009e6fbeb29006b1bda495bfa86d152c2b0a06eaaa5f3420a8e89a2b8e7a4bb320bd42d60fa5992234d7cad
data/.gitlab-ci.yml CHANGED
@@ -28,16 +28,6 @@ yard documentation:
28
28
  paths:
29
29
  - doc
30
30
 
31
- unit tests ruby3.0:
32
- image: ruby:3.0
33
- script:
34
- - bundle exec rake test:spec
35
-
36
- unit tests ruby3.1:
37
- image: ruby:3.1
38
- script:
39
- - bundle exec rake test:spec
40
-
41
31
  unit tests ruby3.2:
42
32
  image: ruby:3.2
43
33
  script:
data/config/rubocop.yml CHANGED
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
11
11
 
12
- require:
12
+ plugins:
13
13
  - rubocop-performance
14
14
  - rubocop-rspec
15
15
  - rubocop-rake
@@ -40,7 +40,7 @@ module Defmastership
40
40
 
41
41
  # [Regexp] match optional explicit version and explicit checksum
42
42
  DEF_VERSION_AND_CHECKSUM = '(?<version_and_checksum>' \
43
- '\((?<explicit_version>[^~]+)?(?<explicit_checksum>~\h+)?\)' \
43
+ '\((?<explicit_version>[^~]+?)?(?<explicit_checksum>~\h+?)?\)' \
44
44
  ')?'
45
45
  public_constant :DEF_VERSION_AND_CHECKSUM
46
46
 
@@ -48,6 +48,10 @@ module Defmastership
48
48
  REFERENCE = an_id('reference').freeze
49
49
  public_constant :REFERENCE
50
50
 
51
+ # [Regexp] match reference with optional version and checksum
52
+ REF_WITH_OPT_VER_CHK = "\\s*#{REFERENCE}#{DEF_VERSION_AND_CHECKSUM}\\s*".freeze
53
+ public_constant :REF_WITH_OPT_VER_CHK
54
+
51
55
  # [Regexp] match defintion summary
52
56
  DEF_SUMMARY = <<~'SUM'
53
57
  \s*
@@ -79,10 +83,7 @@ module Defmastership
79
83
  #{DEF_KEYWORD}
80
84
  #{DEF_TYPE}
81
85
  ,
82
- \\s*
83
- #{REFERENCE}
84
- #{DEF_VERSION_AND_CHECKSUM}
85
- \\s*
86
+ #{REF_WITH_OPT_VER_CHK}
86
87
  #{DEF_SUMMARY}
87
88
  #{DEF_LABELS}
88
89
  \\s*
@@ -124,7 +125,7 @@ module Defmastership
124
125
  public_constant :IREF_DEF_AFT
125
126
  # [Regexp] match an internal cross reference
126
127
  IREF_DEF = Regexp.new(
127
- "#{IREF_DEF_BEF}#{an_id('intref')}#{IREF_DEF_AFT}",
128
+ "#{IREF_DEF_BEF}#{an_id('intref')}#{DEF_VERSION_AND_CHECKSUM}#{IREF_DEF_AFT}",
128
129
  Regexp::EXTENDED
129
130
  )
130
131
  public_constant :IREF_DEF
@@ -5,7 +5,7 @@ module Defmastership
5
5
  # Common to defmastership and asciidoctor-defmastership
6
6
  module Core
7
7
  # [String] Gem version
8
- VERSION = '1.5.1'
8
+ VERSION = '1.5.3'
9
9
  public_constant :VERSION
10
10
  end
11
11
  end
data/spec/spec_helper.rb CHANGED
@@ -13,9 +13,8 @@ SimpleCov.start do
13
13
  add_filter 'vendor'
14
14
  add_filter 'set_join_hack'
15
15
 
16
- minimum_coverage 100
17
-
18
16
  enable_coverage :branch
17
+ minimum_coverage line: 100, branch: 100
19
18
  end
20
19
 
21
20
  RSpec::Matchers.define(:matchdata_including) do |h|
@@ -217,6 +217,39 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
217
217
  end
218
218
  end
219
219
 
220
+ describe 'REF_WITH_OPT_VER_CHK' do
221
+ subject(:regexp) { Regexp.new("^#{described_class::REF_WITH_OPT_VER_CHK}$", Regexp::EXTENDED) }
222
+
223
+ [
224
+ 'abc',
225
+ '_abc_efg_',
226
+ '-abc-efg-',
227
+ 'REFERENCE-0001',
228
+ 'REFERENCE-0001(a)',
229
+ 'REFERENCE-0001(~1234abcd)',
230
+ 'REFERENCE-0001(a~1234abcd)'
231
+ ].each do |line|
232
+ it { is_expected.to(match(line)) }
233
+ end
234
+
235
+ it { expect(regexp.match('the_ref')[:reference]).to(eq('the_ref')) }
236
+ it { expect(regexp.match('the_ref')[:version_and_checksum]).to(be_nil) }
237
+ it { expect(regexp.match('the_ref')[:explicit_version]).to(be_nil) }
238
+ it { expect(regexp.match('the_ref')[:explicit_checksum]).to(be_nil) }
239
+ it { expect(regexp.match('the_ref(a)')[:reference]).to(eq('the_ref')) }
240
+ it { expect(regexp.match('the_ref(a)')[:version_and_checksum]).to(eq('(a)')) }
241
+ it { expect(regexp.match('the_ref(a)')[:explicit_version]).to(eq('a')) }
242
+ it { expect(regexp.match('the_ref(a)')[:explicit_checksum]).to(be_nil) }
243
+ it { expect(regexp.match('the_ref(~abcd)')[:reference]).to(eq('the_ref')) }
244
+ it { expect(regexp.match('the_ref(~abcd)')[:version_and_checksum]).to(eq('(~abcd)')) }
245
+ it { expect(regexp.match('the_ref(~abcd)')[:explicit_version]).to(be_nil) }
246
+ it { expect(regexp.match('the_ref(~abcd)')[:explicit_checksum]).to(eq('~abcd')) }
247
+ it { expect(regexp.match('the_ref(z~abcd)')[:reference]).to(eq('the_ref')) }
248
+ it { expect(regexp.match('the_ref(z~abcd)')[:version_and_checksum]).to(eq('(z~abcd)')) }
249
+ it { expect(regexp.match('the_ref(z~abcd)')[:explicit_version]).to(eq('z')) }
250
+ it { expect(regexp.match('the_ref(z~abcd)')[:explicit_checksum]).to(eq('~abcd')) }
251
+ end
252
+
220
253
  describe 'DEF_SUMMARY' do
221
254
  subject(:regexp) { Regexp.new("^#{described_class::DEF_SUMMARY}$", Regexp::EXTENDED) }
222
255
 
@@ -420,7 +453,7 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
420
453
  describe 'EREF_DEF' do
421
454
  subject(:regexp) { described_class::EREF_DEF }
422
455
 
423
- let(:one_match) { regexp.match('defs:eref[abcdef, [ABC, EDF(a~1234abcd)]]') }
456
+ let(:one_match) { regexp.match('defs:eref[abcdef, [ABC, EDF(a~1234abcd) ]]') }
424
457
 
425
458
  context 'with valid external ref' do
426
459
  [
@@ -507,8 +540,19 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
507
540
  it { is_expected.to(match(' defs:iref[ bla_bla]')) }
508
541
  it { is_expected.to(match(' defs:iref[ bla_bla ]')) }
509
542
  it { is_expected.to(match(' defs:iref[ bla_bla ] ')) }
543
+ it { is_expected.to(match(' defs:iref[ bla_bla(c~abcd1234) ] ')) }
510
544
 
511
545
  it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:intref]).to(eq('bla_bla')) }
546
+ it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:version_and_checksum]).to(be_nil) }
547
+ it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:explicit_version]).to(be_nil) }
548
+ it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:explicit_checksum]).to(be_nil) }
549
+
550
+ it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:intref]).to(eq('bla')) }
551
+ it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:version_and_checksum]).to(eq('(c~abcd1234)')) }
552
+ it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:explicit_version]).to(eq('c')) }
553
+ it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:explicit_checksum]).to(eq('~abcd1234')) }
554
+ it { expect(regexp.match('defs:iref[bla(c)] defs:iref[bla(c~abcd1234)]')[:explicit_version]).to(eq('c')) }
555
+ it { expect(regexp.match('defs:iref[bla(~abcd1234)] defs:iref[bla(c)')[:explicit_checksum]).to(eq('~abcd1234')) }
512
556
  end
513
557
 
514
558
  context 'with invalid IREF_DEF' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defmastership-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jérôme Arbez-Gindre
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  - !ruby/object:Gem::Version
59
59
  version: '0'
60
60
  requirements: []
61
- rubygems_version: 3.7.1
61
+ rubygems_version: 3.6.9
62
62
  specification_version: 4
63
63
  summary: Handling of references and definitions with asciidoctor - common code
64
64
  test_files: []