Format text for output as markup.
class markup formatter
extends text formatter
import idealmachineelementsruntime util
static OPEN START TAG : "<"
static OPEN END TAG : "</"
static ATTRIBUTE SEPARATOR : " "
static ATTRIBUTE START : "='"
static ATTRIBUTE END : "'"
static CLOSE TAG : ">"
static CLOSE SELF CLOSING TAG : " />"
static DEFAULT INDENT : " "
private boolean write newlines
overload markup formatter(output[character] out, string spaces, boolean write newlines)
super(out, spaces)
this • write newlines = write newlines
overload markup formatter(output[character] out, string spaces)
this(out, spaces, true)
override void process element(text element element)
attributes : elementattributes
children : elementchildren
if children is null
write self closing tag(element, attributes)
if is block
else
if is block
if !first if indent > 0
write start tag(element, attributes)
else
write start tag(element, attributes)
process(children)
if is block else
write end tag(element)
private void do indent()
indent += 1
private void do unindent()
assert new indent is nonnegative
indent = new indent
private void write escaped(string s)
write string(runtime utilescape markup(s))