use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class HtmlParserTest method assertParseEventOrder.
private void assertParseEventOrder(String content, Object... expectedEventTypes) {
final List<Object> actualEventTypes = new ArrayList<>();
DocumentBuilder builder = new NoOpDocumentBuilder() {
@Override
public void beginBlock(BlockType type, Attributes attributes) {
actualEventTypes.add(type);
}
@Override
public void beginSpan(SpanType type, Attributes attributes) {
actualEventTypes.add(type);
}
@Override
public void characters(String text) {
actualEventTypes.add(text);
}
@Override
public void endBlock() {
actualEventTypes.add(END_BLOCK);
}
@Override
public void endSpan() {
actualEventTypes.add(END_SPAN);
}
};
parse(content, builder);
assertEquals(ImmutableList.copyOf(expectedEventTypes), actualEventTypes);
}
use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class HtmlDocumentBuilder2Test method testDefaultTargetForInternalLinks.
public void testDefaultTargetForInternalLinks() throws Exception {
builder.setDefaultAbsoluteLinkTarget("_external");
builder.beginDocument();
builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
builder.link("foo", "test");
builder.endBlock();
builder.endDocument();
String html = out.toString();
assertTrue(html.contains("<a href=\"foo\">test</a>"));
}
use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class HtmlDocumentBuilder2Test method testSuppressBuiltInlineStyles.
public void testSuppressBuiltInlineStyles() throws Exception {
StringWriter out = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(out);
builder.setSuppressBuiltInStyles(true);
builder.beginDocument();
builder.beginBlock(BlockType.NOTE, new Attributes());
builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
builder.characters("foo");
builder.endBlock();
builder.endBlock();
builder.endDocument();
String html = out.toString();
assertTrue(html.contains("<body><div class=\"note\"><p>foo</p></div></body>"));
assertTrue(!html.contains("<style type=\"text/css\">"));
}
use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class HtmlDocumentBuilder2Test method testSuppressInlineStyles.
public void testSuppressInlineStyles() throws Exception {
StringWriter out = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(out);
builder.setUseInlineStyles(false);
builder.beginDocument();
builder.beginBlock(BlockType.NOTE, new Attributes());
builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
builder.characters("foo");
builder.endBlock();
builder.endBlock();
builder.endDocument();
String html = out.toString();
assertTrue(html.contains("<body><div class=\"note\"><p>foo</p></div></body>"));
assertTrue(html.contains("<style type=\"text/css\">"));
}
use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class HtmlDocumentBuilder2Test method testDefaultTargetForExternalLinks.
public void testDefaultTargetForExternalLinks() throws Exception {
builder.setDefaultAbsoluteLinkTarget("_external");
builder.beginDocument();
builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
builder.link("http://www.example.com", "test");
builder.endBlock();
builder.endDocument();
String html = out.toString();
assertTrue(html.contains("<a href=\"http://www.example.com\" target=\"_external\">test</a>"));
}
Aggregations