asciidoctor-defmastership 1.1.2 → 1.3.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: 3cc6ac9b315460a66068ff4ab700fc9859f6c3aa6459e242e1865b3410a7ea2f
4
- data.tar.gz: 8a7e6f426be6247914ebd1aedd1abaa5504017b70118aef4462d13665efd534b
3
+ metadata.gz: 49fb875efec0cb60de96088d4b0e5ab90a50c433451d3bb0c8a934efd0d0cbf0
4
+ data.tar.gz: 32b56aa5a4221c309f27bf064a68727a4459946dca1d09439d20ac366088f315
5
5
  SHA512:
6
- metadata.gz: 007b489dc6700ca6fbb892dddd43360e7b05a9bb44735adc6d44e34f9311916b9c3a656bc3c51691ecc8fdfe5638ea7075bc81873485c9f1e6e16c733408bc6f
7
- data.tar.gz: e06a47a0f0ed36601fc01d6b41d16f00ef49a4e2122c2d61abb535ee517390c5ee334efff351d4e9f1d6bf2cba2ac1907c6df8d7e5ff84de09c915fb7d9131b4
6
+ metadata.gz: b748eb9d7d25537ce30f4c0d899cc906516f07ac0fdb59e4babce30f394dbbffbdc2f16aafe70186580719512a13b74038b55af5f5e8697ee42264eede8d6ef8
7
+ data.tar.gz: 2a36075bca780cb13332c9841c5c65834c49f9873d389fea158f142313b908cd5e7e3e0ea61d907620ada1415524a9ae3fae9e5032a0a07fadaf70b8989f9215
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.4')
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
  # --
@@ -196,12 +196,23 @@ module Asciidoctor
196
196
  # @return [Array<String>] the lines to replace defininition's line
197
197
  def str_a
198
198
  explicit_checksum_str = " [.checksum]#(#{@match[:explicit_checksum]})#" if @show_explicit_checksum
199
- explicit_version_str = Helper.explicit_version_str(@match[:explicit_version])
200
- labels_str = Helper.labels_str(@match[:labels])
201
- 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)
202
213
  [
203
- ".#{reference}#{explicit_version_str}#{explicit_checksum_str}#{labels_str}",
204
- "[##{reference}.define.#{@match[:type]}]"
214
+ ".#{reference}#{reference_decoration}",
215
+ "[##{reference}.define.#{type}]"
205
216
  ]
206
217
  end
207
218
  end
@@ -212,6 +223,14 @@ module Asciidoctor
212
223
  match[:symb] == 'url' && !match[:value].eql?('none')
213
224
  end
214
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
+
215
234
  # @param labels [Array[String]] List of labels of a definition
216
235
  # @return [String] the replacement string for labels
217
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.2'
8
+ VERSION = '1.3.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.2
4
+ version: 1.3.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-23 00:00:00.000000000 Z
11
+ date: 2025-01-04 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.4'
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.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ostruct
43
43
  requirement: !ruby/object:Gem::Requirement