asciidoctor-defmastership 1.3.0 → 1.3.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: 49fb875efec0cb60de96088d4b0e5ab90a50c433451d3bb0c8a934efd0d0cbf0
4
- data.tar.gz: 32b56aa5a4221c309f27bf064a68727a4459946dca1d09439d20ac366088f315
3
+ metadata.gz: c7a66599bbeb35d3fabb9ae1f4c6aa1513a3df1aab55bd273d32effb2c817d25
4
+ data.tar.gz: d5adce64bed24916c2a67c5a0510da1b46a24f0075d288b1217ef216da829b35
5
5
  SHA512:
6
- metadata.gz: b748eb9d7d25537ce30f4c0d899cc906516f07ac0fdb59e4babce30f394dbbffbdc2f16aafe70186580719512a13b74038b55af5f5e8697ee42264eede8d6ef8
7
- data.tar.gz: 2a36075bca780cb13332c9841c5c65834c49f9873d389fea158f142313b908cd5e7e3e0ea61d907620ada1415524a9ae3fae9e5032a0a07fadaf70b8989f9215
6
+ metadata.gz: 36bd2d7b1375d31c8603b487aa66bd8dd6cd4d5ab1589a8a0e51712bbbb7d6b1dcbb13f7ad8d274bb5a7be6ee395c7ade73014c6435da760126b6e040c988fa0
7
+ data.tar.gz: 766099a3e29be419ccc797f2e541bd1162249ae7c435a02fe65e0a081ac22e00840dd75f536f0672cc2f3c8accc942d97021c1515751914cb6eaa8850fa0735e
data/.gitlab-ci.yml CHANGED
@@ -1,9 +1,6 @@
1
1
  default:
2
- image: ruby:3.3
2
+ image: ruby:3.4
3
3
  before_script:
4
- - apt-get update
5
- - ruby -v
6
- - which ruby
7
4
  - gem install bundler --no-document
8
5
  - bundle install --jobs $(nproc) "${FLAGS[@]}"
9
6
 
@@ -26,54 +23,22 @@ code quality:
26
23
  script:
27
24
  - bundle exec rake quality:all
28
25
 
29
- bdd ruby2.7:
30
- image: ruby:2.7
31
- before_script:
32
- - apt-get update
33
- - ruby -v
34
- - which ruby
35
- - gem install bundler -v 2.4.22 --no-document
36
- - bundle install --jobs $(nproc) "${FLAGS[@]}"
37
- script:
38
- - bundle exec rake test:features
39
-
40
- bdd ruby3.0:
41
- image: ruby:3.0
42
- script:
43
- - bundle exec rake test:features
44
-
45
- bdd ruby3.1:
46
- image: ruby:3.1
47
- script:
48
- - bundle exec rake test:features
49
-
50
26
  bdd ruby3.2:
51
27
  image: ruby:3.2
52
28
  script:
53
29
  - bundle exec rake test:features
54
30
 
55
- unit tests ruby2.7:
56
- image: ruby:2.7
57
- before_script:
58
- - apt-get update
59
- - ruby -v
60
- - which ruby
61
- - gem install bundler -v 2.4.22 --no-document
62
- - bundle install --jobs $(nproc) "${FLAGS[@]}"
63
- script:
64
- - bundle exec rake test:spec
65
-
66
- unit tests ruby3.0:
67
- image: ruby:3.0
31
+ bdd ruby3.3:
32
+ image: ruby:3.3
68
33
  script:
69
- - bundle exec rake test:spec
34
+ - bundle exec rake test:features
70
35
 
71
- unit tests ruby3.1:
72
- image: ruby:3.1
36
+ unit tests ruby3.2:
37
+ image: ruby:3.2
73
38
  script:
74
39
  - bundle exec rake test:spec
75
40
 
76
- unit tests ruby3.2:
41
+ unit tests ruby3.3:
77
42
  image: ruby:3.2
78
43
  script:
79
44
  - bundle exec rake test:spec
data/Gemfile CHANGED
@@ -7,56 +7,36 @@ gemspec
7
7
 
8
8
  ruby RUBY_VERSION
9
9
 
10
- # rubocop:disable Metrics/BlockLength
11
10
  group :development do
