use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class HtmlSubsetDocumentBuilderTest method before.
@Before
public void before() {
writer = new StringWriter();
delegate = new HtmlDocumentBuilder(writer);
delegate.setEmitAsDocument(false);
builder = new HtmlSubsetDocumentBuilder(delegate);
builder.setSupportedBlockTypes(Sets.newHashSet(BlockType.PARAGRAPH));
builder.setSupportedSpanTypes(Sets.newHashSet(SpanType.BOLD), Collections.<SpanHtmlElementStrategy>emptyList());
builder.setSupportedHeadingLevel(3);
builder.beginDocument();
}
use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class HtmlSubsetLanguageTest method cloneSupported.
@Test
public void cloneSupported() {
HtmlDocumentHandler documentHandler = new HtmlDocumentHandler() {
@Override
public void endDocument(HtmlDocumentBuilder builder, XmlStreamWriter writer) {
// ignore
}
@Override
public void beginDocument(HtmlDocumentBuilder builder, XmlStreamWriter writer) {
// ignore
}
};
HtmlSubsetLanguage language = new HtmlSubsetLanguage("Test", documentHandler, 6, Sets.newHashSet(BlockType.PARAGRAPH, BlockType.DIV, BlockType.QUOTE), Sets.newHashSet(SpanType.CITATION, SpanType.EMPHASIS), ImmutableMap.of(SpanType.EMPHASIS, "new-em"), Collections.<SpanHtmlElementStrategy>emptyList(), false, true);
HtmlSubsetLanguage cloned = language.clone();
assertEquals(language.getName(), cloned.getName());
assertEquals(language.getSupportedBlockTypes(), cloned.getSupportedBlockTypes());
assertEquals(language.getSupportedHeadingLevel(), cloned.getSupportedHeadingLevel());
assertEquals(language.getSupportedSpanTypes(), cloned.getSupportedSpanTypes());
assertEquals(language.getTagNameSubstitutions(), cloned.getTagNameSubstitutions());
}
use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class MarkdownLanguageTestBase method parseToHtml.
public String parseToHtml(String markup) {
StringWriter out = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(out);
builder.setEmitAsDocument(false);
parser.setBuilder(builder);
parser.parse(markup);
return out.toString();
}
use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class MarkdownRoundTripTest method parseMarkdownToHtml.
private String parseMarkdownToHtml(String markupContent) {
StringWriter htmlWriter = new StringWriter();
HtmlDocumentBuilder htmlDocumentBuilder = new HtmlDocumentBuilder(htmlWriter);
htmlDocumentBuilder.setEmitAsDocument(false);
MarkupParser markupParser = new MarkupParser(language, htmlDocumentBuilder);
markupParser.parse(markupContent);
return htmlWriter.toString();
}
use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class MarkupToEclipseHelpMojo method createRootBuilder.
protected HtmlDocumentBuilder createRootBuilder(Writer writer, String name, String relativePath) {
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer, formatOutput);
builder.setTitle(title == null ? name : title);
builder.setEmitDtd(emitDoctype);
if (emitDoctype && htmlDoctype != null) {
builder.setHtmlDtd(htmlDoctype);
}
builder.setUseInlineStyles(useInlineCssStyles);
builder.setSuppressBuiltInStyles(suppressBuiltInCssStyles);
builder.setLinkRel(linkRel);
builder.setDefaultAbsoluteLinkTarget(defaultAbsoluteLinkTarget);
builder.setPrependImagePrefix(prependImagePrefix);
builder.setXhtmlStrict(xhtmlStrict);
builder.setCopyrightNotice(copyrightNotice);
builder.setHtmlFilenameFormat(htmlFilenameFormat);
configureStylesheets(builder, relativePath);
return builder;
}
Aggregations