Don't use Dom::Tiny

This commit is contained in:
Nathan McCarty 2024-12-20 10:38:33 +00:00
parent a06df05580
commit 57ac48e167

View file

@ -2,7 +2,6 @@
use paths;
use File::Temp;
use DOM::Tiny;
use HTML::Lazy (:ALL);
my $build-path;
@ -21,18 +20,12 @@ body {
# Stylize katla output
sub stylize($katla-output) {
my $dom = DOM::Tiny.parse($katla-output);
# Insert our background css
$dom.find('style')[*-1][*-1].prepend($background-css);
# Undomify
my $output = $dom.Str;
# Apply regex edits to colorize existing elements
$output =
$output.match(/'color: darkgray'/).replace-with('color: #dedede')
.match(/'color: lightgrey'/).replace-with('color: #777777')
.match(/'color: yellow'/).replace-with('color: #3b3b3b')
.match(/'color: gray'/).replace-with('color: #777777');
$output
$katla-output.match(/'color: darkgray'/).replace-with('color: #dedede')
.match(/'color: lightgrey'/).replace-with('color: #777777')
.match(/'color: yellow'/).replace-with('color: #3b3b3b')
.match(/'color: gray'/).replace-with('color: #777777')
.match(/'<style>'/).replace-with("<style>\n$background-css")
}
# Renders the file at the given location to the temporary directory
@ -75,6 +68,7 @@ my method add-path(%index: $path, $value) {
# Render the index to html
my method render-index(%index:) {
# TODO sort these properly
my @elements = [];
for %index.keys -> $key {
say "";