|
@@ -268,14 +268,15 @@ END;
|
|
|
if (str_ends_with($file,".bib"))
|
|
if (str_ends_with($file,".bib"))
|
|
|
{
|
|
{
|
|
|
$bib = file_get_and_backup($file);
|
|
$bib = file_get_and_backup($file);
|
|
|
|
|
+ $bib = str_replace('\`','\\\'',$bib);
|
|
|
$bib = preg_replace("/(^\s*@\s*[a-z]+\s*\{\s*)((?!$d)\S)/i",'${1}'.$d.':${2}',$bib);
|
|
$bib = preg_replace("/(^\s*@\s*[a-z]+\s*\{\s*)((?!$d)\S)/i",'${1}'.$d.':${2}',$bib);
|
|
|
$bib = preg_replace("/(\n\s*@\s*[a-z]+\s*\{\s*)((?!$d)\S)/i",'${1}'.$d.':${2}',$bib);
|
|
$bib = preg_replace("/(\n\s*@\s*[a-z]+\s*\{\s*)((?!$d)\S)/i",'${1}'.$d.':${2}',$bib);
|
|
|
$bib = preg_replace("/([\{\"].*)[^\\\\]#(.*)/i",'${1}\#${2}',$bib);
|
|
$bib = preg_replace("/([\{\"].*)[^\\\\]#(.*)/i",'${1}\#${2}',$bib);
|
|
|
- $bib = str_replace('{\i}','{i}',$bib);
|
|
|
|
|
|
|
+ $bib = str_replace('\i}','i}',$bib);
|
|
|
$bib = str_replace('$\textregistered$','\textregistered',$bib);
|
|
$bib = str_replace('$\textregistered$','\textregistered',$bib);
|
|
|
$bib = str_replace('{$\textquoteright$}','\'',$bib);
|
|
$bib = str_replace('{$\textquoteright$}','\'',$bib);
|
|
|
file_put_contents($file,$bib);
|
|
file_put_contents($file,$bib);
|
|
|
- $bibresources[$d] = $file;
|
|
|
|
|
|
|
+ $bibresources[$d][] = $file;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -527,7 +528,6 @@ END;
|
|
|
$tikzlibs[] = $v;
|
|
$tikzlibs[] = $v;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
$tex = preg_replace("/\\\\documentclass{iacrtrans}/i","\declarecommand{\inst}[1]{\\textsuperscript{#1}}",$tex);
|
|
$tex = preg_replace("/\\\\documentclass{iacrtrans}/i","\declarecommand{\inst}[1]{\\textsuperscript{#1}}",$tex);
|
|
|
$tex = preg_replace("/\\\\documentclass.*\\n/i","
|
|
$tex = preg_replace("/\\\\documentclass.*\\n/i","
|
|
|
",$tex);
|
|
",$tex);
|
|
@@ -546,45 +546,6 @@ END;
|
|
|
$tex = preg_replace("/\\\\begin{document}/i",$header,$tex);
|
|
$tex = preg_replace("/\\\\begin{document}/i",$header,$tex);
|
|
|
$header = "";
|
|
$header = "";
|
|
|
}
|
|
}
|
|
|
- $tex = preg_replace("/\\\\begin{acks}/i","\section*{Acknowledgements}",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\end{acks}/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\(re)?newcommand/i",'\declarecommand',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\DeclareRobustCommand\s*(?<R>{((?:[^{}]+|(?&R))*)})\s*(?<Q>{((?:[^{}]+|(?&Q))*)})/i",'',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\(re)?newenvironment/i",'\declareenvironment',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\(Re)?NewDocumentEnvironment/i",'\DeclareDocumentEnvironment',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\end{abstract}/i",'',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\onecolumn/i",'',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\(begin|end){(IEEEkeywords|CCSXML)}/i",'\$1{comment}',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\pagenumbering\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\special\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\DeclareMathOperator/i",'%$0',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\DeclareMathAlphabet/i",'%$0',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\usepackage\s*(\[[^\[\]]*\])?\s*{minted}/i",'\usepackage{minted}',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\thispagestyle{empty}/i",'%$0',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\PassOptionsToPackage\s*(?<R>{((?:[^{}]+|(?&R))*)})(?<Q>{((?:[^{}]+|(?&Q))*)})/i",'',$tex);
|
|
|
|
|
- $tex = preg_replace("/(\\\\csvautobooktabular\s*([^{}]*)\s*)(?<R>{((?:[^{}]+|(?&R))*)})/i","\\1{{$d}/\\4}",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\AtBeginDocument\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",'',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\bibliographystyle\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",'%$0',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\usetikzlibrary\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",'%$0',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\DeclareFloatFont\s*(?<R>{((?:[^{}]+|(?&R))*)})(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\captionsetup\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])?(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\RequirePackage\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])?(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\ccsdesc\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])?(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\tikzexternalize\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\floatsetup\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\newfloat\s*(?<R>{((?:[^{}]+|(?&R))*)})(?<Q>{((?:[^{}]+|(?&Q))*)})(?<P>{((?:[^{}]+|(?&P))*)})/i","",$tex);
|
|
|
|
|
- global $sloppy_begin;
|
|
|
|
|
- global $sloppy_end;
|
|
|
|
|
- $tex = preg_replace("/\s*\\\\bibliography\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","\n".$sloppy_begin.'
|
|
|
|
|
-\printbibliography[title={References}, heading=subbibliography]
|
|
|
|
|
-'.$sloppy_end,$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\end{document}/i",'',$tex);
|
|
|
|
|
- $tex = preg_replace("/\n\s*\\\\author\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\tag\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\n\s*\\\\authorrunning\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\n\s*\\\\institute\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\n\s*\\\\title\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\n\s*\\\\date\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
$graphicspath = "";
|
|
$graphicspath = "";
|
|
|
preg_match("/\\\\graphicspath\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex,$matches);
|
|
preg_match("/\\\\graphicspath\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex,$matches);
|
|
|
if (count($matches) > 3)
|
|
if (count($matches) > 3)
|
|
@@ -592,27 +553,72 @@ END;
|
|
|
if (count($matches) > 3)
|
|
if (count($matches) > 3)
|
|
|
$graphicspath = $matches[2];
|
|
$graphicspath = $matches[2];
|
|
|
$tex = preg_replace("/\\\\includegraphics\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])(?<Q>{((?:[^{}]+|(?&Q))*)})/i",'\includegraphics${1}{'.$d."/".$graphicspath.'${4}}',$tex);
|
|
$tex = preg_replace("/\\\\includegraphics\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])(?<Q>{((?:[^{}]+|(?&Q))*)})/i",'\includegraphics${1}{'.$d."/".$graphicspath.'${4}}',$tex);
|
|
|
- $tex = preg_replace("/\\\\IEEEoverridecommandlockouts/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\IEEEauthorblock[AN]/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\IEEEauthorrefmark/i","\\textsuperscript",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\twocolumn/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\copyrightyear\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\setcopyright\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\settopmatter\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\acmYear\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\email\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
|
|
+ global $sloppy_begin;
|
|
|
|
|
+ global $sloppy_end;
|
|
|
|
|
+ $tex = preg_replace("/\s*\\\\bibliography\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","\n".$sloppy_begin.'
|
|
|
|
|
+\printbibliography[title={References}, heading=subbibliography]
|
|
|
|
|
+'.$sloppy_end,$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\begin{thebibliography}/i","\n".$sloppy_begin.'
|
|
|
|
|
+\printbibliography[title={References}, heading=subbibliography]
|
|
|
|
|
+'.$sloppy_end."\n$0",$tex);
|
|
|
|
|
+
|
|
|
|
|
+ $tex = preg_replace("/(\\\\begin|end){(IEEEkeywords|CCSXML|thebibliography)}/i",'$1{comment}',$tex);
|
|
|
|
|
+ $tex = preg_replace("/(\\\\csvautobooktabular\s*([^{}]*)\s*)(?<R>{((?:[^{}]+|(?&R))*)})/i","\\1{{$d}/\\4}",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\(re)?newcommand/i",'\declarecommand',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\(Re)?NewDocumentEnvironment/i",'\DeclareDocumentEnvironment',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\(re)?newenvironment/i",'\declareenvironment',$tex);
|
|
|
$tex = preg_replace("/\\\\acmBooktitle\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
$tex = preg_replace("/\\\\acmBooktitle\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
- $tex = preg_replace("/\\\\acmPrice\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
|
|
+ $tex = preg_replace("/\\\\acmConference\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])?\s*(?<Q>{((?:[^{}]+|(?&Q))*)})\s*(?<X>{((?:[^{}]+|(?&X))*)})\s*(?<Y>{((?:[^{}]+|(?&Y))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\\\\acmDOI\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
$tex = preg_replace("/\\\\acmDOI\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\\\\acmISBN\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
$tex = preg_replace("/\\\\acmISBN\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
- $tex = preg_replace("/\\\\fancyhead\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
|
|
+ $tex = preg_replace("/\\\\acmPrice\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\acmYear\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\\\\affiliation\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
$tex = preg_replace("/\\\\affiliation\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
- $tex = preg_replace("/\\\\acmConference\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])?\s*(?<Q>{((?:[^{}]+|(?&Q))*)})\s*(?<X>{((?:[^{}]+|(?&X))*)})\s*(?<Y>{((?:[^{}]+|(?&Y))*)})/i","",$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\SetWatermarkText\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
|
|
+ $tex = preg_replace("/\\\\AtBeginDocument\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",'',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\begin{acks}/i","\section*{Acknowledgements}",$tex);
|
|
|
|
|
+ $tex = preg_replace("/(\\\\bibitem\s*)(?<R>{((?:[^{}]+|(?&R))*)})/i",'$1{'.$d.':$3}',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\bibliographystyle\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",'%$0',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\captionsetup\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])?(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\ccsdesc\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])?(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\copyrightyear\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\DeclareFloatFont\s*(?<R>{((?:[^{}]+|(?&R))*)})(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\DeclareMathAlphabet/i",'%$0',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\DeclareMathOperator/i",'%$0',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\DeclareRobustCommand\s*(?<R>{((?:[^{}]+|(?&R))*)})\s*(?<Q>{((?:[^{}]+|(?&Q))*)})/i",'',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\email\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\end{abstract}/i",'',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\end{acks}/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\end{document}/i",'',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\fancyhead\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\floatsetup\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\IEEEauthorblock[AN]/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\IEEEauthorrefmark/i","\\textsuperscript",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\IEEEoverridecommandlockouts/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\newfloat\s*(?<R>{((?:[^{}]+|(?&R))*)})(?<Q>{((?:[^{}]+|(?&Q))*)})(?<P>{((?:[^{}]+|(?&P))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\onecolumn/i",'',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\pagenumbering\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\PassOptionsToPackage\s*(?<R>{((?:[^{}]+|(?&R))*)})(?<Q>{((?:[^{}]+|(?&Q))*)})/i",'',$tex);
|
|
|
$tex = preg_replace("/\\\\ProvidesPackage\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
$tex = preg_replace("/\\\\ProvidesPackage\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
- $tex = preg_replace("/\\\\SetWatermarkScale\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
|
|
+ $tex = preg_replace("/\\\\RequirePackage\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])?(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\setcopyright\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\settopmatter\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\\\\SetWatermarkLightness\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
$tex = preg_replace("/\\\\SetWatermarkLightness\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\SetWatermarkScale\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\SetWatermarkText\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\special\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\tag\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\thispagestyle{empty}/i",'%$0',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\tikzexternalize\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\twocolumn/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\usepackage\s*(\[[^\[\]]*\])?\s*{minted}/i",'\usepackage{minted}',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\usetikzlibrary\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",'%$0',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\n\s*\\\\author\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\n\s*\\\\authorrunning\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\n\s*\\\\date\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\n\s*\\\\institute\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\n\s*\\\\tikzexternalize/i","",$tex);
|
|
$tex = preg_replace("/\n\s*\\\\tikzexternalize/i","",$tex);
|
|
|
|
|
+ $tex = preg_replace("/\n\s*\\\\title\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
+
|
|
|
[$ups,$ps] = getusepackages($tex);
|
|
[$ups,$ps] = getusepackages($tex);
|
|
|
global $ignore_packages;
|
|
global $ignore_packages;
|
|
|
global $included_usepackages;
|
|
global $included_usepackages;
|