summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2024-03-07 18:59:37 -0700
committerGitHub <noreply@github.com>2024-03-07 18:59:37 -0700
commit7ce22405e97e52b8d3fd781828e64c825cba7931 (patch)
treefcf1da40d30225b0af7b1767b33bf1a3d3f21961 /lib
parent02cfbded6707f722218ecfeefc6c063d29f5e59a (diff)
resolves #4556 set cloaked-context attribute on source block when context is not :listing (PR #4563)
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/parser.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/asciidoctor/parser.rb b/lib/asciidoctor/parser.rb
index 18f29656..0daba0d7 100644
--- a/lib/asciidoctor/parser.rb
+++ b/lib/asciidoctor/parser.rb
@@ -562,6 +562,7 @@ class Parser
# process lines verbatim
if style && Compliance.strict_verbatim_paragraphs && (VERBATIM_STYLES.include? style)
block_context = style.to_sym
+ cloaked_context = :paragraph
reader.unshift_line this_line
# advance to block parsing =>
break
@@ -820,15 +821,16 @@ class Parser
case block_context
when :listing, :source
if block_context == :source || (language = attributes[1] ? nil : attributes[2] || doc_attrs['source-language'])
- if language
+ if language # :listing
attributes['style'] = 'source'
attributes['language'] = language
AttributeList.rekey attributes, [nil, nil, 'linenums']
- else
+ else # :source
AttributeList.rekey attributes, [nil, 'language', 'linenums']
if doc_attrs.key? 'source-language'
attributes['language'] = doc_attrs['source-language']
end unless attributes.key? 'language'
+ attributes['cloaked-context'] = cloaked_context unless cloaked_context == :listing
end
if (attributes.key? 'linenums') || (doc_attrs.key? 'source-linenums-option')
attributes['linenums-option'] = ''
@@ -857,6 +859,7 @@ class Parser
else
attributes['language'] = language
end
+ attributes['cloaked-context'] = cloaked_context
if (attributes.key? 'linenums') || (doc_attrs.key? 'source-linenums-option')
attributes['linenums-option'] = ''
end unless attributes.key? 'linenums-option'