From e78eda7e4ca0397f9afbf43c224cf60ef2332e68 Mon Sep 17 00:00:00 2001 From: Reimar Date: Sat, 16 Mar 2024 14:17:04 +0100 Subject: [PATCH] Make build script that parses and copies files --- .gitignore | 2 ++ build.php | 55 +++++++++++++++++++++++++++++++++++++++ public/index.html | 12 +++++++++ public/script/templeos.js | 6 +++++ public/style/templeos.css | 43 ++++++++++++++++++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 .gitignore create mode 100755 build.php create mode 100644 public/index.html create mode 100644 public/script/templeos.js create mode 100644 public/style/templeos.css diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ad175f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +public/src/ + diff --git a/build.php b/build.php new file mode 100755 index 0000000..401f44f --- /dev/null +++ b/build.php @@ -0,0 +1,55 @@ +#!/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); +} + diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..00cdcb6 --- /dev/null +++ b/public/index.html @@ -0,0 +1,12 @@ + + + + + TempleOS + + +

TempleOS

+

Documentation

+ + + diff --git a/public/script/templeos.js b/public/script/templeos.js new file mode 100644 index 0000000..cb0fcf7 --- /dev/null +++ b/public/script/templeos.js @@ -0,0 +1,6 @@ +// Blink elements +[].forEach.call(document.getElementsByClassName("blink"), function (elem) { + setInterval(function () { + elem.classList.toggle("invert"); + }, 200); +}); diff --git a/public/style/templeos.css b/public/style/templeos.css new file mode 100644 index 0000000..0aa6cd4 --- /dev/null +++ b/public/style/templeos.css @@ -0,0 +1,43 @@ +body { + font-family: monospace; + font-weight: bold; +} + +a { + color: #A00; +} + +.FG-0, .BG-0 .invert { color: #000; } +.FG-1, .BG-1 .invert { color: #00A; } +.FG-2, .BG-2 .invert { color: #0A0; } +.FG-3, .BG-3 .invert { color: #0AA; } +.FG-4, .BG-4 .invert { color: #A00; } +.FG-5, .BG-5 .invert { color: #A0A; } +.FG-6, .BG-6 .invert { color: #A50; } +.FG-7, .BG-7 .invert { color: #AAA; } +.FG-8, .BG-8 .invert { color: #555; } +.FG-9, .BG-9 .invert { color: #55F; } +.FG-10, .BG-10 .invert { color: #5F5; } +.FG-11, .BG-11 .invert { color: #5FF; } +.FG-12, .BG-12 .invert { color: #F55; } +.FG-13, .BG-13 .invert { color: #F5F; } +.FG-14, .BG-14 .invert { color: #FF5; } +.FG-15, .BG-15 .invert { color: #FFF; } + +.BG-0, .FG-0 .invert { background-color: #000; } +.BG-1, .FG-1 .invert { background-color: #00A; } +.BG-2, .FG-2 .invert { background-color: #0A0; } +.BG-3, .FG-3 .invert { background-color: #0AA; } +.BG-4, .FG-4 .invert { background-color: #A00; } +.BG-5, .FG-5 .invert { background-color: #A0A; } +.BG-6, .FG-6 .invert { background-color: #A50; } +.BG-7, .FG-7 .invert { background-color: #AAA; } +.BG-8, .FG-8 .invert { background-color: #555; } +.BG-9, .FG-9 .invert { background-color: #55F; } +.BG-10, .FG-10 .invert { background-color: #5F5; } +.BG-11, .FG-11 .invert { background-color: #5FF; } +.BG-12, .FG-12 .invert { background-color: #F55; } +.BG-13, .FG-13 .invert { background-color: #F5F; } +.BG-14, .FG-14 .invert { background-color: #FF5; } +.BG-15, .FG-15 .invert { background-color: #FFF; } +