GEX thesis source code, full text, references
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gex-thesis/undash.php

25 lines
522 B

7 years ago
<?php
7 years ago
array_shift($argv);
7 years ago
7 years ago
if (count($argv)==0) die("no file\n");
foreach($argv as $value) {
if(!file_exists($value)) die("no file ".$value."\n");
7 years ago
}
7 years ago
foreach($argv as $value) {
echo "Cleaning $value\n";
$content = file_get_contents($value);
$pat = '/(\\\\(?:label|cref|Cref|ref))\\{([^}]+)\\}/';
$fixed = preg_replace_callback($pat, function($match) {
return $match[1] . '{' . trim(str_replace('-', '_', $match[2])) . '}';
}, $content);
file_put_contents($value, $fixed);
7 years ago
}
echo "OK.\n";