git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH] Documentation: quote double-dash in "<commit> -- <filename>" for AsciiDoc
Date: Tue, 28 Jun 2011 23:15:07 -0500	[thread overview]
Message-ID: <20110629041432.GA28690@elie> (raw)
In-Reply-To: <7vaad1tzve.fsf@alter.siamese.dyndns.org>

Hi,

Junio C Hamano wrote:

> This looks very bad:
> 
>     $ cd $git/share/man
>     $ grep -l '(em ' */*.?
>
> even though we do want em-dash for some hits in the above output.

True.  Based on a glance at /usr/share/man, the patch misses:

 git-submodule.1: "git submodule sync -- A"
 various: git web--browse, git-mergetool--lib, git sh-i18n--envsubst
 rev-list options: history `A--P`

> And
> even worse, there seem to be exceptions to this rule, like ...
>
>> diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
>> index ac10cfbb..a516d577 100644
>> --- a/Documentation/git-revert.txt
>> +++ b/Documentation/git-revert.txt
>> @@ -23,7 +23,7 @@ throw away all uncommitted changes in your working directory, you
>>  should see linkgit:git-reset[1], particularly the '--hard' option.  If

Sloppy of me.  For reference, here's the rule from asciidoc.conf.

	# -- Spaced and unspaced em dashes (entity reference &mdash;).
	# Space on both sides is translated to thin space characters.
	(^-- )=&#8212;&#8201;
	(\n-- )|( -- )|( --\n)=&#8201;&#8212;&#8201;
	(\w)--(\w)=\1&#8212;\2
	\\--(?!-)=--

So:

 - "\--" always represents two dashes, unless followed by another
   minus sign.  There is no obvious technical reason to prefer {litdd}
   over \-- or vice versa.

 - options like "--hard" are safe nowadays (though it's equally safe
   to escape them as "\--hard").  Likewise, the trailing "--" in
   "foo--" is left unmolested.

 - before version 8.3.0[*], no unescaped "--" was safe for HTML output.
   They all would be converted to em dashes.

Will prepare a new patch that takes care of the missed spots using \--
except in cases like "git web{litdd}browse", to roughly follow the
existing style.  If someone wants to change those to "git web\--browse"
with a patch on top, I won't mind.

Thanks, both.

Regards,
Jonathan

[*] Quick history:

 - asciidoc 8.4.1
 - [98be31f1] line 1 (^-- ) is added ("Emdash replacement recognized at
   start of block")
 - asciidoc 8.3.5
 - asciidoc 8.3.0
 - [6e71157d] line 3 ((\w)--(\w)) is introduced.  It replaces the
   previous regex (\n|[^-\s\\])--([^-\s]|\n), which had been guarded by
   "ifndef::doctype-manpage" to mitigate the effect of false positives.
 - [46fbb7b7] The overeager pattern ([^\n \\])--([^-\s])=\1&#8212;\2
   guarded by "ifdef::doctype-manpage" is removed, since it has too
   many false positives ("Allow unescaped -- option prefixes in man
   pages (was not working in all situations)")
 - [12032332] Patterns start to capture surrounding whitespace so it
   can be converted to thin space.  In this spirit, the second line
   ((\n-- )|( -- )| --\n)) is introduced, the pattern
   (^|[^-\\])--($|[^-]) guarded by "ifndef::doctype-manpage" changes
   to (\n|[^-\s\\])--([^-\s]|\n), and the pattern (^|\s*[^\S\\])--($|\s+)
   guarded by "ifdef::doctype-manpage" changes to ([^\n \\])--([^-\s]).
 - asciidoc 8.2.7
 - asciidoc 8.2.4
 - asciidoc migrates from svn to mercurial (i.e., beginning of
   history).

Pre-history (from CHANGELOG.txt):

 - asciidoc 7.0.0: "Manpage command names containing dashes (in the
   manpage NAME section) were misinterpreted as the spaced dash
   command name/purpose separator.  Bug report and patch supplied by
   David Greaves"
 - asciidoc 6.0.3: "Spaced and unspaced em dashes are now recognized
   (previously only spaced em dashes were recognized)."
 - asciidoc 5.0.6: "A replacement has been added to `asciidoc.conf` to
   replace inline double dashes with the `&mdash;` entity."

  reply	other threads:[~2011-06-29  4:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-28 17:17 [PATCH] Documentation: quote double-dash in "<commit> -- <filename>" for AsciiDoc Jonathan Nieder
2011-06-28 21:22 ` Junio C Hamano
2011-06-29  4:15   ` Jonathan Nieder [this message]
2011-06-28 22:47 ` Jeff King
2011-06-29  5:31 ` [PATCH v2 0/2] Documentation: quote double-dash " Jonathan Nieder
2011-06-29  5:35   ` [PATCH 1/2 maint] " Jonathan Nieder
2011-06-29  5:36   ` [PATCH 2/2] Documentation/i18n: " Jonathan Nieder
2011-06-29 10:42     ` Ævar Arnfjörð Bjarmason
2011-06-29 16:44     ` [PATCH] fixup! " Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110629041432.GA28690@elie \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).