asciidoctor-interdoc-reftext 0.5.1 → 0.5.2

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: 2bab4c1588499a362eaa32a4e6b31ab22868542221a71c3f03527b9dafb22862
4
- data.tar.gz: 86e4299efd390de7db998eeb095fbcb1f05f5a852056cfe15cce3ab15aaaee38
3
+ metadata.gz: def75f94d48c725ab1a5011c5b54bf4c8be73276c7698d304ab20827b94d8842
4
+ data.tar.gz: 913f3cfa1cd2488db2a53d7cee46bec82d49fe52ce79bea650374c90dc23e12f
5
5
  SHA512:
6
- metadata.gz: ca1a5ccd4222e9cb076b96039ee54197e9fd8d1bca0b1e6b990ca6df3f515df66f515a9a7b162ab40dab96449daba71c743147401c6b0fe470bfc92dea416dac
7
- data.tar.gz: e176d06b13f26be0638e5a752fb980b675e32655672013598451dec587040fb46991ea328c1001368124aa48fc951e96995f3154fcd6947c9c54e3d972c8d594
6
+ metadata.gz: 8d5c53526ed579480541f25077d9af8a0094eb1504e2ef6d36d4e8291cbaa4b6a525a8731eb1b57d78874c02dee216dfb48a9af0cd989ded5dfeba6a052dc14f
7
+ data.tar.gz: a56c12233cd442a01194d8afd505529bd0954c7e5daba4a77e6c61ac060aea7f0f7ce37931cb5e5b60d1a177cd145cbab636243227def621e8e22addacb6d4c7
@@ -1,5 +1,4 @@
1
1
  = Asciidoctor Inter-doc Reference Text
2
- :source-language: shell
3
2
  // custom
4
3
  :gem-name: asciidoctor-interdoc-reftext
5
4
  :gh-name: jirutka/{gem-name}
@@ -62,20 +61,22 @@ where “The First Section” is *title* of the section with id _sec1_ in _other
62
61
 
63
62
  == Installation
64
63
 
64
+ ifndef::npm-readme[]
65
65
  === Ruby
66
66
 
67
67
  Install {gem-name} from Rubygems:
68
68
 
69
- [source, subs="+attributes"]
69
+ [source, sh, subs="+attributes"]
70
70
  gem install {gem-name}
71
71
 
72
72
  or to install the latest development version:
73
73
 
74
- [source, subs="+attributes"]
74
+ [source, sh, subs="+attributes"]
75
75
  gem install {gem-name} --pre
76
76
 
77
77
 
78
78
  === Node.js
79
+ endif::npm-readme[]
79
80
 
80
81
  Install {gem-name} from npmjs.com:
81
82
 
@@ -85,11 +86,12 @@ npm install --save {gem-name}
85
86
 
86
87
  == Usage
87
88
 
89
+ ifndef::npm-readme[]
88
90
  === CLI
89
91
 
90
92
  If you invoke Asciidoctor from command-line, use option `-r` to load the extension:
91
93
 
92
- [source, subs="+attributes"]
94
+ [source, sh, subs="+attributes"]
93
95
  asciidoctor -r {gem-name} README.adoc
94
96
 
95
97
 
@@ -104,6 +106,7 @@ IMPORTANT: Bundler automatically _requires_ all the specified gems.
104
106
 
105
107
 
106
108
  === Node.js
109
+ endif::npm-readme[]
107
110
 
108
111
  [source, js, subs="+attributes"]
109
112
  ----
@@ -20,10 +20,10 @@ text (label) for inter-document cross references"
20
20
  s.add_development_dependency 'corefines', '~> 1.11'
21
21
  s.add_development_dependency 'kramdown', '~> 1.16'
22
22
  s.add_development_dependency 'pandoc-ruby', '~> 2.0'
23
- s.add_development_dependency 'rake', '~> 12.0'
23
+ s.add_development_dependency 'rake', '~> 13.0'
24
24
  s.add_development_dependency 'rspec', '~> 3.7'
25
25
  s.add_development_dependency 'rspec-html-matchers', '~> 0.9.1'
26
26
  s.add_development_dependency 'rubocop', '~> 0.51.0'
27
- s.add_development_dependency 'simplecov', '~> 0.15'
27
+ s.add_development_dependency 'simplecov', '~> 0.17.1'
28
28
  s.add_development_dependency 'yard', '~> 0.9'
29
29
  end
@@ -39,10 +39,23 @@ module Asciidoctor::InterdocReftext
39
39
  # If this node is not an inter-document cross reference...
40
40
  return if @node_name != 'inline_anchor' || @attributes['path'].nil?
41
41
 
42
- # This variable is injected into the document by {Processor}.
43
- if (resolver = @document.instance_variable_get(Processor::RESOLVER_VAR_NAME))
42
+ # interdoc_reftext_resolver may return nil when the extension was loaded,
43
+ # but is disabled for the current document.
44
+ if (resolver = interdoc_reftext_resolver)
44
45
  @text = resolver.call(@attributes['refid'])
45
46
  end
46
47
  end
48
+
49
+ # @return [Asciidoctor::InterdocReftext::Resolver, nil]
50
+ def interdoc_reftext_resolver
51
+ # This variable is injected into the document by {Processor} or this method.
52
+ @document.instance_variable_get(Processor::RESOLVER_VAR_NAME) || begin
53
+ doc = @document
54
+ until (resolver = doc.instance_variable_get(Processor::RESOLVER_VAR_NAME))
55
+ doc = doc.parent_document or return nil
56
+ end
57
+ doc.instance_variable_set(Processor::RESOLVER_VAR_NAME, resolver)
58
+ end
59
+ end
47
60
  end
48
61
  end
@@ -82,7 +82,7 @@ module Asciidoctor::InterdocReftext
82
82
 
83
83
  # @param document [Asciidoctor::Document] the document to process.
84
84
  def process(document)
85
- resolver = @resolver_class.new(document, @resolver_opts)
85
+ resolver = @resolver_class.new(document, **@resolver_opts)
86
86
  document.instance_variable_set(RESOLVER_VAR_NAME, resolver)
87
87
  nil
88
88
  end
@@ -3,6 +3,6 @@
3
3
  module Asciidoctor
4
4
  module InterdocReftext
5
5
  # Version of the asciidoctor-interdoc-reftext gem.
6
- VERSION = '0.5.1'
6
+ VERSION = '0.5.2'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-interdoc-reftext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Jirutka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-07 00:00:00.000000000 Z
11
+ date: 2020-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '12.0'
81
+ version: '13.0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '12.0'
88
+ version: '13.0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rspec
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '0.15'
137
+ version: 0.17.1
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '0.15'
144
+ version: 0.17.1
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: yard
147
147
  requirement: !ruby/object:Gem::Requirement