[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] maint.mk: catch "see @xref{}"
From: |
Jim Meyering |
Subject: |
Re: [PATCH] maint.mk: catch "see @xref{}" |
Date: |
Mon, 16 Apr 2012 23:03:43 +0200 |
Jim Meyering wrote:
> Jim Meyering wrote:
>
>> Eric Blake wrote:
>>> On 04/16/2012 12:22 PM, Jim Meyering wrote:
>>>> +++ b/top/maint.mk
>>>> @@ -932,8 +932,11 @@ sc_prohibit_doubled_word:
>>>> # A regular expression matching undesirable combinations of words like
>>>> # "can not"; this matches them even when the two words appear on different
>>>> # lines, but not when there is an intervening delimiter like "#" or "*".
>>>> +# Similarly undesirable, "See @xref{...}" expands to "See *Note ...".
>>>
>>> Doesn't it actually expand to "See see *Note"?
>>
>> What I wrote is the expansion in "info" output.
>> In dvi/pdf output, it does expand to "See see Section..." (i.e., no
>> "*Note" there), so I'll have to revise the advice in the comment.
>> Per "info texinfo",
>>
>> 8.4 address@hidden'
>> ===========
>>
>> The address@hidden' command generates a cross reference for the
>> beginning of a
>> sentence.
>>
>> So any preceding token should be punctuation.
>
> It's not feasible to detect preceding punctuation
> (skipping things like macro uses/definitions and comments)
> without a full-blown parser, so here's a heuristic that should
> be good enough. It happens to catch two more nits in coreutils.texi:
>
> Subject: [PATCH] maint.mk: catch "see @xref{}" and similar
One more iteration.
Now, it handles xref and pxref separately, since
@pxref need not start a sentence.
>From 7381478f94cd5a8ba1dbdf91004758bdbf870932 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Mon, 16 Apr 2012 20:21:51 +0200
Subject: [PATCH] maint.mk: expand syntax-check rule to catch @xref and @pxref
abuse
* top/maint.mk (prohibit_undesirable_word_seq_RE_): An @xref{...}
should start a sentence and should not be preceded by "see",
"see also", etc. Add heuristic for @pxref too.
---
ChangeLog | 7 +++++++
top/maint.mk | 10 +++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index c08ba76..479c360 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-04-16 Akim Demaille <address@hidden>
+ and Jim Meyering <address@hidden>
+
+ maint.mk: catch "see @xref{}" and similar
+ * top/maint.mk (prohibit_undesirable_word_seq_RE_): Also
+ prohibit "See also @xref{", "Also see @pxref{", and similar.
+
2012-04-16 Jim Meyering <address@hidden>
bootstrap: really use gnulib's po/Makefile.in.in
diff --git a/top/maint.mk b/top/maint.mk
index 2228a37..7293129 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -932,8 +932,16 @@ sc_prohibit_doubled_word:
# A regular expression matching undesirable combinations of words like
# "can not"; this matches them even when the two words appear on different
# lines, but not when there is an intervening delimiter like "#" or "*".
+# Similarly undesirable, "See @xref{...}", since an @xref should start
+# a sentence. Explicitly prohibit any prefix that is a combination of
+# "see" and "also". Also prohibit a prefix matching "\w+ +".
+# @pxref gets the same see/also treatment and should be parenthesized;
+# presume it must *not* start a sentence.
+see_also_re_ = (?:see(?:\s+also)?|also(?:\s+see)?)
+bad_xref_re_ ?= (?:[\w,:;] +|$(see_also_re_)\s+)address@hidden
+bad_pxref_re_ ?= (?:[.!?]|$(see_also_re_))address@hidden
prohibit_undesirable_word_seq_RE_ ?= \
- /\bcan\s+not\b/gims
+ /(?:\bcan\s+not\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims
prohibit_undesirable_word_seq_ = \
-e 'while ($(prohibit_undesirable_word_seq_RE_))' \
$(perl_filename_lineno_text_)
--
1.7.10.169.g146fe
- [PATCH] maint.mk: catch "see @xref{}", Akim Demaille, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Akim Demaille, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Eric Blake, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}",
Jim Meyering <=
- Re: [PATCH] maint.mk: catch "see @xref{}", Akim Demaille, 2012/04/17
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/17
- Re: [PATCH] maint.mk: catch "see @xref{}", Karl Berry, 2012/04/16