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@xxxxxxxxx> --- 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