function formatTex() { $fileName = BASE_PATH . "wiki2tex/tex/content/data/macros_raw.tex"; $file_array = file($fileName, FILE_IGNORE_NEW_LINES); $fOutput = fopen("tex/content/data/macros.tex", "w+"); //var_dump($file_array); foreach ($file_array as $line) { if (startsWith("\\item \\wikiref", $line)) { $line = formatter::toTex($line); } else { $line = formatter::toTex($line); } fwrite($fOutput, $line . PHP_EOL); } fclose($fOutput); }
$tex = $cat->getDeepTex(); $fileName = $cat->getFileName() . ".tex"; $f = fopen($outputDeepFolder . $fileName, 'w+') or die("can't open file"); foreach (explode(PHP_EOL, $tex) as $line) { $line = formatter::toTex($line); fwrite($f, $line . PHP_EOL); } fclose($f); } echo PHP_EOL . "generating classification ontology"; foreach ($allCategories as $cat) { $tex = $cat->getClassifyTex(); $fileName = $cat->getFileName() . ".tex"; $f = fopen($outputClassificationFolder . $fileName, 'w+') or die("can't open file"); foreach (explode(PHP_EOL, $tex) as $line) { $line = formatter::toTex($line); fwrite($f, $line . PHP_EOL); } fclose($f); } } else { if ($args['mode'] == 'implContents') { $titles = explode(',', $args['titles']); $note = explode('%', $args['node']); $nTitle = $note[0]; $nNote = str_replace('L"a', 'L\\"a', str_replace('_', ' ', $note[1])); echo $nNode; $otherTitles = explode(',', $args['otitles']); $macroTex = ''; $implsTex = ''; $fMacro = fopen($implsFolder . 'macros.tex', 'w+');
function toTexMacro() { $tex = "\\newcommand{\\" . getTexCommandName($this->getTitle()) . "FeatureTitle}{" . $this->getTitle() . "}" . PHP_EOL; $tex .= "\\newcommand{\\" . getTexCommandName($this->getTitle()) . "FeatureIntent}{" . formatter::toTex($this->intent) . "}" . PHP_EOL; $tex .= "\\newcommand{\\" . getTexCommandName($this->getTitle()) . "FeatureDescription}{" . formatter::toTex($this->description) . "}" . PHP_EOL; $tex .= "\\newcommand{\\" . getTexCommandName($this->getTitle()) . "FeatureIllustration}{" . formatter::toTex($this->illustration) . "}" . PHP_EOL; return $tex; }