}
public String parse(String string, String options) {
boolean numbered = isNumbered(options);
List<Integer> highlights = new CodeHighlightTag().getHighlights(options);
string = indentator.indent(string);
JavaSourceConversionOptions conversionOptions = JavaSourceConversionOptions.getDefault();
conversionOptions.setShowLineNumbers(numbered);
JavaSourceConversionSettings settings = new JavaSourceConversionSettings(conversionOptions) {
@Override
public IJavaSourceConverter createConverter() {
return new JavaSource2Xhtml11Converter();
}
};
string = Java2Html.convertToHtml(string, settings);
/* Removing Java2Html comments (we added it on each Sections page) */
string = string.replaceAll("<!--(.+?)-->\n", "");
string = string.replaceFirst("<div class=\"java\"><code class=\"java\">","$0\n");
string = string.replaceAll(" ", " ");
string = new CodeHighlightTag().parseHtml(string.trim(), highlights, 2);
return string;
}