From a6a1c6a3ea5c6c3cb3939fc3ea027ffdf1bba17f Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 19 Mar 2025 12:45:35 +0800 Subject: [PATCH] Remove the runtime module as it's unnecessary for Go --- htmpl/README | 7 ------- htmpl/htmpl.ha | 39 --------------------------------------- diff --git a/htmpl/README b/htmpl/README deleted file mode 100644 index fbd13ece06a8bc8e46baf5efe8b012d22b9e4dee..0000000000000000000000000000000000000000 --- a/htmpl/README +++ /dev/null @@ -1,7 +0,0 @@ -The htmpl module provides runtime functions for the HTML template engine. - -Functions herein are expected to be used by code generated by the same version -of htmplgen. - -Many functions take an [[io::handle]], which represents the destination where -templates shall be rendered to. diff --git a/htmpl/htmpl.ha b/htmpl/htmpl.ha deleted file mode 100644 index 5a965702b4cd223a49181503c7bee96b49de3f19..0000000000000000000000000000000000000000 --- a/htmpl/htmpl.ha +++ /dev/null @@ -1,39 +0,0 @@ -use io; -use memio; -use strings; - -// Writes a string to the destination. -export fn write(h: io::handle, s: str) (size | io::error) = { - return io::write(h, strings::toutf8(s))?; -}; - -// Writes a string to the destination after HTML-escaping it. -export fn write_escape_html(h: io::handle, s: str) (size | io::error | nomem) = { - let buf = memio::dynamic(); - defer io::close(&buf)!; // TODO: Might not want to abort for syscall interruptions - - let si = strings::iter(s); - for (true) { - match (strings::next(&si)) { - case done => - break; - case let c: rune => - switch (c) { - case '<' => - memio::concat(&buf, "<")?; - case '>' => - memio::concat(&buf, ">")?; - case '&' => - memio::concat(&buf, "&")?; - case '"' => - memio::concat(&buf, """)?; - case '\'' => - memio::concat(&buf, "'")?; - case => - memio::appendrune(&buf, c)?; - }; - }; - }; - - return io::write(h, memio::buffer(&buf))?; -}; -- 2.48.1