Skip to content

Instantly share code, notes, and snippets.

@kinichiro
Created July 23, 2015 15:19
Show Gist options
  • Save kinichiro/ec1e7dea649c600e5dd5 to your computer and use it in GitHub Desktop.
Save kinichiro/ec1e7dea649c600e5dd5 to your computer and use it in GitHub Desktop.
find invalid lists
#!/usr/bin/perl
foreach $in ( @ARGV ) {
next if( $in !~ /.+.adoc/ ) ;
printf "\n:-| processing [$in] ...\n";
open(IN, "<$in") || die "cant open file\n";
$line = 0;
$flag = 0;
while( <IN> ) {
++ $line;
chop;
if($_ =~ /^\* .*/) {
$flag = 1;
} elsif ($_ eq "" || $_ eq "+") {
$flag = 0;
} elsif ($flag == 1 && $_ !~ /^ /) {
printf "%4d : [%s]\n", $line, $_;
$flag = 0;
} else {
$flag = 0;
}
}
close(IN)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment