diff options
| -rw-r--r-- | main.ha | 22 |
1 files changed, 2 insertions, 20 deletions
@@ -23,11 +23,10 @@ type subtitle = struct { text: []text, }; -type text = (str | setbold | setitalic | setunderline | setcolor); +type text = (str | setbold | setitalic | setunderline); type setbold = bool; type setitalic = bool; type setunderline = bool; -type setcolor = str; export fn main() void = { let help: []getopt::help = [ @@ -278,8 +277,6 @@ fn parse_text(in: io::handle) ([]text | io::error | xml::error) = { let bold = false; let italic = false; let underline = false; - let colorstack: []str = []; - defer strings::freeall(colorstack); for (true) { let tok = match (xml::scan(parser)?) { case let tok: xml::token => @@ -306,8 +303,6 @@ fn parse_text(in: io::handle) ([]text | io::error | xml::error) = { append(text, true: setunderline); underline = true; }; - case "font" => - append(text, "": setcolor); case => void; }; case let end: xml::elementend => @@ -327,18 +322,9 @@ fn parse_text(in: io::handle) ([]text | io::error | xml::error) = { append(text, false: setunderline); underline = false; }; - case "font" => - if (len(colorstack) > 0) { - append(text, colorstack[len(colorstack) - 1]: setcolor); - delete(colorstack[len(colorstack) - 1]); - }; case => void; }; - case let attr: xml::attribute => - if (attr.0 == "color" && text[len(text) - 1] is setcolor) { - text[len(text) - 1] = strings::dup(attr.1): setcolor; - append(colorstack, strings::dup(attr.1)); - }; + case xml::attribute => void; case let t: xml::text => // Necessary because of raw mode append(text, strings::replace(t, "\n", "\r\n")); @@ -358,10 +344,6 @@ fn print_subtitle(out: io::handle, text: []text) (void | io::error) = { yield if (italic) "\x1b[3m" else "\x1b[23m"; case let underline: setunderline => yield if (underline) "\x1b[4m" else "\x1b[24m"; - case let color: setcolor => - // TODO: implement this - // fmt::fprintf(out, "\x1b[38;2;{};{};{}m", r, g, b)?; - continue; }; io::writeall(out, strings::toutf8(output))?; }; |
