use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class HtmlLanguageTest method assertProcessContent.
protected void assertProcessContent(String expectedHtml, String sourceHtml, boolean asDocument, boolean parseCleansHtml) {
Writer out = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(out);
HtmlLanguage language = new HtmlLanguage();
language.setParseCleansHtml(parseCleansHtml);
MarkupParser markupParser = new MarkupParser(language, builder);
markupParser.parse(sourceHtml, asDocument);
assertEquals(expectedHtml, out.toString());
}
use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class ConfluenceLanguageIntegrationTest method parseToEvents.
private DocumentBuilderEvents parseToEvents(String markup) {
EventDocumentBuilder eventBuilder = new EventDocumentBuilder();
MarkupParser parser = new MarkupParser(new ConfluenceLanguage(), eventBuilder);
parser.parse(markup);
DocumentBuilderEvents events = eventBuilder.getDocumentBuilderEvents();
return events;
}
use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class ConfluenceLanguageIntegrationTest method assertHtmlToConfluence.
private void assertHtmlToConfluence(boolean parseAsDocument) {
HtmlLanguage htmlLanguage = HtmlLanguage.builder().add(BlockType.PARAGRAPH).add(SpanType.BOLD).name("Test").create();
MarkupParser parser = new MarkupParser(htmlLanguage);
Writer confluenceOut = new StringWriter();
DocumentBuilder confuenceBuilder = new ConfluenceLanguage().createDocumentBuilder(confluenceOut);
parser.setBuilder(confuenceBuilder);
parser.parse("<html><body>some text <b>bold here</b> more text</body></html>", parseAsDocument);
assertEquals("some text *bold here* more text\n\n", confluenceOut.toString());
}
use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class ConfluenceLanguageIntegrationTest method assertHtmlToConfluenceColor.
private void assertHtmlToConfluenceColor(String color, String hex) {
HtmlLanguage htmlLanguage = HtmlLanguage.builder().add(BlockType.PARAGRAPH).add(SpanType.SPAN).name("Test").create();
MarkupParser parser = new MarkupParser(htmlLanguage);
Writer confluenceOut = new StringWriter();
DocumentBuilder confuenceBuilder = new ConfluenceLanguage().createDocumentBuilder(confluenceOut);
parser.setBuilder(confuenceBuilder);
parser.parse("<html><body><span style=\"color: " + color + "\"><del>this text here</del></span></body></html>", true);
assertEquals("{color:" + hex + "}-this text here-{color}\n\n", confluenceOut.toString());
}
use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class CommonMarkAsserts method parseToHtml.
private static String parseToHtml(MarkupLanguage markupLanguage, String input) {
StringWriter out = new StringWriter();
DocumentBuilder builder = createDocumentBuilder(out);
MarkupParser parser = new MarkupParser(markupLanguage, builder);
try {
parser.parse(new StringReader(input));
} catch (IOException e) {
throw Throwables.propagate(e);
}
return out.toString();
}
Aggregations