use of org.eclipse.mylyn.wikitext.parser.LinkAttributes in project mylyn.docs by eclipse.
the class DocBookDocumentBuilderTest method testSpanLink.
public void testSpanLink() {
builder.beginDocument();
builder.beginBlock(BlockType.DIV, new Attributes());
builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
LinkAttributes attributes = new LinkAttributes();
attributes.setHref("#test1234");
builder.beginSpan(SpanType.LINK, attributes);
builder.beginSpan(SpanType.EMPHASIS, new Attributes());
builder.characters("link text");
builder.endSpan();
builder.endSpan();
// PARAGRAPH
builder.endBlock();
// DIV
builder.endBlock();
builder.endDocument();
String docbook = out.toString();
String expectedContent = "<para><link linkend=\"test1234\"><emphasis>link text</emphasis></link></para>";
assertEquals(DOCBOOK_BEGIN_CHAPTER + expectedContent + DOCBOOK_END_CHAPTER, docbook);
}
use of org.eclipse.mylyn.wikitext.parser.LinkAttributes in project mylyn.docs by eclipse.
the class EventDocumentBuilderTest method imageLink.
@Test
public void imageLink() {
builder.imageLink(new LinkAttributes(), new ImageAttributes(), "https://example.com", "http://example.com/foo.png");
assertEvents(new ImageLinkEvent(new LinkAttributes(), new ImageAttributes(), "https://example.com", "http://example.com/foo.png"));
}
use of org.eclipse.mylyn.wikitext.parser.LinkAttributes in project mylyn.docs by eclipse.
the class DocBookDocumentBuilderTest method testExternalLink.
public void testExternalLink() {
builder.beginDocument();
builder.characters("an ");
builder.link(new LinkAttributes(), "http://example.com", "external link");
builder.characters(" test");
builder.endDocument();
String docbook = out.toString();
String expectedContent = "an <ulink url=\"http://example.com\">external link</ulink> test";
assertEquals(DOCBOOK_BEGIN + expectedContent + DOCBOOK_END, docbook);
}
use of org.eclipse.mylyn.wikitext.parser.LinkAttributes in project mylyn.docs by eclipse.
the class ImageLinkEventTest method equals.
@Test
public void equals() {
assertEquality(new ImageLinkEvent(new LinkAttributes(), new ImageAttributes(), "http://example.com", "http://example.com/img.png"), new ImageLinkEvent(new LinkAttributes(), new ImageAttributes(), "http://example.com", "http://example.com/img.png"));
assertInequality(new ImageLinkEvent(new LinkAttributes(), new ImageAttributes(), "http://example.com", "http://example.com/img.png"), new ImageLinkEvent(new LinkAttributes(), new ImageAttributes(), "http://example.com", "http://example.com/img2.png"));
assertInequality(new ImageLinkEvent(new LinkAttributes(), new ImageAttributes(), "http://example.com", "http://example.com/img.png"), new ImageLinkEvent(new LinkAttributes(), new ImageAttributes(), "http://example.com/2", "http://example.com/img.png"));
}
use of org.eclipse.mylyn.wikitext.parser.LinkAttributes in project mylyn.docs by eclipse.
the class ConfluenceDocumentBuilder method link.
@Override
public void link(Attributes attributes, String hrefOrHashName, String text) {
assertOpenBlock();
LinkAttributes linkAttributes = new LinkAttributes();
linkAttributes.setTitle(attributes.getTitle());
linkAttributes.setHref(hrefOrHashName);
beginSpan(SpanType.LINK, linkAttributes);
characters(text);
endSpan();
}
Aggregations