doc: fix asciidoctor synopsis processing of triple-dots

The processing of triple dot notation is tricky because it can be mis-interpreted as an ellipsis. The special processing of the ellipsis is now complete and takes into account the case of `git-mv <source>... <dest>` Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jean-Noël Avila committed Apr 12, 2025 at 12:20 UTC c87b2b3a6f13ed8d98cf2bdf863af85175a623a5
2 files changed +6 -4
Documentation/asciidoc.conf.in
+1 -1
@@ -43,7 +43,7 @@ ifdef::doctype-book[]
43 endif::doctype-book[]
44
45 [literal-inlinemacro]
46 -{eval:re.sub(r'(&lt;[-a-zA-Z0-9.]+&gt;)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|&gt;)(\.?([-a-zA-Z0-9:+=~@,\\\*\/_^\$]+\.?)+)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))}
46 +{eval:re.sub(r'(&lt;[-a-zA-Z0-9.]+&gt;)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|&gt;)(\.?([-a-zA-Z0-9:+=~@\\\*\/_^\$]+\.?)+|,)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))}
47
48 endif::backend-docbook[]
49
Documentation/asciidoctor-extensions.rb.in
+5 -3
@@ -49,7 +49,7 @@ module Git
49
50 def process parent, reader, attrs
51 outlines = reader.lines.map do |l|
52 - l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2')
52 + l.gsub(/(\.\.\.?)([^\]$\. ])/, '{empty}`\1`{empty}\2')
53 .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$\\\*]+)}, '\1{empty}`\2`{empty}')
54 .gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__')
55 .gsub(']', ']{empty}')
@@ -71,8 +71,9 @@ module Git
71 # unhandled math; pass source to alt and required mathphrase element; dblatex will process alt as LaTeX math
72 %(<inlineequation><alt><![CDATA[#{equation = node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></mathphrase></inlineequation>)
73 elsif type == :monospaced
74 - node.text.gsub(/(\.\.\.?)([^\]$.])/, '<literal>\1</literal>\2')
75 - .gsub(%r{([\[\s|()>.]|^|\]|&gt;)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<literal>\2</literal>')
74 + node.text.gsub(/(\.\.\.?)([^\]$\.])/, '<literal>\1</literal>\2')
75 + .gsub(/^\.\.\.?$/, '<literal>\0</literal>')
76 + .gsub(%r{([\[\s|()>.]|^|\]|&gt;)(\.?([-a-zA-Z0-9:+=~@/_^\$\\\*]+\.{0,2})+|,)}, '\1<literal>\2</literal>')
77 .gsub(/(&lt;[-a-zA-Z0-9.]+&gt;)/, '<emphasis>\1</emphasis>')
78 else
79 open, close, supports_phrase = QUOTE_TAGS[type]
@@ -100,6 +101,7 @@ module Git
101 def convert_inline_quoted node
102 if node.type == :monospaced
103 node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2')
104 + .gsub(/^\.\.\.?$/, '<code>\0</code>')
105 .gsub(%r{([\[\s|()>.]|^|\]|&gt;)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<code>\2</code>')
106 .gsub(/(&lt;[-a-zA-Z0-9.]+&gt;)/, '<em>\1</em>')
107