asciidoctor-interdoc-reftext 0.5.1 → 0.5.3

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: 2bab4c1588499a362eaa32a4e6b31ab22868542221a71c3f03527b9dafb22862
4
- data.tar.gz: 86e4299efd390de7db998eeb095fbcb1f05f5a852056cfe15cce3ab15aaaee38
3
+ metadata.gz: 4ec7585bb9f39d9a04e467fb1903f7aa28ff71d350bd32a5359b419ea011584b
4
+ data.tar.gz: 599d15c906523fd8e1eb3a7db8916f75c5d1c9822f9be17495dd29b2975ea67e
5
5
  SHA512:
6
- metadata.gz: ca1a5ccd4222e9cb076b96039ee54197e9fd8d1bca0b1e6b990ca6df3f515df66f515a9a7b162ab40dab96449daba71c743147401c6b0fe470bfc92dea416dac
7
- data.tar.gz: e176d06b13f26be0638e5a752fb980b675e32655672013598451dec587040fb46991ea328c1001368124aa48fc951e96995f3154fcd6947c9c54e3d972c8d594
6
+ metadata.gz: a885734d641d8a44e2e73a8a54d6d71adc223305354763916deb898ef870e1e63a800ca4fb2d14587993befcef55aa136957afd1816e4c2d9497ae69679ef0d1
7
+ data.tar.gz: 646d0003f628f878ee00bfa240e19858ff4475568ca5e8de0891a9573168b33a877a5b61544e28958c10784ec49e87e78e1ce44e44b9159b7c3711669431b132
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright 2018-2020 Jakub Jirutka <jakub@jirutka.cz>.
3
+ Copyright 2018-present Jakub Jirutka <jakub@jirutka.cz>.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.adoc CHANGED
@@ -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}
@@ -7,9 +6,9 @@
7
6
  :codacy-id: 7f60adeeb3fc49ee85863df2c65cd4eb
8
7
 
9
8
  ifdef::env-github[]
10
- image:https://travis-ci.org/{gh-name}.svg?branch={gh-branch}[Build Status, link="https://travis-ci.org/{gh-name}"]
11
- image:https://api.codacy.com/project/badge/Coverage/{codacy-id}["Test Coverage", link="https://www.codacy.com/app/{gh-name}"]
12
- image:https://api.codacy.com/project/badge/Grade/{codacy-id}["Codacy Code quality", link="https://www.codacy.com/app/{gh-name}"]
9
+ image:https://github.com/{gh-name}/workflows/CI/badge.svg[CI Status, link=https://github.com/{gh-name}/actions?query=workflow%3A%22CI%22]
10
+ image:https://app.codacy.com/project/badge/Coverage/{codacy-id}["Test Coverage", link="https://app.codacy.com/gh/{gh-name}/coverage/dashboard"]
11
+ image:https://app.codacy.com/project/badge/Grade/{codacy-id}["Codacy Code quality", link="https://app.codacy.com/gh/{gh-name}/dashboard"]
13
12
  image:https://img.shields.io/gem/v/{gem-name}.svg?style=flat[Gem Version, link="https://rubygems.org/gems/{gem-name}"]
14
13
  image:https://img.shields.io/npm/v/{gem-name}.svg?style=flat[npm Version, link="https://www.npmjs.org/package/{gem-name}"]
15
14
  image:https://img.shields.io/badge/yard-docs-blue.svg[Yard Docs, link="http://www.rubydoc.info/github/{gh-name}/{gh-branch}"]
@@ -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
  ----
@@ -1,4 +1,4 @@
1
- require File.expand_path('../lib/asciidoctor/interdoc_reftext/version', __FILE__)
1
+ require File.expand_path('lib/asciidoctor/interdoc_reftext/version', __dir__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'asciidoctor-interdoc-reftext'
@@ -13,17 +13,17 @@ text (label) for inter-document cross references"
13
13
 
14
14
  s.files = Dir['lib/**/*', '*.gemspec', 'LICENSE*', 'README.adoc']
15
15
 
16
- s.required_ruby_version = '>= 2.1'
16
+ s.required_ruby_version = '>= 2.7'
17
17
 
18
18
  s.add_runtime_dependency 'asciidoctor', '>= 1.5.6', '< 3.0'
19
19
 
20
20
  s.add_development_dependency 'corefines', '~> 1.11'
21
- s.add_development_dependency 'kramdown', '~> 1.16'
21
+ s.add_development_dependency 'kramdown', '~> 2.3'
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
@@ -67,6 +67,8 @@ module Asciidoctor::InterdocReftext
67
67
  super
68
68
  @resolver_class = resolver_class
69
69
  @resolver_opts = resolver_opts
70
+ # Workaround for a bug in Ruby 3.0 (see #6).
71
+ @resolver_opts.delete(:resolver_class)
70
72
 
71
73
  # Monkey-patch Asciidoctor::Inline unless already patched.
72
74
  unless ::Asciidoctor::Inline.include? InlineNodeMixin
@@ -82,7 +84,7 @@ module Asciidoctor::InterdocReftext
82
84
 
83
85
  # @param document [Asciidoctor::Document] the document to process.
84
86
  def process(document)
85
- resolver = @resolver_class.new(document, @resolver_opts)
87
+ resolver = @resolver_class.new(document, **@resolver_opts)
86
88
  document.instance_variable_set(RESOLVER_VAR_NAME, resolver)
87
89
  nil
88
90
  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.3'
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.3
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: 2024-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '1.16'
53
+ version: '2.3'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '1.16'
60
+ version: '2.3'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: pandoc-ruby
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -183,15 +183,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
- version: '2.1'
186
+ version: '2.7'
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
189
  - - ">="
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []
193
- rubyforge_project:
194
- rubygems_version: 2.7.7
193
+ rubygems_version: 3.3.27
195
194
  signing_key:
196
195
  specification_version: 4
197
196
  summary: Asciidoctor extension providing implicit (automatic) reference text (label)