This tool processes the code in Unu code blocks, generating HTML output. It assumes that CSS will be used to style the results. The default CSS is included at the end of this file and will be embedded into the generated HTML.
Some characters need to be escaped. The :put-html words will be used to handle these.
I include my unu file processor here as it makes it easy to process the relevant lines from the source file.
Formatting is pretty straightforward. I have a span word to generate the HTML for the token, and a format word to identify the token type and use span.
For Muri this is really easy as the character in the first column indicates how the line should be processed.
I have:
: create a label s inline a string (null terminated) r assemble a pointer to a label d convert to decimal and inline i assemble instruction bundle
Everything else gets treated as text.
Next is the HTML page generation. This has words to generate the header, embeds the CSS (from the end of this file), and then processes the lines in the source file to generate the body.
Output is written to stdout.
And finally, run it.
/ CSS Begins /
• {
background: #111;
color: white;
font-family: monospace;
}
.text { color: white; }
.name { color: red; } .string { color: yellow; } .pointer { color: orange; } .number { color: cyan; } .instr { color: greenyellow; }