Helper class for rewriting structured text.
abstract class text rewriter
extends text visitor[text fragment]
protected override text fragment process string(string s)
return s
protected override text fragment process element(text element element)
var children : element • children
if children is_not null
children = rewrite(children)
return rewrite element(element • get id, element • attributes, children)
protected override text fragment process special(special text t)
return t
protected override text fragment process nodes(list text node nodes)
for (source : nodes • nodes)
result • append(process(source))
return text utilities • join(result)
protected override text fragment process attributes(list attribute fragment fragments)
for (source : fragments • fragments)
result • append(process(source) !> attribute fragment)
return base list attribute fragment • new(result)