父节点
91aaecdb73
当前提交
04afe9b44a
二进制文件未显示。
@ -1,25 +1,24 @@ |
||||
<?php |
||||
|
||||
if (count($argv)==1) die("no file\n"); |
||||
array_shift($argv); |
||||
|
||||
foreach($argv as $i => $value) { |
||||
if ($i == 0) continue; |
||||
if(!file_exists($value)) die("no file ".$value."\n"); |
||||
if (count($argv)==0) die("no file\n"); |
||||
|
||||
foreach($argv as $value) { |
||||
if(!file_exists($value)) die("no file ".$value."\n"); |
||||
} |
||||
|
||||
|
||||
foreach($argv as $i => $value) { |
||||
if ($i == 0) continue; |
||||
|
||||
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); |
||||
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); |
||||
} |
||||
echo "OK.\n"; |
||||
|
正在加载...
在新工单中引用