From 4683cd72b90eecd7d0f8276fc622e272903a03d2 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Mon, 27 Jan 2025 04:36:19 -0500 Subject: [PATCH] Brutally butcher katla output to play nice with mdbook --- scripts/build-book | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/build-book b/scripts/build-book index 810608e..4b56c42 100755 --- a/scripts/build-book +++ b/scripts/build-book @@ -47,10 +47,22 @@ sub cp-temp($src) { # Invoke katla on a source file, streaming its output to the temporary directory sub katla($src, $ttc-src) { - # TODO: Post process them to set themeing correctly # Run katla and collect the output my $katla = run 'katla', 'markdown', $src, $ttc-src, :out; my $output = $katla.out.slurp(:close); + # TODO: Post process them to set themeing correctly + $output ~~ s:g/''//; + $output ~~ s:g/'
'//; + $output ~~ s:g/''/<\/code><\/pre>/; + $output ~~ s:g/'class="IdrisKeyword"'/class="hljs-keyword"/; + $output ~~ s:g/'class="IdrisModule"'/class="hljs-symbol hljs-emphasis"/; + $output ~~ s:g/'class="IdrisComment"'/class="hljs-comment"/; + $output ~~ s:g/'class="IdrisFunction"'/class="hljs-symbol"/; + $output ~~ s:g/'class="IdrisBound"'/class="hljs-name"/; + $output ~~ s:g/'class="IdrisData"'/class="hljs-title"/; + $output ~~ s:g/'class="IdrisType"'/class="hljs-type"/; + $output ~~ s:g/'class="IdrisNamespace"'/class="hljs-symbol hljs-emphasis"/; # Spurt the output to the temporary directory my $output-path = $tempdir.add: $src; if !$output-path.parent.d {