asciidoctor-defmastership 1.0.7 → 1.0.8
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 +4 -4
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +17 -6
- data/Gemfile +39 -14
- data/Rakefile +12 -7
- data/asciidoctor-defmastership.gemspec +2 -2
- data/config/mutant.yml +23 -3
- data/config/reek.yml +129 -105
- data/config/rspec +4 -0
- data/config/rubocop.yml +59 -131
- data/lib/asciidoctor/defmastership/preprocessor.rb +185 -0
- data/lib/asciidoctor/defmastership/regexp_dispatcher.rb +5 -1
- data/lib/asciidoctor/defmastership/version.rb +2 -1
- data/lib/asciidoctor/defmastership.rb +2 -2
- data/tasks/console.rake +8 -0
- data/tasks/package.task +9 -0
- data/tasks/smelling_code.rake +41 -0
- data/tasks/test.rake +19 -0
- metadata +13 -18
- data/config/devtools.yml +0 -2
- data/config/flay.yml +0 -3
- data/config/flog.yml +0 -2
- data/config/yardstick.yml +0 -2
- data/lib/asciidoctor/defmastership/extension.rb +0 -149
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d012bdd9c28ef271bbb1f65b6df7b46b1c4b423fb4445e8e55c4bdb73f7a43de
|
4
|
+
data.tar.gz: 58ce5fc184f48878c8b7cd904e049a9a87bbb76d5a977beba4b0fad7a661cbfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76fe2d67b3827039dd4d974c7bf329a417d7edfc57bf5d42542092055fd9e8c54d0169e5b36213b6777acefc267cbce4e2aedae877ba7bc5ff6316a9c428a888
|
7
|
+
data.tar.gz: cd455d7722292309de19cf3788d9735a18fd6bd85bc7cab48f5165d9d3eaa61682fbdae70839884c649795f5155b0907b64f222affc1456d5fe9ab6f3023aead
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
default:
|
2
|
-
image: ruby:3.
|
2
|
+
image: ruby:3.3
|
3
3
|
before_script:
|
4
4
|
- apt-get update
|
5
5
|
- ruby -v
|
@@ -9,23 +9,34 @@ default:
|
|
9
9
|
|
10
10
|
unit tests:
|
11
11
|
script:
|
12
|
-
- bundle exec rake spec
|
12
|
+
- bundle exec rake test:spec
|
13
13
|
|
14
14
|
rubocop:
|
15
15
|
script:
|
16
|
-
- bundle exec rake rubocop
|
16
|
+
- bundle exec rake quality:rubocop
|
17
17
|
|
18
18
|
unit tests ruby2.7:
|
19
19
|
image: ruby:2.7
|
20
|
+
before_script:
|
21
|
+
- apt-get update
|
22
|
+
- ruby -v
|
23
|
+
- which ruby
|
24
|
+
- gem install bundler -v 2.4.22 --no-document
|
25
|
+
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
20
26
|
script:
|
21
|
-
- bundle exec rake spec
|
27
|
+
- bundle exec rake test:spec
|
22
28
|
|
23
29
|
unit tests ruby3.0:
|
24
30
|
image: ruby:3.0
|
25
31
|
script:
|
26
|
-
- bundle exec rake spec
|
32
|
+
- bundle exec rake test:spec
|
27
33
|
|
28
34
|
unit tests ruby3.1:
|
29
35
|
image: ruby:3.1
|
30
36
|
script:
|
31
|
-
- bundle exec rake spec
|
37
|
+
- bundle exec rake test:spec
|
38
|
+
|
39
|
+
unit tests ruby3.2:
|
40
|
+
image: ruby:3.2
|
41
|
+
script:
|
42
|
+
- bundle exec rake test:spec
|
data/Gemfile
CHANGED
@@ -2,19 +2,44 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
source('https://rubygems.org')
|
5
|
+
|
5
6
|
gemspec
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
#
|
12
|
-
|
13
|
-
|
14
|
-
gem
|
15
|
-
#
|
16
|
-
gem '
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
8
|
+
ruby RUBY_VERSION
|
9
|
+
|
10
|
+
group :development do
|
11
|
+
if RUBY_VERSION >= '3.0'
|
12
|
+
# mutation testing
|
13
|
+
plan = 'oss'
|
14
|
+
key = '7oac4dMz95cTUuFPtGDfTDSQep6ZhdGW'
|
15
|
+
source "https://#{plan}:#{key}@gem.mutant.dev" do
|
16
|
+
# license needed
|
17
|
+
gem 'mutant-license', '~> 0'
|
18
|
+
end
|
19
|
+
# mutation testing
|
20
|
+
gem 'mutant-rspec', '~> 0'
|
21
|
+
end
|
22
|
+
# to parse provided Rakefile
|
23
|
+
gem 'rake', '~> 13'
|
24
|
+
# tdd
|
25
|
+
gem 'rspec', '3.12'
|
26
|
+
# code need to be clean
|
27
|
+
gem 'rubocop', '1.65'
|
28
|
+
# code need to be clean
|
29
|
+
gem 'rubocop-performance', '~> 1'
|
30
|
+
# Rakile needs to be clean
|
31
|
+
gem 'rubocop-rake', '~> 0'
|
32
|
+
# unit tests need to be clean
|
33
|
+
gem 'rubocop-rspec', '~> 2'
|
34
|
+
if RUBY_VERSION >= '3.0'
|
35
|
+
# detect selling code
|
36
|
+
gem 'reek', '~> 6'
|
37
|
+
end
|
38
|
+
# What is tdd without code coverage ?
|
39
|
+
gem 'simplecov', '~> 0'
|
40
|
+
end
|
41
|
+
|
42
|
+
group :debugging do
|
43
|
+
# Sometimes, we need to debug
|
44
|
+
gem 'pry', '~> 0'
|
45
|
+
end
|
data/Rakefile
CHANGED
@@ -4,13 +4,18 @@
|
|
4
4
|
require('bundler/gem_tasks')
|
5
5
|
require('rspec/core/rake_task')
|
6
6
|
|
7
|
-
|
8
|
-
require('rubocop/rake_task')
|
7
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
desc 'Continous integration tasks'
|
10
|
+
task :ci do
|
11
|
+
[
|
12
|
+
'test:spec',
|
13
|
+
:rubocop
|
14
|
+
].each do |name|
|
15
|
+
puts "\n=== Running #{name}...\n"
|
16
|
+
Rake::Task[name].invoke
|
17
|
+
puts "\n=== Running #{name} -> Done\n"
|
18
|
+
end
|
14
19
|
end
|
15
20
|
|
16
|
-
task
|
21
|
+
task default: :ci
|
@@ -37,6 +37,6 @@ Gem::Specification.new do |spec|
|
|
37
37
|
end
|
38
38
|
spec.require_paths = ['lib']
|
39
39
|
|
40
|
-
spec.add_dependency('asciidoctor', '~> 2
|
41
|
-
spec.add_dependency('defmastership', '>= 1.0.
|
40
|
+
spec.add_dependency('asciidoctor', '~> 2')
|
41
|
+
spec.add_dependency('defmastership', '>= 1.0.19')
|
42
42
|
end
|
data/config/mutant.yml
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
---
|
2
2
|
includes:
|
3
|
-
- lib
|
4
|
-
integration:
|
3
|
+
- lib
|
4
|
+
integration:
|
5
|
+
name: rspec
|
5
6
|
requires:
|
6
|
-
-
|
7
|
+
- defmastership
|
8
|
+
matcher:
|
9
|
+
subjects:
|
10
|
+
- 'DefMastership*'
|
11
|
+
# ignore:
|
12
|
+
# - 'DefMastership::BatchModifier*'
|
13
|
+
# - 'DefMastership::CSVFormatter*'
|
14
|
+
# - 'DefMastership::CSVFormatterBody*'
|
15
|
+
# - 'DefMastership::CSVFormatterHeader*'
|
16
|
+
# - 'DefMastership::ChangeRefModifier*'
|
17
|
+
# - 'DefMastership::Definition*'
|
18
|
+
# - 'DefMastership::Document*'
|
19
|
+
# - 'DefMastership::Modifier*'
|
20
|
+
# - 'DefMastership::ModifierFactory*'
|
21
|
+
# - 'DefMastership::ParsingState*'
|
22
|
+
# - 'DefMastership::RenameIncludedFilesModifier*'
|
23
|
+
# - 'DefMastership::UpdateDefChecksumModifier*'
|
24
|
+
# - 'DefMastership::UpdateDefModifier*'
|
25
|
+
# - 'DefMastership::UpdateDefVersionModifier*'
|
26
|
+
# fail_fast: true
|
data/config/reek.yml
CHANGED
@@ -1,106 +1,130 @@
|
|
1
1
|
---
|
2
|
-
detectors:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
2
|
+
# detectors:
|
3
|
+
# Attribute:
|
4
|
+
# enabled: true
|
5
|
+
# exclude: []
|
6
|
+
# BooleanParameter:
|
7
|
+
# enabled: true
|
8
|
+
# exclude: []
|
9
|
+
# ClassVariable:
|
10
|
+
# enabled: true
|
11
|
+
# exclude: []
|
12
|
+
# ControlParameter:
|
13
|
+
# enabled: true
|
14
|
+
# exclude: []
|
15
|
+
# DataClump:
|
16
|
+
# enabled: true
|
17
|
+
# exclude: []
|
18
|
+
# max_copies: 2
|
19
|
+
# min_clump_size: 2
|
20
|
+
# DuplicateMethodCall:
|
21
|
+
# enabled: true
|
22
|
+
# exclude: []
|
23
|
+
# max_calls: 1
|
24
|
+
# allow_calls: []
|
25
|
+
# FeatureEnvy:
|
26
|
+
# enabled: true
|
27
|
+
# exclude: []
|
28
|
+
# InstanceVariableAssumption:
|
29
|
+
# enabled: true
|
30
|
+
# exclude: []
|
31
|
+
# IrresponsibleModule:
|
32
|
+
# enabled: true
|
33
|
+
# exclude: []
|
34
|
+
# LongParameterList:
|
35
|
+
# enabled: true
|
36
|
+
# exclude: []
|
37
|
+
# max_params: 3
|
38
|
+
# overrides:
|
39
|
+
# initialize:
|
40
|
+
# max_params: 5
|
41
|
+
# LongYieldList:
|
42
|
+
# enabled: true
|
43
|
+
# exclude: []
|
44
|
+
# max_params: 3
|
45
|
+
# ManualDispatch:
|
46
|
+
# enabled: true
|
47
|
+
# exclude: []
|
48
|
+
# MissingSafeMethod:
|
49
|
+
# enabled: true
|
50
|
+
# exclude: []
|
51
|
+
# ModuleInitialize:
|
52
|
+
# enabled: true
|
53
|
+
# exclude: []
|
54
|
+
# NestedIterators:
|
55
|
+
# enabled: true
|
56
|
+
# exclude: []
|
57
|
+
# max_allowed_nesting: 1
|
58
|
+
# ignore_iterators:
|
59
|
+
# - tap
|
60
|
+
# - Tempfile.create
|
61
|
+
# NilCheck:
|
62
|
+
# enabled: true
|
63
|
+
# exclude: []
|
64
|
+
# RepeatedConditional:
|
65
|
+
# enabled: true
|
66
|
+
# exclude: []
|
67
|
+
# max_ifs: 2
|
68
|
+
# SubclassedFromCoreClass:
|
69
|
+
# enabled: true
|
70
|
+
# exclude: []
|
71
|
+
# TooManyConstants:
|
72
|
+
# enabled: true
|
73
|
+
# exclude: []
|
74
|
+
# max_constants: 5
|
75
|
+
# TooManyInstanceVariables:
|
76
|
+
# enabled: true
|
77
|
+
# exclude: []
|
78
|
+
# max_instance_variables: 4
|
79
|
+
# TooManyMethods:
|
80
|
+
# enabled: true
|
81
|
+
# exclude: []
|
82
|
+
# max_methods: 15
|
83
|
+
# TooManyStatements:
|
84
|
+
# enabled: true
|
85
|
+
# exclude:
|
86
|
+
# - initialize
|
87
|
+
# max_statements: 5
|
88
|
+
# UncommunicativeMethodName:
|
89
|
+
# enabled: true
|
90
|
+
# exclude: []
|
91
|
+
# reject:
|
92
|
+
# - "/^[a-z]$/"
|
93
|
+
# - "/[0-9]$/"
|
94
|
+
# - "/[A-Z]/"
|
95
|
+
# accept: []
|
96
|
+
# UncommunicativeModuleName:
|
97
|
+
# enabled: true
|
98
|
+
# exclude: []
|
99
|
+
# reject:
|
100
|
+
# - "/^.$/"
|
101
|
+
# - "/[0-9]$/"
|
102
|
+
# accept: []
|
103
|
+
# UncommunicativeParameterName:
|
104
|
+
# enabled: true
|
105
|
+
# exclude: []
|
106
|
+
# reject:
|
107
|
+
# - "/^.$/"
|
108
|
+
# - "/[0-9]$/"
|
109
|
+
# - "/[A-Z]/"
|
110
|
+
# - "/^_/"
|
111
|
+
# accept: []
|
112
|
+
# UncommunicativeVariableName:
|
113
|
+
# enabled: true
|
114
|
+
# exclude: []
|
115
|
+
# reject:
|
116
|
+
# - "/^.$/"
|
117
|
+
# - "/[0-9]$/"
|
118
|
+
# - "/[A-Z]/"
|
119
|
+
# accept:
|
120
|
+
# - "/^_$/"
|
121
|
+
# UnusedParameters:
|
122
|
+
# enabled: true
|
123
|
+
# exclude: []
|
124
|
+
# UnusedPrivateMethod:
|
125
|
+
# enabled: false
|
126
|
+
# exclude: []
|
127
|
+
# UtilityFunction:
|
128
|
+
# enabled: true
|
129
|
+
# exclude: []
|
130
|
+
# public_methods_only: false
|
data/config/rspec
ADDED
data/config/rubocop.yml
CHANGED
@@ -1,151 +1,79 @@
|
|
1
|
-
|
1
|
+
# The behavior of RuboCop can be controlled via the .rubocop.yml
|
2
|
+
# configuration file. It makes it possible to enable/disable
|
3
|
+
# certain cops (checks) and to alter their behavior if they accept
|
4
|
+
# any parameters. The file can be placed either in your home
|
5
|
+
# directory or in some project directory.
|
6
|
+
#
|
7
|
+
# RuboCop will start looking for the configuration file in the directory
|
8
|
+
# where the inspected file is and continue its way up to the root directory.
|
9
|
+
#
|
10
|
+
# See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
|
11
|
+
|
12
|
+
require:
|
13
|
+
- rubocop-performance
|
14
|
+
- rubocop-rspec
|
15
|
+
- rubocop-rake
|
2
16
|
|
3
17
|
AllCops:
|
4
|
-
TargetRubyVersion: 2.
|
18
|
+
TargetRubyVersion: 2.7
|
19
|
+
EnabledByDefault: true
|
20
|
+
DisplayCopNames: true
|
5
21
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
# Ignore gemspec DSL
|
11
|
-
- '*.gemspec'
|
12
|
-
|
13
|
-
Naming/FileName:
|
14
|
-
Exclude:
|
15
|
-
- Rakefile
|
16
|
-
|
17
|
-
# Avoid parameter lists longer than five parameters.
|
18
|
-
ParameterLists:
|
19
|
-
Max: 3
|
20
|
-
CountKeywordArgs: true
|
21
|
-
|
22
|
-
# Avoid more than `Max` levels of nesting.
|
23
|
-
BlockNesting:
|
24
|
-
Max: 3
|
25
|
-
|
26
|
-
# Align with the style guide.
|
27
|
-
CollectionMethods:
|
28
|
-
PreferredMethods:
|
29
|
-
collect: 'map'
|
30
|
-
inject: 'reduce'
|
31
|
-
find: 'detect'
|
32
|
-
find_all: 'select'
|
33
|
-
|
34
|
-
# Do not force public/protected/private keyword to be indented at the same
|
35
|
-
# level as the def keyword. My personal preference is to outdent these keywords
|
36
|
-
# because I think when scanning code it makes it easier to identify the
|
37
|
-
# sections of code and visually separate them. When the keyword is at the same
|
38
|
-
# level I think it sort of blends in with the def keywords and makes it harder
|
39
|
-
# to scan the code and see where the sections are.
|
40
|
-
AccessModifierIndentation:
|
41
|
-
Enabled: false
|
42
|
-
|
43
|
-
# Limit line length
|
44
|
-
LineLength:
|
45
|
-
Max: 80
|
46
|
-
|
47
|
-
# Disable documentation checking until a class needs to be documented once
|
48
|
-
Documentation:
|
49
|
-
Enabled: false
|
50
|
-
|
51
|
-
# Do not always use &&/|| instead of and/or.
|
52
|
-
AndOr:
|
53
|
-
Enabled: false
|
22
|
+
Style/Copyright:
|
23
|
+
Enabled: true
|
24
|
+
Notice: 'Copyright (\(c\) )?202[0-9] Jerome Arbez-Gindre'
|
25
|
+
AutocorrectNotice: '# Copyright (c) 2023 Jerome Arbez-Gindre'
|
54
26
|
|
55
|
-
|
56
|
-
IfUnlessModifier:
|
27
|
+
Lint/ConstantResolution: # Not available ins rubocop 0.81
|
57
28
|
Enabled: false
|
58
29
|
|
59
|
-
|
60
|
-
CaseEquality:
|
30
|
+
Style/DocumentationMethod:
|
61
31
|
Enabled: false
|
62
32
|
|
63
|
-
|
64
|
-
|
65
|
-
Enabled: false
|
66
|
-
|
67
|
-
# Not all trivial readers/writers can be defined with attr_* methods
|
68
|
-
TrivialAccessors:
|
69
|
-
Enabled: false
|
70
|
-
|
71
|
-
# Allow empty lines around class body
|
72
|
-
EmptyLinesAroundClassBody:
|
73
|
-
Enabled: false
|
74
|
-
|
75
|
-
# Allow empty lines around module body
|
76
|
-
EmptyLinesAroundModuleBody:
|
77
|
-
Enabled: false
|
78
|
-
|
79
|
-
# Allow empty lines around block body
|
80
|
-
EmptyLinesAroundBlockBody:
|
81
|
-
Enabled: false
|
82
|
-
|
83
|
-
# Allow multiple line operations to not require indentation
|
84
|
-
MultilineOperationIndentation:
|
85
|
-
Enabled: false
|
86
|
-
|
87
|
-
# Prefer String#% over Kernel#sprintf
|
88
|
-
FormatString:
|
89
|
-
Enabled: false
|
90
|
-
|
91
|
-
# Use square brackets for literal Array objects
|
92
|
-
PercentLiteralDelimiters:
|
93
|
-
PreferredDelimiters:
|
94
|
-
'%': '{}'
|
95
|
-
'%i': '[]'
|
96
|
-
'%q': ()
|
97
|
-
'%Q': ()
|
98
|
-
'%r': '{}'
|
99
|
-
'%s': ()
|
100
|
-
'%w': '[]'
|
101
|
-
'%W': '[]'
|
102
|
-
'%x': ()
|
103
|
-
|
104
|
-
# Align if/else blocks with the variable assignment
|
105
|
-
EndAlignment:
|
106
|
-
EnforcedStyleAlignWith: variable
|
107
|
-
|
108
|
-
# Do not always align parameters when it is easier to read
|
109
|
-
AlignParameters:
|
33
|
+
Style/StringHashKeys :
|
34
|
+
Enabled: true
|
110
35
|
Exclude:
|
111
|
-
-
|
112
|
-
|
113
|
-
# Prefer #kind_of? over #is_a?
|
114
|
-
ClassCheck:
|
115
|
-
EnforcedStyle: kind_of?
|
36
|
+
- '*.gemspec'
|
116
37
|
|
117
|
-
|
118
|
-
|
119
|
-
Enabled: false
|
38
|
+
Style/MissingElse:
|
39
|
+
EnforcedStyle: case
|
120
40
|
|
121
|
-
|
122
|
-
|
123
|
-
|
41
|
+
Metrics/ModuleLength :
|
42
|
+
Exclude:
|
43
|
+
- 'spec/**/*'
|
124
44
|
|
125
|
-
|
126
|
-
|
127
|
-
|
45
|
+
Metrics/BlockLength :
|
46
|
+
Exclude:
|
47
|
+
- 'spec/**/*'
|
48
|
+
- '*.gemspec'
|
128
49
|
|
129
|
-
|
130
|
-
|
131
|
-
|
50
|
+
Security/Eval :
|
51
|
+
Exclude:
|
52
|
+
- 'Rakefile'
|
132
53
|
|
133
|
-
|
134
|
-
|
135
|
-
|
54
|
+
Style/ConstantVisibility :
|
55
|
+
Exclude:
|
56
|
+
# there is one unique explicit constant visibility for all
|
57
|
+
# constants
|
58
|
+
- 'lib/asciidoctor/defmastership/extension.rb'
|
136
59
|
|
137
|
-
#
|
138
|
-
|
139
|
-
|
60
|
+
# rubocop-rspec options
|
61
|
+
RSpec/MessageExpectation :
|
62
|
+
Enabled: true
|
140
63
|
|
141
|
-
|
142
|
-
Enabled:
|
64
|
+
RSpec/FilePath :
|
65
|
+
Enabled: true
|
143
66
|
|
144
|
-
|
145
|
-
|
67
|
+
RSpec/NestedGroups:
|
68
|
+
Max: 4
|
146
69
|
|
147
|
-
|
70
|
+
Layout/RedundantLineBreak:
|
148
71
|
Enabled: false
|
72
|
+
|
73
|
+
Style/DisableCopsWithinSourceCodeDirective:
|
74
|
+
Enabled: true
|
75
|
+
AllowedCops: ['Lint/InterpolationCheck']
|
149
76
|
|
150
|
-
Layout/
|
151
|
-
EnforcedStyle:
|
77
|
+
Layout/EndOfLine:
|
78
|
+
EnforcedStyle: lf
|
79
|
+
|
@@ -0,0 +1,185 @@
|
|
1
|
+
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# :nocov:
|
5
|
+
require('asciidoctor/extensions') unless RUBY_ENGINE == 'opal'
|
6
|
+
# :nocov:
|
7
|
+
|
8
|
+
# An extension that allow to define applicable definitions
|
9
|
+
#
|
10
|
+
# Usage
|
11
|
+
# :tag-mylabel-color: yellow
|
12
|
+
# :tag-otherlabel-color: red
|
13
|
+
#
|
14
|
+
#
|
15
|
+
# [define, requirement, TOTO-0001, [mylabel, otherlabel]]
|
16
|
+
# --
|
17
|
+
# The system shall allow to do lots of things.
|
18
|
+
# --
|
19
|
+
#
|
20
|
+
# or
|
21
|
+
#
|
22
|
+
# [define, requirement, TOTO-0001]
|
23
|
+
# This shall be nice.
|
24
|
+
#
|
25
|
+
require('asciidoctor/defmastership/regexp_dispatcher')
|
26
|
+
require('defmastership/constants')
|
27
|
+
require('defmastership/parsing_state')
|
28
|
+
|
29
|
+
module Asciidoctor
|
30
|
+
# Module to host DefMastership preprocessor
|
31
|
+
module DefMastership
|
32
|
+
# Preprocessor to replace adoc statements
|
33
|
+
# This class smells of :reek:InstanceVariableAssumption.
|
34
|
+
# Not an issue because process is the only method used by Asciidoctor
|
35
|
+
class Preprocessor < Asciidoctor::Extensions::Preprocessor
|
36
|
+
REGEXPS = {
|
37
|
+
eref_config: ::DefMastership::DMRegexp::EREF_CONFIG,
|
38
|
+
definition: ::DefMastership::DMRegexp::DEFINITION,
|
39
|
+
eref_def: ::DefMastership::DMRegexp::EREF_DEF,
|
40
|
+
iref_def: ::DefMastership::DMRegexp::IREF_DEF,
|
41
|
+
attr_set: ::DefMastership::DMRegexp::ATTR_SET,
|
42
|
+
variable_def: ::DefMastership::DMRegexp::VARIABLE_DEF
|
43
|
+
}.freeze
|
44
|
+
|
45
|
+
private_constant :REGEXPS
|
46
|
+
|
47
|
+
def process(_document, reader)
|
48
|
+
@has_url = Set.new
|
49
|
+
@variables = {}
|
50
|
+
@parsing_state = ::DefMastership::ParsingState.new
|
51
|
+
|
52
|
+
return reader if reader.eof?
|
53
|
+
|
54
|
+
reader.unshift_lines(parse_and_replace(reader.read_lines))
|
55
|
+
end
|
56
|
+
|
57
|
+
def build_definition(_line, matches)
|
58
|
+
Helper::DefinitionStringBuilder.new(matches, show_explicit_checksum(matches)).str
|
59
|
+
end
|
60
|
+
|
61
|
+
def variable_set(line, matches)
|
62
|
+
@variables.merge!(Helper.variable_hash(matches))
|
63
|
+
[line]
|
64
|
+
end
|
65
|
+
|
66
|
+
def set_eref_url_if_any(line, matches)
|
67
|
+
@has_url.add(matches[:reference]) if Helper.valid_eref_url?(matches)
|
68
|
+
[line]
|
69
|
+
end
|
70
|
+
|
71
|
+
def build_external_ref(_line, matches)
|
72
|
+
return [] unless show_ext_ref(matches)
|
73
|
+
|
74
|
+
extrefs = matches[:extrefs].split(/\s*,\s*/)
|
75
|
+
extref_line = extrefs.map { |ref| build_link(ref, matches) }
|
76
|
+
["[.external_reference]\#{eref-#{matches[:reference]}-prefix} #{extref_line.join(', ')}.#"]
|
77
|
+
end
|
78
|
+
|
79
|
+
# This method smells of :reek:UtilityFunction
|
80
|
+
def build_internal_ref(line, _matches)
|
81
|
+
[
|
82
|
+
line.gsub(REGEXPS.fetch(:iref_def)) do
|
83
|
+
intref = Regexp.last_match[:intref]
|
84
|
+
"<<#{intref},#{intref}>>"
|
85
|
+
end
|
86
|
+
]
|
87
|
+
end
|
88
|
+
|
89
|
+
# This method smells of :reek:UtilityFunction
|
90
|
+
def attribute_setting(_line, matches)
|
91
|
+
[
|
92
|
+
'[.attribute]',
|
93
|
+
"{attr-#{matches[:attr]}-prefix} #{matches[:value]}."
|
94
|
+
]
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
def build_subs
|
100
|
+
subs = RegexpDispatcher.new(self)
|
101
|
+
subs
|
102
|
+
.add_rule(REGEXPS.fetch(:eref_config), :set_eref_url_if_any)
|
103
|
+
.add_rule(REGEXPS.fetch(:definition), :build_definition)
|
104
|
+
.add_rule(REGEXPS.fetch(:eref_def), :build_external_ref)
|
105
|
+
.add_rule(REGEXPS.fetch(:iref_def), :build_internal_ref)
|
106
|
+
.add_rule(REGEXPS.fetch(:attr_set), :attribute_setting)
|
107
|
+
.add_rule(REGEXPS.fetch(:variable_def), :variable_set)
|
108
|
+
end
|
109
|
+
|
110
|
+
def parse_and_replace(lines)
|
111
|
+
subs = build_subs
|
112
|
+
lines.reduce([]) do |new_lines, line|
|
113
|
+
next new_lines + [line] unless @parsing_state.enabled?(line)
|
114
|
+
|
115
|
+
next new_lines + subs.replace(line)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def show_explicit_checksum(matches)
|
120
|
+
matches[:explicit_checksum] &&
|
121
|
+
!@variables['show-explicit-checksum'].eql?('disable') &&
|
122
|
+
!@variables["show-#{matches[:type]}-explicit-checksum"].eql?('disable')
|
123
|
+
end
|
124
|
+
|
125
|
+
def build_link(ref, matches)
|
126
|
+
refname = matches[:reference]
|
127
|
+
return ref unless @has_url.include?(refname)
|
128
|
+
|
129
|
+
"link:{eref-#{refname}-url}##{ref}[#{ref}]"
|
130
|
+
end
|
131
|
+
|
132
|
+
def show_ext_ref(matches)
|
133
|
+
!@variables['show-ext-ref'].eql?('disable') &&
|
134
|
+
!@variables["show-#{matches[:reference]}-ext-ref"].eql?('disable')
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# Proepocessors class Helpers
|
139
|
+
class Preprocessor
|
140
|
+
# Helpers for Preprocessor class
|
141
|
+
module Helper
|
142
|
+
# Isolate the definition macro
|
143
|
+
class DefinitionStringBuilder
|
144
|
+
def initialize(matches, show_explicit_checksum)
|
145
|
+
@matches = matches
|
146
|
+
@show_explicit_checksum = show_explicit_checksum
|
147
|
+
end
|
148
|
+
|
149
|
+
def str
|
150
|
+
explicit_checksum_str = " [.checksum]#(#{@matches[:explicit_checksum]})#" if @show_explicit_checksum
|
151
|
+
explicit_version_str = Helper.build_explicit_version_str(@matches[:explicit_version])
|
152
|
+
labels_str = Helper.build_labels_str(@matches[:labels])
|
153
|
+
reference = @matches[:reference]
|
154
|
+
[
|
155
|
+
".#{reference}#{explicit_version_str}#{explicit_checksum_str}#{labels_str}",
|
156
|
+
"[##{reference}.define.#{@matches[:type]}]"
|
157
|
+
]
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.valid_eref_url?(match)
|
162
|
+
match[:symb] == 'url' && !match[:value].eql?('none')
|
163
|
+
end
|
164
|
+
|
165
|
+
def self.build_labels_str(labels)
|
166
|
+
return unless labels
|
167
|
+
|
168
|
+
labels_strings =
|
169
|
+
labels.split(/\s*,\s*/).reduce([]) do |acc, label|
|
170
|
+
acc << "[.tag.{tag-#{label}-color}]##{label}#"
|
171
|
+
end
|
172
|
+
" #{labels_strings.join(' ')}"
|
173
|
+
end
|
174
|
+
|
175
|
+
def self.build_explicit_version_str(explicit_version)
|
176
|
+
" [.version]#(#{explicit_version})#" if explicit_version
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.variable_hash(match)
|
180
|
+
{ match[:varname] => match[:value] }
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
@@ -1,13 +1,17 @@
|
|
1
1
|
# Copyright (c) 2023 Jerome Arbez-Gindre
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
# :nocov:
|
4
5
|
require('asciidoctor/extensions') unless RUBY_ENGINE == 'opal'
|
6
|
+
# :nocov:
|
7
|
+
|
5
8
|
require('ostruct')
|
6
9
|
|
7
10
|
module Asciidoctor
|
8
11
|
module DefMastership
|
9
12
|
# Hosts several Text replacement rules
|
10
13
|
class RegexpDispatcher
|
14
|
+
# Class to link a regexp with a method
|
11
15
|
Rule = Struct.new(:regexp, :method_symbol)
|
12
16
|
private_constant :Rule
|
13
17
|
|
@@ -24,7 +28,7 @@ module Asciidoctor
|
|
24
28
|
def replace(line)
|
25
29
|
@rules.each do |rule|
|
26
30
|
matches = rule.regexp.match(line)
|
27
|
-
return @effective_subs.
|
31
|
+
return @effective_subs.public_send(rule.method_symbol, line, matches) if matches
|
28
32
|
end
|
29
33
|
[line]
|
30
34
|
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
if RUBY_ENGINE == 'opal'
|
5
|
-
require('asciidoctor/defmastership/
|
5
|
+
require('asciidoctor/defmastership/preprocessor')
|
6
6
|
else
|
7
|
-
require_relative('defmastership/
|
7
|
+
require_relative('defmastership/preprocessor')
|
8
8
|
end
|
9
9
|
|
10
10
|
Asciidoctor::Extensions.register do
|
data/tasks/console.rake
ADDED
data/tasks/package.task
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2023 Jerome Arbez-Gindre
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
namespace 'quality' do
|
5
|
+
begin
|
6
|
+
require('rubocop/rake_task')
|
7
|
+
|
8
|
+
RuboCop::RakeTask.new do |task|
|
9
|
+
task.options << '--display-cop-names'
|
10
|
+
task.options << '--config=config/rubocop.yml'
|
11
|
+
end
|
12
|
+
rescue LoadError
|
13
|
+
task(:rubocop) do
|
14
|
+
puts('Install rubocop to run its rake tasks')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
begin
|
19
|
+
require('reek/rake/task')
|
20
|
+
|
21
|
+
Reek::Rake::Task.new do |t|
|
22
|
+
t.fail_on_error = true
|
23
|
+
t.verbose = false
|
24
|
+
|
25
|
+
t.reek_opts = '--config config/reek.yml'
|
26
|
+
end
|
27
|
+
rescue LoadError
|
28
|
+
task(:reek) do
|
29
|
+
puts('Install reek to run its rake tasks')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
desc 'Runs all quality code check'
|
34
|
+
task(all: ['quality:rubocop', 'quality:reek'])
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Synonym for quality:rubocop'
|
38
|
+
task(rubocop: 'quality:rubocop')
|
39
|
+
|
40
|
+
desc 'Synonym for quality:reek'
|
41
|
+
task(reek: 'quality:reek')
|
data/tasks/test.rake
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright (c) 2023 Jerome Arbez-Gindre
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require('rspec/core/rake_task')
|
5
|
+
|
6
|
+
namespace 'test' do
|
7
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
8
|
+
t.rspec_opts = ['--options config/rspec']
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'Runs all unit tests and acceptance tests'
|
12
|
+
task(all: ['test:spec'])
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Synonym for test:spec'
|
16
|
+
task(spec: 'test:spec')
|
17
|
+
|
18
|
+
desc 'Synonym for test:all'
|
19
|
+
task(test: 'test:all')
|
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.0.
|
4
|
+
version: 1.0.8
|
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:
|
11
|
+
date: 2024-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -16,34 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2
|
19
|
+
version: '2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: defmastership
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '2.0'
|
33
|
+
version: 1.0.19
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - ">="
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.0.
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '2.0'
|
40
|
+
version: 1.0.19
|
47
41
|
description: |-
|
48
42
|
asciidoctor-defmastership allows to define
|
49
43
|
applicable definitions references, link to other references
|
@@ -66,21 +60,22 @@ files:
|
|
66
60
|
- asciidoctor-defmastership.gemspec
|
67
61
|
- bin/console
|
68
62
|
- bin/setup
|
69
|
-
- config/devtools.yml
|
70
|
-
- config/flay.yml
|
71
|
-
- config/flog.yml
|
72
63
|
- config/mutant.yml
|
73
64
|
- config/reek.yml
|
65
|
+
- config/rspec
|
74
66
|
- config/rubocop.yml
|
75
|
-
- config/yardstick.yml
|
76
67
|
- example/.config.adoc
|
77
68
|
- example/.gitignore
|
78
69
|
- example/example.adoc
|
79
70
|
- example/howto.sh
|
80
71
|
- lib/asciidoctor/defmastership.rb
|
81
|
-
- lib/asciidoctor/defmastership/
|
72
|
+
- lib/asciidoctor/defmastership/preprocessor.rb
|
82
73
|
- lib/asciidoctor/defmastership/regexp_dispatcher.rb
|
83
74
|
- lib/asciidoctor/defmastership/version.rb
|
75
|
+
- tasks/console.rake
|
76
|
+
- tasks/package.task
|
77
|
+
- tasks/smelling_code.rake
|
78
|
+
- tasks/test.rake
|
84
79
|
homepage: https://gitlab.com/jjag/asciidoctor-defmastership/
|
85
80
|
licenses:
|
86
81
|
- MIT
|
@@ -101,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
96
|
- !ruby/object:Gem::Version
|
102
97
|
version: '0'
|
103
98
|
requirements: []
|
104
|
-
rubygems_version: 3.4.
|
99
|
+
rubygems_version: 3.4.10
|
105
100
|
signing_key:
|
106
101
|
specification_version: 4
|
107
102
|
summary: asciidoctor extension to handle applicable definition references
|
data/config/devtools.yml
DELETED
data/config/flay.yml
DELETED
data/config/flog.yml
DELETED
data/config/yardstick.yml
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require('asciidoctor/extensions') unless RUBY_ENGINE == 'opal'
|
5
|
-
|
6
|
-
# An extension that allow to define applicable definitions
|
7
|
-
#
|
8
|
-
# Usage
|
9
|
-
# :tag-mylabel-color: yellow
|
10
|
-
# :tag-otherlabel-color: red
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# [define, requirement, TOTO-0001, [mylabel, otherlabel]]
|
14
|
-
# --
|
15
|
-
# The system shall allow to do lots of things.
|
16
|
-
# --
|
17
|
-
#
|
18
|
-
# or
|
19
|
-
#
|
20
|
-
# [define, requirement, TOTO-0001]
|
21
|
-
# This shall be nice.
|
22
|
-
#
|
23
|
-
require('asciidoctor/defmastership/regexp_dispatcher')
|
24
|
-
require('defmastership/constants')
|
25
|
-
require('defmastership/parsing_state')
|
26
|
-
|
27
|
-
module Asciidoctor
|
28
|
-
module DefMastership
|
29
|
-
# Preprocessor to replace adoc statements
|
30
|
-
class Preprocessor < Asciidoctor::Extensions::Preprocessor
|
31
|
-
EREF_CONFIG_REGEXP = ::DefMastership::DMRegexp::EREF_CONFIG
|
32
|
-
DEFINITION_REGEXP = ::DefMastership::DMRegexp::DEFINITION
|
33
|
-
EREF_DEF_REGEXP = ::DefMastership::DMRegexp::EREF_DEF
|
34
|
-
IREF_DEF_REGEXP = ::DefMastership::DMRegexp::IREF_DEF
|
35
|
-
ATTR_SET_REGEXP = ::DefMastership::DMRegexp::ATTR_SET
|
36
|
-
VARIABLE_DEF_REGEXP = ::DefMastership::DMRegexp::VARIABLE_DEF
|
37
|
-
|
38
|
-
def initialize(config = {})
|
39
|
-
super(config)
|
40
|
-
|
41
|
-
@has_url = {}
|
42
|
-
@variables = {}
|
43
|
-
@parsing_state = ::DefMastership::ParsingState.new
|
44
|
-
end
|
45
|
-
|
46
|
-
# process the document
|
47
|
-
def process(_document, reader)
|
48
|
-
return reader if reader.eof?
|
49
|
-
|
50
|
-
reader.unshift_lines(parse_and_replace(reader.read_lines))
|
51
|
-
reader
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def build_subs
|
57
|
-
subs = RegexpDispatcher.new(self)
|
58
|
-
subs
|
59
|
-
.add_rule(EREF_CONFIG_REGEXP, :set_eref_url_if_any)
|
60
|
-
.add_rule(DEFINITION_REGEXP, :build_definition)
|
61
|
-
.add_rule(EREF_DEF_REGEXP, :build_external_ref)
|
62
|
-
.add_rule(IREF_DEF_REGEXP, :build_internal_ref)
|
63
|
-
.add_rule(ATTR_SET_REGEXP, :attribute_setting)
|
64
|
-
.add_rule(VARIABLE_DEF_REGEXP, :variable_set)
|
65
|
-
end
|
66
|
-
|
67
|
-
def parse_and_replace(lines)
|
68
|
-
subs = build_subs
|
69
|
-
lines.reduce([]) do |new_lines, line|
|
70
|
-
next new_lines + [line] unless @parsing_state.enabled?(line)
|
71
|
-
|
72
|
-
next new_lines + subs.replace(line)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def set_eref_url_if_any(line, matches)
|
77
|
-
@has_url[matches[:refname]] = true if matches[:symb] == 'url' && matches[:value] != 'none'
|
78
|
-
[line]
|
79
|
-
end
|
80
|
-
|
81
|
-
def show_explicit_checksum(matches)
|
82
|
-
matches[:explicit_checksum] &&
|
83
|
-
@variables['show-explicit-checksum'] != 'disable' &&
|
84
|
-
@variables["show-#{matches[:type]}-explicit-checksum"] != 'disable'
|
85
|
-
end
|
86
|
-
|
87
|
-
def build_definition(_line, matches)
|
88
|
-
definition_lines = []
|
89
|
-
explicit_checksum_str = " [.checksum]#(#{matches[:explicit_checksum]})#" if show_explicit_checksum(matches)
|
90
|
-
explicit_version_str = " [.version]#(#{matches[:explicit_version]})#" if matches[:explicit_version]
|
91
|
-
labels_str = " #{labels_strings(matches[:labels]).join(' ')}" if matches[:labels]
|
92
|
-
definition_lines << ".#{matches[:reference]}#{explicit_version_str}#{explicit_checksum_str}#{labels_str}"
|
93
|
-
definition_lines <<
|
94
|
-
"[##{matches[:reference]}.define.#{matches[:type]}]"
|
95
|
-
end
|
96
|
-
|
97
|
-
def labels_strings(labels)
|
98
|
-
labels_strs = []
|
99
|
-
labels.split(/\s*,\s*/).reject(&:empty?).each do |label|
|
100
|
-
labels_strs << "[.tag.{tag-#{label}-color}]##{label}#"
|
101
|
-
end
|
102
|
-
labels_strs
|
103
|
-
end
|
104
|
-
|
105
|
-
def build_link(ref, matches)
|
106
|
-
if @has_url[matches[:refname]]
|
107
|
-
"link:{eref-#{matches[:refname]}-url}##{ref}[#{ref}]"
|
108
|
-
else
|
109
|
-
ref
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def show_ext_ref(matches)
|
114
|
-
@variables['show-ext-ref'] != 'disable' &&
|
115
|
-
@variables["show-#{matches[:refname]}-ext-ref"] != 'disable'
|
116
|
-
end
|
117
|
-
|
118
|
-
def build_external_ref(_line, matches)
|
119
|
-
return [] unless show_ext_ref(matches)
|
120
|
-
|
121
|
-
extrefs = matches[:extrefs].split(/\s*,\s*/)
|
122
|
-
new_line = "[.external_reference]\#{eref-#{matches[:refname]}-prefix} "
|
123
|
-
extref_line = extrefs.map { |ref| build_link(ref, matches) }
|
124
|
-
@has_url[matches[:refname]]
|
125
|
-
["#{new_line}#{extref_line.join(', ')}.#"]
|
126
|
-
end
|
127
|
-
|
128
|
-
def build_internal_ref(line, _matches)
|
129
|
-
[
|
130
|
-
line.gsub(IREF_DEF_REGEXP) do
|
131
|
-
"<<#{Regexp.last_match[:intref]},#{Regexp.last_match[:intref]}>>"
|
132
|
-
end
|
133
|
-
]
|
134
|
-
end
|
135
|
-
|
136
|
-
def attribute_setting(_line, matches)
|
137
|
-
[
|
138
|
-
'[.attribute]',
|
139
|
-
"{attr-#{matches[:attr]}-prefix} #{matches[:value]}."
|
140
|
-
]
|
141
|
-
end
|
142
|
-
|
143
|
-
def variable_set(line, matches)
|
144
|
-
@variables[matches[:varname]] = matches[:value]
|
145
|
-
[line]
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|