12
11
  # cucumber steps for command line tests
13
- gem 'aruba', '~> 2'
12
+ gem 'aruba', '~> 2.3'
14
13
  # bdd
15
- gem 'cucumber', '~> 9'
16
-
17
- if RUBY_VERSION >= '3.0'
18
- # mutation testing
19
- plan = 'oss'
20
- key = '7oac4dMz95cTUuFPtGDfTDSQep6ZhdGW'
21
- source "https://#{plan}:#{key}@gem.mutant.dev" do
22
- # license needed
23
- gem 'mutant-license', '~> 0'
24
- end
25
- # mutation testing
26
- gem 'mutant-rspec', '~> 0'
27
- end
14
+ gem 'cucumber', '~> 10.1'
15
+ # mutation testing
16
+ gem 'mutant-rspec', '~> 0.13'
28
17
  # to parse provided Rakefile
29
- gem 'rake', '~> 13'
30
-
31
- if RUBY_VERSION >= '3.0'
32
- # needed by yard to render documentation
33
- gem 'rdoc', '~> 6'
34
- end
18
+ gem 'rake', '~> 13.3'
19
+ # needed by yard to render documentation
20
+ gem 'rdoc', '~> 6.14'
35
21
  # tdd
36
- gem 'rspec', '~> 3'
22
+ gem 'rspec', '~> 3.13'
37
23
  # code need to be clean
38
- gem 'rubocop', '1.65'
24
+ gem 'rubocop', '1.80'
39
25
  # code need to be clean
40
- gem 'rubocop-performance', '~> 1'
26
+ gem 'rubocop-performance', '~> 1.25'
41
27
  # Rakile needs to be clean
42
- gem 'rubocop-rake', '~> 0'
28
+ gem 'rubocop-rake', '~> 0.7'
43
29
  # unit tests need to be clean
44
- gem 'rubocop-rspec', '~> 2'
45
- if RUBY_VERSION >= '3.0'
46
- # detect selling code
47
- gem 'reek', '~> 6'
48
- end
30
+ gem 'rubocop-rspec', '~> 3.6'
31
+ # detect selling code
32
+ gem 'reek', '~> 6.5'
49
33
  # What is tdd without code coverage ?
50
- gem 'simplecov', '~> 0'
51
-
52
- if RUBY_VERSION >= '3.0'
53
- # to document code
54
- gem 'yard', '~> 0'
55
- end
34
+ gem 'simplecov', '~> 0.22'
35
+ # to document code
36
+ gem 'yard', '~> 0.9'
56
37
  end
57
- # rubocop:enable Metrics/BlockLength
58
38
 
59
39
  group :debugging do
60
40
  # Sometimes, we need to debug
61
- gem 'pry', '~> 0'
41
+ gem 'pry', '~> 0.15'
62
42
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  'rubygems_mfa_required' => 'true'
11
11
  }
12
12
 
13
- spec.required_ruby_version = '>= 2.7'
13
+ spec.required_ruby_version = '>= 3.0'
14
14
  spec.name = 'asciidoctor-defmastership'
15
15
  spec.version = Asciidoctor::Defmastership::VERSION
16
16
  spec.authors = ['Jérôme Arbez-Gindre']
@@ -38,6 +38,6 @@ Gem::Specification.new do |spec|
38
38
  spec.require_paths = ['lib']
39
39
 
40
40
  spec.add_dependency('asciidoctor', '~> 2.0')
41
- spec.add_dependency('defmastership-core', '~> 1.4')
41
+ spec.add_dependency('defmastership-core', '~> 1.5.2')
42
42
  spec.add_dependency('ostruct', '~> 0.6')
43
43
  end
data/config/reek.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- # detectors:
2
+ detectors:
3
3
  # Attribute:
4
4
  # enabled: true
5
5
  # exclude: []
@@ -12,11 +12,11 @@
12
12
  # ControlParameter:
13
13
  # enabled: true
14
14
  # exclude: []
15
- # DataClump:
15
+ DataClump:
16
16
  # enabled: true
17
17
  # exclude: []
18
18
  # max_copies: 2
19
- # min_clump_size: 2
19
+ min_clump_size: 3
20
20
  # DuplicateMethodCall:
