Options options = compiler.getCompilationContext().getOptions();
PageInfo pageInfo = compiler.getPageInfo();
boolean trim =
options.getTrimSpaces() || pageInfo.isTrimDirectiveWhitespaces();
if (trim) {
TextCatVisitor v = new TextCatVisitor(true, trim);
page.visit(v);
v.collectText();
}
TextCatVisitor v = new TextCatVisitor(false, trim);
page.visit(v);
// Cleanup, in case the page ends with a template text
v.collectText();