#!/usr/bin/env php for newlines $content = str_replace("\u{5}", "", $content); // Remove cursor position $content = preg_replace('/\$(FG|BG),(\d+)\$(.+?)\$FG\$/s', '$3', $content); // Foreground / background color $content = preg_replace('/\$LK,"([^"]+?)",A="(FI:)?::(.+?)"\$/s', '$1', $content); // File links $content = preg_replace('/\$LK,"([^"]+?)",A="FF:::(.+?),(.+?)"\$/s', '$1', $content); // File links with search $content = preg_replace('/\$LK,"([^"]+?)",A="(MN|HI):(.+?)"\$/s', '$1', $content); // Unimplemented links $content = preg_replace('/\$LK,"(FI:)?::(.+?)"\$/s', '$2', $content); // File links without title $content = preg_replace('/\$ID,(\d+)\$(.+?)\$ID,-\1\$/s', '
$2
', $content); // Indentation $content = preg_replace('/\$\$/', '$', $content); // Escaping dollar signs $content = preg_replace('/\$TX\+CX,"(.+?)"\$/s', '
$1
', $content); // Centered text $content = preg_replace('/\$TX\+RX,"(.+?)"\$/s', '
$1
', $content); // Right-justified text $content = preg_replace('/\$UL,1\$(.+?)\$UL,0\$/s', '$1', $content); // Underlined text $content = preg_replace('/\$IV,1\$(.+?)\$IV,0\$/s', '$1', $content); // Inverted text $content = preg_replace('/\$BK,1\$(.+?)\$BK,0\$/s', '$1', $content); // Blinking text $content = preg_replace('/\$SY,(-?\d+)\$(.+?)\$SY,0\$/s', '$2', $content); // Shift-y $content = preg_replace('/\$WW.+?\$/', "", $content); // Word wrap $content = << $filename $content HTML; $newfile = str_replace("temple-src/", "/public/src/", $file) . ".HTML"; if (!is_dir(__DIR__ . dirname($newfile))) mkdir(__DIR__ . dirname($newfile), 0755, true); file_put_contents(__DIR__ . $newfile, $content); }