Created
April 19, 2013 06:11
-
-
Save hyuki0000/5418450 to your computer and use it in GitHub Desktop.
Try to find ruby-ed keywords that are not indexed from LaTeX files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby.pl | |
# カレントディレクトリの *.tex から、 | |
# ruby{A}{B}とindex{A@B}とindex{A}を探し、 | |
# indexされていないと思われるrubyを表示する。 | |
use strict; | |
use warnings; | |
my %index; | |
my %ruby; | |
for my $filename (glob("*.tex")) { | |
open(FILE, $filename) or die; | |
while (<FILE>) { | |
if (/ruby{(.+?)}{(.+?)}/) { | |
$ruby{$1}++; | |
$ruby{$2}++; | |
} | |
if (/index{(.+?)\@(.+?)}/) { | |
$index{$1}++; | |
$index{$2}++; | |
} elsif (/index{(.+?)}/) { | |
$index{$1}++; | |
} | |
} | |
close(FILE); | |
} | |
for my $key (sort keys %ruby) { | |
if (not $index{$key}) { | |
print $key, "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment