Skip to content

Commit

Permalink
do not process \http in converting http:// to link: : #808
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Aug 10, 2023
1 parent d31aff1 commit 16a83b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/metanorma/standoc/macros.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def pass_status(status, text)

PASS_INLINE_MACRO_STR = <<~REGEX.freeze
(
\\b(?<!-) # word-separator, no hyphen
\\b(?<![-\\\\]) # word-separator, no hyphen or backslash
(?: # don't capture these!
(?:#{PASS_INLINE_MACROS}):[^\\s\\[]* | # macro name, :, second key. OR:
span:uri \\b [^\\s\\[]* # span:uri, third key
Expand All @@ -125,7 +125,7 @@ def pass_inline_split(text)

# InlineLinkRx = %r((^|link:|#{CG_BLANK}|&lt;|[>\(\)\[\];"'])(\\?(?:https?|file|ftp|irc)://)(?:([^\s\[\]]+)\[(|#{CC_ALL}*?[^\\])\]|([^\s\[\]<]*([^\s,.?!\[\]<\)]))))m
#
InlineLinkRx = %r((^|(?<!-)\blink:(?!\+)|\p{Blank}|&lt;|[<>\(\)\[\];"'])(\\?(?:https?|file|ftp|irc)://)(?:([^\s\[\]]+)(?:(\[(|.*?[^\\])\])|([^\s\[\]<]*([^\s,.?!\[\]<\)])))))m.freeze
InlineLinkRx = %r((^|(?<![-\\])\blink:(?!\+)|\p{Blank}|&lt;|[<>\(\)\[\];"'])((?:https?|file|ftp|irc)://)(?:([^\s\[\]]+)(?:(\[(|.*?[^\\])\])|([^\s\[\]<]*([^\s,.?!\[\]<\)])))))m.freeze

def inlinelink(text)
text.include?("://") or return text
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/standoc/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ def versioned(mod, flavour)
end

module Standoc
VERSION = "2.5.1".freeze
VERSION = "2.5.2".freeze
end
end
3 changes: 3 additions & 0 deletions spec/metanorma/cleanup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2117,6 +2117,8 @@
== Clause
\\http://www.example.com/...abc

http://www.example.com/...abc

<http://www.example.com/...abc>
Expand Down Expand Up @@ -2152,6 +2154,7 @@
output = <<~OUTPUT
<clause id="_" inline-header="false" obligation="normative">
<title>Clause</title>
<p id="_">http://www.example.com/…​abc</p>
<p id="_">
<link target="http://www.example.com/...abc"/>
</p>
Expand Down

0 comments on commit 16a83b2

Please sign in to comment.