21
21
  # enabled: true
22
22
  # exclude: []
data/config/rubocop.yml CHANGED
@@ -9,13 +9,13 @@
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
16
16
 
17
17
  AllCops:
18
- TargetRubyVersion: 2.7
18
+ TargetRubyVersion: 3.0
19
19
  EnabledByDefault: true
20
20
  DisplayCopNames: true
21
21
 
@@ -37,6 +37,7 @@ module Asciidoctor
37
37
  eref_config: ::Defmastership::Core::DMRegexp::EREF_CONFIG,
38
38
  definition: ::Defmastership::Core::DMRegexp::DEFINITION,
39
39
  eref_def: ::Defmastership::Core::DMRegexp::EREF_DEF,
40
+ ref_def: ::Defmastership::Core::DMRegexp::REF_WITH_OPT_VER_CHK,
40
41
  iref_def: ::Defmastership::Core::DMRegexp::IREF_DEF,
41
42
  attr_set: ::Defmastership::Core::DMRegexp::ATTR_SET,
42
43
  variable_def: ::Defmastership::Core::DMRegexp::VARIABLE_DEF
@@ -98,7 +99,7 @@ module Asciidoctor
98
99
  # @param match [MatchData] the match data from the matching Regexp
99
100
  # @return [Array<String>] the lines to replace the original line
100
101
  def build_external_ref(_line, match)
101
- return [] unless show_ext_ref(match)
102
+ return [] unless show_ext_ref?(match)
102
103
 
103
104
  extrefs = match[:extrefs].split(/\s*,\s*/)
104
105
  extref_line = extrefs.map { |ref| build_link(ref, match) }
@@ -114,8 +115,8 @@ module Asciidoctor
114
115
  def build_internal_ref(line, _match)
115
116
  [
116
117
  line.gsub(REGEXPS.fetch(:iref_def)) do
117
- intref = Regexp.last_match[:intref]
118
- "<<#{intref},#{intref}>>"
118
+ reference, shown_ref = Helper.iref_shown_ref(Regexp.last_match, @variables)
119
+ "<<#{reference},#{shown_ref}>>"
119
120
  end
120
121
  ]
121
122
  end
@@ -165,19 +166,24 @@ module Asciidoctor
165
166
 
166
167
  def build_link(ref, match)
167
168
  refname = match[:reference]
168
- return ref unless @has_url.include?(refname)
169
169
 
