asciidoctor-defmastership 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0093ece719f43a0ffb350e2b5e76072a2e3d964f176dc94fef8bf4ede6931409'
4
- data.tar.gz: 32c7fef0e23be93c1ee75b3cf0a38ddbb4e1f55750c4bcff51b820a2dbcf1b57
3
+ metadata.gz: 3ece0811957c4e3031833dbc0d409959e325a9bd4ae9dee0d054fff8cd7ab9d8
4
+ data.tar.gz: abf8d6b71bbf4380eff7a7e08ced61adbb0be0b8e3a68365d7685f8e3f1b7399
5
5
  SHA512:
6
- metadata.gz: 9fddf00c32b5c86a5b5fc4b38d3d6ad171c44608b526f4b940fba03f627841ecc9a722ca301ce9385da8d21506f8c14ae91d5183cac05dc6beede691613347cb
7
- data.tar.gz: a988eaeac8f79505cd06e6ac5ca7bff4bf1f799d3503c2da9eedc76a4648fb1f3fbba690caa8ffadab100f0c47516fac2a2f7d0157f11bf5d765743d7d1ecf9b
6
+ metadata.gz: 2ac57b86fc0f9dc9776dc6710e78ecee039cc25be48da7dfaab6f3398d25ef9e1256cc122e30b2030913d3dab132f9d3c0d3875770c5166e82cf524ee2bbac12
7
+ data.tar.gz: c27b304aec80cf54d1c3da0a467789f5e588149304bc77dabda6b13f63b931fd7e12c062071c12afcdfc3b4d027b1c5a51c1bcffeffc7fa648c11249c217f5fb
data/README.adoc CHANGED
@@ -6,7 +6,7 @@ Asciidoctor Defmastership module is dedicated to preprocess asciidoctor files wh
6
6
  * For other lines check line against a vector of regexp and for each match replace the parsed lines with new content
7
7
  * Follows a list of noticeable transformations, for a complete list refers to spec/unit/asciidoctor/def_mastership/preprocessor_spec.rb
8
8
 
9
- * Lines like [define,requirement,XXYY] add title XXYY, anchor point and call style define.requirement located in stylesheet of renderer
9
+ * Lines like [define,requirement,XXYY] add reference XXYY, anchor point and call style define.requirement located in stylesheet of renderer
10
10
  * Add a dedicated style to checksums and option for visibility or not
11
11
  * Add attribute to requirements
12
12
 
@@ -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.2.0')
41
+ spec.add_dependency('defmastership-core', '~> 1.3')
42
42
  spec.add_dependency('ostruct', '~> 0.6')
43
43
  end
@@ -12,7 +12,7 @@ require('asciidoctor/extensions') unless RUBY_ENGINE == 'opal'
12
12
  # :tag-otherlabel-color: red
13
13
  #
14
14
  #
15
- # [define, requirement, TOTO-0001, [mylabel, otherlabel]]
15
+ # [define, requirement, TOTO-0001, a summary, [mylabel, otherlabel]]
16
16
  # --
17
17
  # The system shall allow to do lots of things.
18
18
  # --
@@ -127,9 +127,11 @@ module Asciidoctor
127
127
  # @return [Array<String>] the lines to replace the original line
128
128
  # This method smells of :reek:UtilityFunction
129
129
  def attribute_setting(_line, match)
130
+ attr_name = match[:attr]
130
131
  [
131
132
  '[.attribute]',
132
- "{attr-#{match[:attr]}-prefix} #{match[:value]}."
133
+ "[.attribute_prefix.attribute_#{attr_name}_prefix]\#{attr-#{attr_name}-prefix}# " \
134
+ "[.attribute_value.attribute_#{attr_name}_value]##{match[:value]}#."
133
135
  ]
134
136
  end
135
137
 
@@ -194,12 +196,23 @@ module Asciidoctor
194
196
  # @return [Array<String>] the lines to replace defininition's line
195
197
  def str_a
196
198
  explicit_checksum_str = " [.checksum]#(#{@match[:explicit_checksum]})#" if @show_explicit_checksum
197
- explicit_version_str = Helper.explicit_version_str(@match[:explicit_version])
198
- labels_str = Helper.labels_str(@match[:labels])
199
- reference = @match[:reference]
199
+ type = @match[:type]
200
+
201
+ build_str_a(
202
+ @match[:reference],
203
+ type,
204
+ "#{Helper.explicit_version_str(@match[:explicit_version])}#{explicit_checksum_str}" \
205
+ "#{Helper.summary_str(@match[:summary], type)}" \
206
+ "#{Helper.labels_str(@match[:labels])}"
207
+ )
208
+ end
209
+
210
+ private
211
+
212
+ def build_str_a(reference, type, reference_decoration)
200
213
  [
201
- ".#{reference}#{explicit_version_str}#{explicit_checksum_str}#{labels_str}",
202
- "[##{reference}.define.#{@match[:type]}]"
214
+ ".#{reference}#{reference_decoration}",
215
+ "[##{reference}.define.#{type}]"
203
216
  ]
204
217
  end
205
218
  end
@@ -210,6 +223,14 @@ module Asciidoctor
210
223
  match[:symb] == 'url' && !match[:value].eql?('none')
211
224
  end
212
225
 
226
+ # @param summary [String] summary of a definition
227
+ # @return [String] the replacement string for summary
228
+ def self.summary_str(summary, type)
229
+ return unless summary
230
+
231
+ " [.def-summary.def-#{type}-summary]##{summary}#"
232
+ end
233
+
213
234
  # @param labels [Array[String]] List of labels of a definition
214
235
  # @return [String] the replacement string for labels
215
236
  def self.labels_str(labels)
@@ -5,7 +5,7 @@ module Asciidoctor
5
5
  # main application module
6
6
  module Defmastership
7
7
  # [String] Gem version
8
- VERSION = '1.1.1'
8
+ VERSION = '1.2.0'
9
9
  public_constant :VERSION
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-defmastership
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jérôme Arbez-Gindre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-16 00:00:00.000000000 Z
11
+ date: 2024-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: defmastership-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.0
33
+ version: '1.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.0
40
+ version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ostruct
43
43
  requirement: !ruby/object:Gem::Requirement