summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/asciidoctor/interdoc_reftext/inline_node_mixin.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/asciidoctor/interdoc_reftext/inline_node_mixin.rb b/lib/asciidoctor/interdoc_reftext/inline_node_mixin.rb
index 17370b0..248b697 100644
--- a/lib/asciidoctor/interdoc_reftext/inline_node_mixin.rb
+++ b/lib/asciidoctor/interdoc_reftext/inline_node_mixin.rb
@@ -39,8 +39,14 @@ module Asciidoctor::InterdocReftext
# If this node is not an inter-document cross reference...
return if @node_name != 'inline_anchor' || @attributes['path'].nil?
+ # Only the top most document has the `@_interdoc_reftext_resolver` variable.
+ doc = @document
+ while doc.parent_document do
+ doc = doc.parent_document
+ end
+
# This variable is injected into the document by {Processor}.
- if (resolver = @document.instance_variable_get(Processor::RESOLVER_VAR_NAME))
+ if (resolver = doc.instance_variable_get(Processor::RESOLVER_VAR_NAME))
@text = resolver.call(@attributes['refid'])
end
end