writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(htmlOutputFile)),"utf-8");
} catch (Exception e) {
throw new BuildException(String.format("Cannot write to file '%s': %s",htmlOutputFile,e.getMessage()),e);
}
try {
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer) {
@Override
protected XmlStreamWriter createXmlStreamWriter(Writer out) {
return super.createFormattingXmlStreamWriter(out);
}
};
builder.setUseInlineStyles(useInlineCssStyles);
builder.setSuppressBuiltInStyles(suppressBuiltInCssStyles);
for (Stylesheet stylesheet: stylesheets) {
if (stylesheet.url != null) {
builder.addCssStylesheet(stylesheet.url);
} else {
builder.addCssStylesheet(stylesheet.file);
}
}
builder.setTitle(title==null?name:title);
MarkupParser parser = new MarkupParser();
parser.setDialect(new TextileDialect());
parser.setBuilder(builder);
builder.setEmitDtd(true);
parser.parse(textile);
} finally {
try {
writer.close();