summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/chktex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-04-13 23:32:21 +0000
committerKarl Berry <karl@freefriends.org>2017-04-13 23:32:21 +0000
commit3e87e2d7af73dd9fbf5a4210a2d80c5bc914b9a1 (patch)
tree4488310c78c9fab41ba2005dd772f4017a612287 /Master/texmf-dist/scripts/chktex
parent4c73f8d75d5299c18fbf46117ed2a70c44c09582 (diff)
chktex support file updates
git-svn-id: svn://tug.org/texlive/trunk@43786 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/chktex')
-rwxr-xr-xMaster/texmf-dist/scripts/chktex/deweb.pl159
1 files changed, 85 insertions, 74 deletions
diff --git a/Master/texmf-dist/scripts/chktex/deweb.pl b/Master/texmf-dist/scripts/chktex/deweb.pl
index 83de358bc2e..0e9c85f96ca 100755
--- a/Master/texmf-dist/scripts/chktex/deweb.pl
+++ b/Master/texmf-dist/scripts/chktex/deweb.pl
@@ -26,93 +26,104 @@
#
#
-print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n";
+print STDERR "DeWEB v1.3 - Copyright 1996 Jens T. Berger Thielemann\n";
undef $/;
-$texmode = 1;
-$_ = <>;
-
-while(/\@/)
-{
- &out($`);
- $_ = $';
-
- if(/^@/) {
- $_ = $';
- &out('@');
- next;
+my @FILES = @ARGV;
+FILE:
+while( my $file = shift @FILES ) {
+
+ my $success = open my $fh, '<', "$file";
+ if ( ! $success ) {
+ print STDERR "Couldn't open file '$file'\n";
+ next FILE;
}
- if(/^([\s\n])/) {
- $_ = $';
- print "\n" if $1 eq "\n";
- $texmode = 1;
- next;
- }
-
- if(/^[cpd]/i) {
- $_ = $';
- $texmode = 0;
- next;
- }
-
- if(/^\,/i) {
- $_ = $';
- print '\,';
- next;
- }
-
- if(m!^/!) {
- $_ = $';
- print '\\\\';
- next;
- }
-
- if(/^[h\&\|\;\#\+]/i || /^i.*/i) {
- $_ = $';
- next;
- }
-
- if(/^\*[0-9\*]?((.|\n)*?\.)/) {
- $_ = $';
- print $1;
- $texmode = 1;
- next;
- }
-
- if(/^[<(^.t!]((.|\n)*?)\@\>/i) {
- $_ = $';
- print '{'.$1.'}';
- $texmode = 0;
- next;
- }
-
- if(/^[=]((.|\n)*?)\@\>/) {
- $_ = $';
- print &printnl($1);
- next;
- }
+ $texmode = 1;
+ $_ = <$fh>;
+
+ while (/\@/) {
+ &out($`);
+ $_ = $';
+
+ if (/^@/) {
+ $_ = $';
+ &out('@');
+ next;
+ }
+
+ if (/^([\s\n])/) {
+ $_ = $';
+ print "\n" if $1 eq "\n";
+ $texmode = 1;
+ next;
+ }
+
+ if (/^[cpd]/i) {
+ $_ = $';
+ $texmode = 0;
+ next;
+ }
+
+ if (/^\,/i) {
+ $_ = $';
+ print '\,';
+ next;
+ }
+
+ if (m!^/!) {
+ $_ = $';
+ print '\\\\';
+ next;
+ }
+
+ if (/^[h\&\|\;\#\+]/i || /^i.*/i) {
+ $_ = $';
+ next;
+ }
+
+ if (/^\*[0-9\*]?((.|\n)*?\.)/) {
+ $_ = $';
+ print $1;
+ $texmode = 1;
+ next;
+ }
+
+ if (/^[<(^.t!]((.|\n)*?)\@\>/i) {
+ $_ = $';
+ print '{'.$1.'}';
+ $texmode = 0;
+ next;
+ }
+
+ if (/^[=]((.|\n)*?)\@\>/) {
+ $_ = $';
+ print &printnl($1);
+ next;
+ }
+
+ if (/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) {
+ $_ = $';
+ print &printnl($+);
+ next;
+ }
+
+ @line = split(/\n/, $_, 2);
+ print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n";
- if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) {
- $_ = $';
- print &printnl($+);
- next;
}
- @line = split(/\n/, $_, 2);
- print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n";
+ print $_;
}
-print $_;
-
sub printnl {
my($foo);
- if(defined $_[0]) {
- $foo = $_[0];
- $foo =~ s/.//g;
+ if (defined $_[0]) {
+ $foo = $_[0];
+ $foo =~ s/.//g;
} else {
- $foo = "";
+ $foo = "";
}
$foo;
}