[PATCH -perfbook 08/11] periodcheck: Improve regex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add patterns to catch end-of-sentence punctuation marks in front
of quotation marks and/or parentheses.

Also add patterns to treat lines ending with "\\" as exceptions.

Add autodate.tex to the exception list in periodcheck.sh.

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
---
 utilities/periodcheck.pl | 17 +++++++++++------
 utilities/periodcheck.sh |  1 +
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/utilities/periodcheck.pl b/utilities/periodcheck.pl
index f46052c5..9d1985d1 100755
--- a/utilities/periodcheck.pl
+++ b/utilities/periodcheck.pl
@@ -60,9 +60,9 @@ sub check_line {
     }
     unless ($skip) {
 	$safe = 1;
-	if ($line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\.\?\!\:][\)\}\']*$/ ||
-	    $line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\.\?\!\:]\\footnote/ ||
-	    $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?\{.+\}[\.\?\!\:][\)\}\']*$/ ) {
+	if ($line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:][\)\}\']*$/ ||
+	    $line =~ /^(?=[\s]*+[^%])[^%]*[A-Z][\)\']*[\.\?\!\:]\\footnote/ ||
+	    $line =~ /^(?=[\s]*+[^%])[^%]*[Aa]crm?\{.+\}[\)\']*[\.\?\!\:][\)\}\']*$/ ) {
 	    $safe = 0;
 	    if ($next_line =~ /^\s*$/ || $next_line =~ /^\s*%/ ||
 		$next_line =~ /\\item/ ||
@@ -72,9 +72,14 @@ sub check_line {
 		$safe = 1;
 	    }
 	}
-	if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z\}][\.\?\!][\)\}\']*\s[^\\]+/ ||
-	    $line =~ /^(?=[\s]*+[^%])[^%]*.*:[\)\}\']*\s[^\\]+/) {
+	if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+[^%]/ ||
+#	    $line =~ /^(?=[\s]*+[^%])[^%]*.*\.[\)\}\']*\s+[^%]/ ||  # Uncomment for full check
+	    $line =~ /^(?=[\s]*+[^%])[^%]*.*:[\)\}\']*\s+[^%]/ ) {
 	    $safe = 0;
+	    if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+\\\\/ ||
+		$line =~ /^(?=[\s]*+[^%])[^%]*.*[\.:][\)\}\']*\s+\\\\/ ) {
+		$safe = 1;
+	    }
 	}
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*[^~]\\cite/) {
 	    $safe = 0;
@@ -82,7 +87,7 @@ sub check_line {
 		$safe = 1;
 	    }
 	}
-	if ($line =~ /^(?=[\s]*+[^%])[^%]*\\\@[\.\?\!\:][\)\}\']*\s+[^\s%]+/){
+	if ($line =~ /^(?=[\s]*+[^%])[^%]*\\\@[\.\?\!\:][\)\}\']*\s+[^%]/){
 	    $safe = 0;
 	}
 	unless ($safe) {
diff --git a/utilities/periodcheck.sh b/utilities/periodcheck.sh
index d6cd7510..4fff091b 100755
--- a/utilities/periodcheck.sh
+++ b/utilities/periodcheck.sh
@@ -11,6 +11,7 @@ do
 	./glsdict.tex) ;;
 	./origpub.tex) ;;
 	./contrib.tex) ;;
+	./autodate.tex) ;;
 	./future/HTMtable*) ;;
 	./appendix/styleguide*) ;;
 	*) tex_sources="$tex_sources $f" ;;
-- 
2.17.1





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux