summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-02-28 00:27:35 -0700
committerDan Allen <dan.j.allen@gmail.com>2022-10-14 21:26:49 -0600
commitcd1f810b13cde5d959abf0e46af64ae299d78c33 (patch)
tree567336f7baf44f899591c8862bb6b6a6b7710eb8 /lib
parent58cac859ccf284a0802f26af2a60360300bed4a8 (diff)
add include role to link/URL macro that replaces include directive when include is not enabled
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/reader.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/asciidoctor/reader.rb b/lib/asciidoctor/reader.rb
index f83bc59f..d74fbd23 100644
--- a/lib/asciidoctor/reader.rb
+++ b/lib/asciidoctor/reader.rb
@@ -1023,7 +1023,7 @@ class PreprocessorReader < Reader
# however, be friendly and at least make it a link to the source document
elsif doc.safe >= SafeMode::SECURE
# FIXME we don't want to use a link macro if we are in a verbatim context
- replace_next_line %(link:#{expanded_target}[])
+ replace_next_line %(link:#{expanded_target}[role=include#{attrlist ? ',' + attrlist : ''}])
elsif @maxdepth
if @include_stack.size >= @maxdepth[:curr]
logger.error message_with_context %(maximum include depth of #{@maxdepth[:rel]} exceeded), source_location: cursor
@@ -1222,7 +1222,7 @@ class PreprocessorReader < Reader
if (Helpers.uriish? target) || (::String === @dir ? nil : (target = %(#{@dir}/#{target})))
unless doc.attr? 'allow-uri-read'
logger.warn message_with_context %(cannot include contents of URI: #{target} (allow-uri-read attribute not enabled)), source_location: cursor
- return replace_next_line %(link:#{target}[#{attrlist}])
+ return replace_next_line %(link:#{target}[role=include#{attrlist ? ',' + attrlist : ''}])
end
if doc.attr? 'cache-uri'
# caching requires the open-uri-cached gem to be installed