Skip to content

Commit 2bd9123

Browse files
committed
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 <[email protected]>
1 parent 4887567 commit 2bd9123

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Documentation/asciidoc.conf.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ifdef::doctype-book[]
4343
endif::doctype-book[]
4444

4545
[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])))}
4747

4848
endif::backend-docbook[]
4949

Documentation/asciidoctor-extensions.rb.in

+5-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module Git
4949

5050
def process parent, reader, attrs
5151
outlines = reader.lines.map do |l|
52-
l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2')
52+
l.gsub(/(\.\.\.?)([^\]$\. ])/, '{empty}`\1`{empty}\2')
5353
.gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$\\\*]+)}, '\1{empty}`\2`{empty}')
5454
.gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__')
5555
.gsub(']', ']{empty}')
@@ -71,8 +71,9 @@ module Git
7171
# unhandled math; pass source to alt and required mathphrase element; dblatex will process alt as LaTeX math
7272
%(<inlineequation><alt><![CDATA[#{equation = node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></mathphrase></inlineequation>)
7373
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>')
7677
.gsub(/(&lt;[-a-zA-Z0-9.]+&gt;)/, '<emphasis>\1</emphasis>')
7778
else
7879
open, close, supports_phrase = QUOTE_TAGS[type]
@@ -100,6 +101,7 @@ module Git
100101
def convert_inline_quoted node
101102
if node.type == :monospaced
102103
node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2')
104+
.gsub(/^\.\.\.?$/, '<code>\0</code>')
103105
.gsub(%r{([\[\s|()>.]|^|\]|&gt;)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<code>\2</code>')
104106
.gsub(/(&lt;[-a-zA-Z0-9.]+&gt;)/, '<em>\1</em>')
105107

0 commit comments

Comments
 (0)