170
- ref_pattern =
171
- @variables["eref-#{refname}-ref-pattern"] || '#%s'
172
- ref_str = format(ref_pattern, ref)
170
+ reference, shown_ref = Helper.eref_shown_ref(refname, ref.match(/#{REGEXPS.fetch(:ref_def)}/), @variables)
173
171
 
174
- "link:{eref-#{refname}-url}#{ref_str}[#{ref}]"
172
+ return shown_ref unless @has_url.include?(refname)
173
+
174
+ formatted_url_link(refname, reference, shown_ref)
175
175
  end
176
176
 
177
- def show_ext_ref(match)
177
+ def show_ext_ref?(match)
178
178
  !@variables['show-ext-ref'].eql?('disable') &&
179
179
  !@variables["show-#{match[:reference]}-ext-ref"].eql?('disable')
180
180
  end
181
+
182
+ def formatted_url_link(refname, reference, shown_ref)
183
+ ref_pattern = @variables.fetch("eref-#{refname}-ref-pattern", '#%s')
184
+ ref_str = format(ref_pattern, reference)
185
+ "link:{eref-#{refname}-url}#{ref_str}[#{shown_ref}]"
186
+ end
181
187
  end
182
188
 
183
189
  # Proepocessors class Helpers
@@ -250,10 +256,70 @@ module Asciidoctor
250
256
  end
251
257
 
252
258
  # @param match [MatchData] the match data from the matching variable setting Regexp
253
- # @return [[Hash{String => Object}]] the hash corresponding to the variable setting
259
+ # @return [Hash{String => String}] the hash corresponding to the variable setting
254
260
  def self.variable_hash(match)
255
261
  { match[:varname] => match[:value] }
256
262
  end
263
+
264
+ # @param refname [String] the name associated to the reference
265
+ # @param matched_ref [MatchData] the parsed reference with optional version and checksum
266
+ # @param variables [Hash{String => String}] all seen document variables
267
+ #
268
+ # @return [[String, String]] the reference and the formated ref to show in the generated doc
269
+ def self.eref_shown_ref(refname, matched_ref, variables)
270
+ reference = matched_ref[:reference]
271
+ version_checksum = eref_build_version_checksum(refname, matched_ref, variables)
272
+ shown_ref = format_ref_with_checksum(reference, version_checksum)
273
+
274
+ [reference, shown_ref]
275
+ end
276
+
277
+ # @param matched_ref [MatchData] the parsed reference with optional version and checksum
278
+ # @param variables [Hash{String => String}] all seen document variables
279
+ #
280
+ # @return [[String, String]] the reference and the formated ref to show in the generated doc
281
+ def self.iref_shown_ref(matched_ref, variables)
282
+ reference = matched_ref[:intref]
283
+ version_checksum = iref_build_version_checksum(matched_ref, variables)
284
+ shown_ref = format_ref_with_checksum(reference, version_checksum)
285
+
286
+ [reference, shown_ref]
287
+ end
288
+
289
+ # @param refname [String] the name associated to the reference
290
+ # @param matched_ref [MatchData] the parsed reference with optional version and checksum
291
+ # @param variables [Hash{String => String}] all seen document variables
292
+ #
293
+ # @return [string] the combined version and checksum string.
294
+ def self.eref_build_version_checksum(refname, matched_ref, variables)
295
+ version = matched_ref[:explicit_version].to_s
296
+
297
+ return version if variables["eref-#{refname}-show-checksum"] == 'disable'
298
+
299
+ version + matched_ref[:explicit_checksum].to_s
300
+ end
301
+
302
+ # @param matched_ref [MatchData] the parsed reference with optional version and checksum
303
+ # @param variables [Hash{String => String}] all seen document variables
304
+ #
305
+ # @return [string] the combined version and checksum string.
306
+ def self.iref_build_version_checksum(matched_ref, variables)
307
+ version = matched_ref[:explicit_version].to_s
308
+
309
+ return version if variables['iref-show-checksum'] == 'disable'
310
+
311
+ version + matched_ref[:explicit_checksum].to_s
312
+ end
313
+
314
+ # @param reference [String] the concernend reference
315
+ # @param version_checksum [String] The version/checksum eventually empty
316
+ #
317
+ # @return [string] the formated ref to show in the generated doc
318
+ def self.format_ref_with_checksum(reference, version_checksum)
319
+ return reference if version_checksum.empty?
320
+
321
+ "#{reference}(#{version_checksum})"
322
+ end
257
323
  end
258
324
  end
259
325
  end
@@ -5,7 +5,7 @@ module Asciidoctor
5
5
  # main application module
6
6
  module Defmastership
7
7
  # [String] Gem version
8
- VERSION = '1.3.0'
8
+ VERSION = '1.3.1'
9
9
  public_constant :VERSION
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-defmastership
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jérôme Arbez-Gindre
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-04 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: asciidoctor
@@ -30,14 +29,14 @@ dependencies:
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '1.4'
32
+ version: 1.5.2
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '1.4'
39
+ version: 1.5.2
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: ostruct
43
42
  requirement: !ruby/object:Gem::Requirement
@@ -91,7 +90,6 @@ licenses:
91
90
  - MIT
92
91
  metadata:
93
92
  rubygems_mfa_required: 'true'
94
- post_install_message:
95
93
  rdoc_options: []
96
94
  require_paths:
97
95
  - lib
@@ -99,15 +97,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
97
  requirements:
100
98
  - - ">="
101
99
  - !ruby/object:Gem::Version
102
- version: '2.7'
100
+ version: '3.0'
103
101
  required_rubygems_version: !ruby/object:Gem::Requirement
104
102
  requirements:
105
103
  - - ">="
106
104
  - !ruby/object:Gem::Version
107
105
  version: '0'
108
106
  requirements: []
109
- rubygems_version: 3.5.22
110
- signing_key:
107
+ rubygems_version: 3.6.9
111
108
  specification_version: 4
112
109
  summary: asciidoctor extension to handle applicable definition references
113
110
  test_files: []