Message ID | 20250331125608.92419-1-jn.avila@free.fr (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | doc: fix asciidoctor synopsis processing of triple-dots | expand |
On Mon, Mar 31, 2025 at 02:55:51PM +0200, Jean-Noël Avila wrote: > 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> > --- > Documentation/asciidoctor-extensions.rb.in | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/Documentation/asciidoctor-extensions.rb.in b/Documentation/asciidoctor-extensions.rb.in > index 2494f17a51..f2be66c4ad 100644 > --- a/Documentation/asciidoctor-extensions.rb.in > +++ b/Documentation/asciidoctor-extensions.rb.in > @@ -49,7 +49,7 @@ module Git > > def process parent, reader, attrs > outlines = reader.lines.map do |l| > - l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2') > + l.gsub(/(\.\.\.?)([^\]$\. ])/, '{empty}`\1`{empty}\2') > .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$]+)}, '\1{empty}`\2`{empty}') > .gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__') > .gsub(']', ']{empty}') > @@ -72,6 +72,7 @@ module Git > %(<inlineequation><alt><![CDATA[#{equation = node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></mathphrase></inlineequation>) > elsif type == :monospaced > node.text.gsub(/(\.\.\.?)([^\]$.])/, '<literal>\1</literal>\2') > + .gsub(/^\.\.\.?$/, '<literal>\0</literal>\2') > .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<literal>\2</literal>') > .gsub(/(<[-a-zA-Z0-9.]+>)/, '<emphasis>\1</emphasis>') > else > @@ -100,6 +101,7 @@ module Git > def convert_inline_quoted node > if node.type == :monospaced > node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2') > + .gsub(/^\.\.\.?$/, '<code>\0</code>') > .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<code>\2</code>') > .gsub(/(<[-a-zA-Z0-9.]+>)/, '<em>\1</em>') > Thanks. I can confirm that this patch addresses the issue I reported with the manpage of 'git diff' (though I think the commit message could go into a bit more detail as to what problem this patch attempts to solve and how). Alas, the issue caused by 'diff-generate-patch.adoc' in the manpages of diff-files, diff-index, log, etc. is still present.
Le lundi 31 mars 2025, 19:45:20 heure d’été d’Europe centrale SZEDER Gábor a écrit : > On Mon, Mar 31, 2025 at 02:55:51PM +0200, Jean-Noël Avila wrote: > > 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> > > --- > > > > Documentation/asciidoctor-extensions.rb.in | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/Documentation/asciidoctor-extensions.rb.in > > b/Documentation/asciidoctor-extensions.rb.in index 2494f17a51..f2be66c4ad > > 100644 > > --- a/Documentation/asciidoctor-extensions.rb.in > > +++ b/Documentation/asciidoctor-extensions.rb.in > > @@ -49,7 +49,7 @@ module Git > > > > def process parent, reader, attrs > > > > outlines = reader.lines.map do |l| > > > > - l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2') > > + l.gsub(/(\.\.\.?)([^\]$\. ])/, '{empty}`\1`{empty}\2') > > > > .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$]+)}, > > '\1{empty}`\2`{empty}') > > .gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__') > > .gsub(']', ']{empty}') > > > > @@ -72,6 +72,7 @@ module Git > > > > %(<inlineequation><alt><![CDATA[#{equation = > > node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></ mathphra > > se></inlineequation>)> > > elsif type == :monospaced > > > > node.text.gsub(/(\.\.\.?)([^\]$.])/, '<literal>\1</literal>\2') > > > > + .gsub(/^\.\.\.?$/, '<literal>\0</literal>\2') > > > > .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\ $]+ > > \.{0,2})+)}, '\1<literal>\2</literal>') > > .gsub(/(<[-a-zA-Z0-9.]+>)/, '<emphasis>\1</ emphasis>') > > > > else > > > > @@ -100,6 +101,7 @@ module Git > > > > def convert_inline_quoted node > > > > if node.type == :monospaced > > > > node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2') > > > > + .gsub(/^\.\.\.?$/, '<code>\0</code>') > > > > .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\ $]+ > > \.{0,2})+)}, '\1<code>\2</code>') > > .gsub(/(<[-a-zA-Z0-9.]+>)/, '<em>\1</em>') > > Thanks. I can confirm that this patch addresses the issue I reported > with the manpage of 'git diff' (though I think the commit message > could go into a bit more detail as to what problem this patch attempts > to solve and how). These regex are getting a bit too hairy now. I'm working on using a parser generator to clarify how it works (at least for asciidoctor). > > Alas, the issue caused by 'diff-generate-patch.adoc' in the manpages > of diff-files, diff-index, log, etc. is still present. Sorry to ready that, but I cannot reproduce on my setup (using asciidoctor 2.0.23): 2. It is followed by one or more extended header lines (this example shows a merge with two parents): index <hash>,<hash>..<hash> mode <mode>,<mode>..<mode> new file mode <mode> deleted file mode <mode>,<mode> Has the format failure changed with this patch? Thanks JN
diff --git a/Documentation/asciidoctor-extensions.rb.in b/Documentation/asciidoctor-extensions.rb.in index 2494f17a51..f2be66c4ad 100644 --- a/Documentation/asciidoctor-extensions.rb.in +++ b/Documentation/asciidoctor-extensions.rb.in @@ -49,7 +49,7 @@ module Git def process parent, reader, attrs outlines = reader.lines.map do |l| - l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2') + l.gsub(/(\.\.\.?)([^\]$\. ])/, '{empty}`\1`{empty}\2') .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$]+)}, '\1{empty}`\2`{empty}') .gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__') .gsub(']', ']{empty}') @@ -72,6 +72,7 @@ module Git %(<inlineequation><alt><![CDATA[#{equation = node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></mathphrase></inlineequation>) elsif type == :monospaced node.text.gsub(/(\.\.\.?)([^\]$.])/, '<literal>\1</literal>\2') + .gsub(/^\.\.\.?$/, '<literal>\0</literal>\2') .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<literal>\2</literal>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<emphasis>\1</emphasis>') else @@ -100,6 +101,7 @@ module Git def convert_inline_quoted node if node.type == :monospaced node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2') + .gsub(/^\.\.\.?$/, '<code>\0</code>') .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<code>\2</code>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<em>\1</em>')
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> --- Documentation/asciidoctor-extensions.rb.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)