use of org.eclipse.mylyn.wikitext.html.HtmlLanguage 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.html.HtmlLanguage in project mylyn.docs by eclipse.
the class HtmlLanguageTest method newDocumentBuilderIsFormatting.
@Test
public void newDocumentBuilderIsFormatting() {
Writer out = new StringWriter();
DocumentBuilder builder = new HtmlLanguage().createDocumentBuilder(out, true);
builder.beginDocument();
builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
builder.characters("test");
builder.endBlock();
builder.endDocument();
assertEquals(loadResourceContent("newDocumentBuilderIsFormatting.xml"), out.toString());
}
use of org.eclipse.mylyn.wikitext.html.HtmlLanguage in project mylyn.docs by eclipse.
the class HtmlLanguageTest method isDiscoverable.
@Test
public void isDiscoverable() {
MarkupLanguage language = ServiceLocator.getInstance().getMarkupLanguage("HTML");
assertNotNull(language);
assertTrue(language instanceof HtmlLanguage);
}
use of org.eclipse.mylyn.wikitext.html.HtmlLanguage in project mylyn.docs by eclipse.
the class HtmlSubsetLanguageTest method parseCleansHtmlSetOnClone.
@Test
public void parseCleansHtmlSetOnClone() {
HtmlLanguage htmlLanguage = newHtmlSubsetLanguage(BlockType.PARAGRAPH);
htmlLanguage.setParseCleansHtml(true);
assertEquals(htmlLanguage.isParseCleansHtml(), htmlLanguage.clone().isParseCleansHtml());
htmlLanguage.setParseCleansHtml(false);
assertEquals(htmlLanguage.isParseCleansHtml(), htmlLanguage.clone().isParseCleansHtml());
}
use of org.eclipse.mylyn.wikitext.html.HtmlLanguage in project mylyn.docs by eclipse.
the class HtmlLanguageTest method parseCleansHtml.
@Test
public void parseCleansHtml() {
HtmlLanguage htmlLanguage = new HtmlLanguage();
htmlLanguage.setParseCleansHtml(true);
assertTrue(htmlLanguage.isParseCleansHtml());
htmlLanguage.setParseCleansHtml(false);
assertFalse(htmlLanguage.isParseCleansHtml());
}
Aggregations