summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.adoc1
-rw-r--r--lib/asciidoctor.rb8
-rw-r--r--test/substitutions_test.rb8
3 files changed, 13 insertions, 4 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index bb9f6f81..078531d0 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -62,6 +62,7 @@ Enhancements / Compliance::
* modify Cell class to extend from AbstractBlock instead of AbstractNode (#2963)
* implement block? and inline? methods on Column, both which return false (#2963)
* drop verse table cell style (treat as normal table cell) (#3111)
+ * allow negated subs to be specified on inline pass macro (#2191)
* log warning if footnoteref macro is found and compat mode is not enabled (#3114)
* log debug message instead of warning if block style is unknown (#3092)
* allow backend to delegate to a registered backend using the syntax synthetic:delegate when using custom templates (e.g., slides:html) (#891)
diff --git a/lib/asciidoctor.rb b/lib/asciidoctor.rb
index 53857db0..20a752d8 100644
--- a/lib/asciidoctor.rb
+++ b/lib/asciidoctor.rb
@@ -502,9 +502,9 @@ module Asciidoctor
#
if RUBY_ENGINE == 'opal'
# NOTE In JavaScript, ^ and $ match the boundaries of the string when the m flag is not set
- AttributeEntryPassMacroRx = /^pass:([a-z]+(?:,[a-z]+)*)?\[(#{CC_ALL}*)\]$/
+ AttributeEntryPassMacroRx = /^pass:([a-z]+(?:,[a-z-]+)*)?\[(#{CC_ALL}*)\]$/
else
- AttributeEntryPassMacroRx = /\Apass:([a-z]+(?:,[a-z]+)*)?\[(.*)\]\Z/m
+ AttributeEntryPassMacroRx = /\Apass:([a-z]+(?:,[a-z-]+)*)?\[(.*)\]\Z/m
end
# Matches an inline attribute reference.
@@ -913,7 +913,7 @@ module Asciidoctor
# asciimath:[x != 0]
# latexmath:[\sqrt{4} = 2]
#
- InlineStemMacroRx = /\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z]+)*)?\[(#{CC_ALL}*?[^\\])\]/m
+ InlineStemMacroRx = /\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z-]+)*)?\[(#{CC_ALL}*?[^\\])\]/m
# Matches a menu inline macro.
#
@@ -964,7 +964,7 @@ module Asciidoctor
# pass:quotes[text]
#
# NOTE we have to support an empty pass:[] for compatibility with AsciiDoc Python
- InlinePassMacroRx = /(?:(?:(\\?)\[([^\]]+)\])?(\\{0,2})(\+\+\+?|\$\$)(#{CC_ALL}*?)\4|(\\?)pass:([a-z]+(?:,[a-z]+)*)?\[(|#{CC_ALL}*?[^\\])\])/m
+ InlinePassMacroRx = /(?:(?:(\\?)\[([^\]]+)\])?(\\{0,2})(\+\+\+?|\$\$)(#{CC_ALL}*?)\4|(\\?)pass:([a-z]+(?:,[a-z-]+)*)?\[(|#{CC_ALL}*?[^\\])\])/m
# Matches an xref (i.e., cross-reference) inline macro, which may span multiple lines.
#
diff --git a/test/substitutions_test.rb b/test/substitutions_test.rb
index 176bd25f..b2fcd6ad 100644
--- a/test/substitutions_test.rb
+++ b/test/substitutions_test.rb
@@ -1624,6 +1624,14 @@ context 'Substitutions' do
assert_equal '<strong><html5></strong>', result
end
+ test 'inline pass macro supports incremental subs' do
+ para = block_from_string 'pass:n,-a[<{backend}>]'
+ result, passthroughs = para.extract_passthroughs para.source
+ assert_equal 1, passthroughs.size
+ result = para.restore_passthroughs result
+ assert_equal '&lt;{backend}&gt;', result
+ end
+
test 'should not recognize pass macro with invalid subsitution list' do
[',', '42', 'a,'].each do |subs|
para = block_from_string %(pass:#{subs}[foobar])