lib/asciidoctor/rx.rb in asciidoctor-2.0.18 vs lib/asciidoctor/rx.rb in asciidoctor-2.0.19
- old
+ new
@@ -87,11 +87,11 @@
# Examples
#
# include::chapter1.ad[]
# include::example.txt[lines=1;2;5..10]
#
- IncludeDirectiveRx = /^(\\)?include::([^\[][^\[]*)\[(#{CC_ANY}+)?\]$/
+ IncludeDirectiveRx = /^(\\)?include::([^\s\[](?:[^\[]*[^\s\[])?)\[(#{CC_ANY}+)?\]$/
# Matches a trailing tag directive in an include file.
#
# Examples
#
@@ -514,13 +514,13 @@
# https://github.com
# https://github.com[GitHub]
# <https://github.com>
# link:https://github.com[]
# "https://github.com[]"
+ # (https://github.com) <= parenthesis not included in autolink
#
- # FIXME revisit! the main issue is we need different rules for implicit vs explicit
- InlineLinkRx = %r((^|link:|#{CG_BLANK}|<|[>\(\)\[\];"'])(\\?(?:https?|file|ftp|irc)://[^\s\[\]<]*([^\s.,\[\]<]))(?:\[(|#{CC_ALL}*?[^\\])\])?)m
+ InlineLinkRx = %r((^|link:|#{CG_BLANK}|<|[>\(\)\[\];"'])(\\?(?:https?|file|ftp|irc)://)(?:([^\s\[\]]+)\[(|#{CC_ALL}*?[^\\])\]|([^\s\[\]<]*([^\s,.?!\[\]<\)]))))m
# Match a link or e-mail inline macro.
#
# Examples
#
@@ -566,25 +566,19 @@
# Matches an inline passthrough, which may span multiple lines.
#
# Examples
#
# +text+
- # `text` (compat)
+ # [x-]+text+
+ # [x-]`text`
+ # `text` (compat only)
+ # [role]`text` (compat only)
#
# NOTE we always capture the attributes so we know when to use compatible (i.e., legacy) behavior
InlinePassRx = {
- false => ['+', '`', /(^|[^#{CC_WORD};:])(?:\[([^\]]+)\])?(\\?(\+|`)(\S|\S#{CC_ALL}*?\S)\4)(?!#{CG_WORD})/m],
- true => ['`', nil, /(^|[^`#{CC_WORD}])(?:\[([^\]]+)\])?(\\?(`)([^`\s]|[^`\s]#{CC_ALL}*?\S)\4)(?![`#{CC_WORD}])/m]
+ false => ['+', '-]', /((?:^|[^#{CC_WORD};:\\])(?=(\[)|\+)|\\(?=\[)|(?=\\\+))(?:\2(x-|[^\]]+ x-)\]|(?:\[([^\]]+)\])?(?=(\\)?\+))(\5?(\+|`)(\S|\S#{CC_ALL}*?\S)\7)(?!#{CG_WORD})/m],
+ true => ['`', nil, /(^|[^`#{CC_WORD}])(?:(\Z)()|\[([^\]]+)\](?=(\\))?)?(\5?(`)([^`\s]|[^`\s]#{CC_ALL}*?\S)\7)(?![`#{CC_WORD}])/m],
}
-
- # Matches an inline plus passthrough spanning multiple lines, but only when it occurs directly
- # inside constrained monospaced formatting in non-compat mode.
- #
- # Examples
- #
- # +text+
- #
- SinglePlusInlinePassRx = /^(\\)?\+(\S|\S#{CC_ALL}*?\S)\+$/m
# Matches several variants of the passthrough inline macro, which may span multiple lines.
#
# Examples
#