From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH -perfbook 3/3] cleverefcheck.pl: Add patterns to catch QQz positioning issues
Date: Thu, 10 Feb 2022 00:12:23 +0900 [thread overview]
Message-ID: <3754e966-dcae-bc66-1dfe-cc5dc4718bed@gmail.com> (raw)
In-Reply-To: <b9607a1e-7ab2-62fb-578e-d9dec3547905@gmail.com>
Add patterns in cleverefcheck.pl to catch:
- A plain QQz or grouped QQzs at the beginning of a section
- Consecutive QQzs not properly grouped
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
utilities/cleverefcheck.pl | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/utilities/cleverefcheck.pl b/utilities/cleverefcheck.pl
index 6e9a59e8..d92de5ac 100755
--- a/utilities/cleverefcheck.pl
+++ b/utilities/cleverefcheck.pl
@@ -28,12 +28,14 @@ my $acr_ptn = qr/(^|\s+)[aA]cr[^\s\{]*{/ ;
my $heading_ptn = qr/(\\chapter|\\section|\\subsection|\\subsubsection)/ ;
my $listing_ptn = qr/\\begin\{(listing|Verbatim)/ ;
my $qqa_ptn = qr/\\E?QuickQuizAnswer[BEM]?/ ;
+my $qqe_ptn = qr/\}\\QuickQuizEnd\s*(%.*)?$/ ;
my $epig_ptn = qr/\\[Ee]pigraph/ ;
my $in_footnote = 0 ;
my $footnote_save = 0;
my $after_heading = 0;
my $after_qqa = 0;
my $after_epig = 0;
+my $after_qqe = 0;
sub check_line {
my $raw_line = $line;
@@ -121,6 +123,10 @@ sub check_line {
$after_heading = 0 ;
$after_epig = 0 ; # after epigraph or not does not matter for listing
}
+ if ($line =~ /\\QuickQuiz\{/ || $line =~ /\\QuickQiuzSeries\{/) {
+ print $ARGV[0], ':', $line_num, ':', $raw_line, "^^^ Section opening QQz ^^^\n";
+ $after_heading = 0 ;
+ }
}
if ($after_qqa) {
if ($line =~ /^\s*$/) {
@@ -134,6 +140,15 @@ sub check_line {
$after_qqa = 0;
}
}
+ if ($after_qqe) {
+ if ($line =~ /\\QuickQuiz\{/) {
+ print $ARGV[0], ':', $line_num, ':', $raw_line, "^^^ Consecutive QQz ^^^\n";
+ $after_qqe = 0;
+ }
+ if ($line !~ /^\s*$/) { # non-empty line ends after qqe status
+ $after_qqe = 0;
+ }
+ }
if ($after_epig) {
if ($line =~ /^\s*$/) { # empty line ends epigraph
$after_epig -= 1 ;
@@ -182,6 +197,9 @@ sub check_line {
if ($line =~ /$qqa_ptn/) {
$after_qqa = 1 ;
}
+ if ($line =~ /$qqe_ptn/) {
+ $after_qqe = 1 ;
+ }
if ($line =~ /$epig_ptn/ && $ARGV[0] !~ /glossary\.tex/) { # exempt glossary.tex
$after_epig = 2 ;
}
--
2.17.1
next prev parent reply other threads:[~2022-02-09 15:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 15:06 [PATCH -perfbook 1/3] intro, together: Promote section-opening QQzs to 'essential' Akira Yokosawa
2022-02-09 15:08 ` [PATCH -perfbook 2/3] defer, together: Group consecutive QQzs Akira Yokosawa
2022-02-09 15:12 ` Akira Yokosawa [this message]
2022-02-09 15:17 ` [PATCH -perfbook 3/3] cleverefcheck.pl: Add patterns to catch QQz positioning issues Akira Yokosawa
2022-02-09 21:31 ` [PATCH -perfbook 1/3] intro, together: Promote section-opening QQzs to 'essential' Paul E. McKenney
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=3754e966-dcae-bc66-1dfe-cc5dc4718bed@gmail.com \
--to=akiyks@gmail.com \
--cc=paulmck@kernel.org \
--cc=perfbook@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.