use of org.eclipse.mylyn.wikitext.parser.LinkAttributes in project mylyn.docs by eclipse.
the class HtmlDocumentBuilder2Test method testHtmlBeginSpanWithId.
public void testHtmlBeginSpanWithId() {
// Bug 492302
LinkAttributes attributes = new LinkAttributes();
attributes.setId("lorem");
builder.beginSpan(SpanType.LINK, attributes);
builder.endSpan();
assertContainsPattern("<a id=\"lorem\"></a>");
}
use of org.eclipse.mylyn.wikitext.parser.LinkAttributes in project mylyn.docs by eclipse.
the class TextileDocumentBuilder method computeSpan.
@Override
protected Block computeSpan(SpanType type, Attributes attributes) {
String appendStyle = null;
switch(type) {
case UNDERLINED:
// $NON-NLS-1$
appendStyle = "text-decoration:underline;";
break;
case MONOSPACE:
// $NON-NLS-1$
appendStyle = "font-family:monospace;";
break;
}
if (appendStyle != null) {
attributes = new Attributes(attributes.getId(), attributes.getCssClass(), attributes.getCssStyle(), attributes.getLanguage());
attributes.appendCssStyle(appendStyle);
}
Block block;
String spanAttributes = computeAttributes(attributes);
switch(type) {
case BOLD:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("**" + spanAttributes, "**", true, false, 0, 0);
break;
case CITATION:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("??" + spanAttributes, "??", true, false, 0, 0);
break;
case DELETED:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("-" + spanAttributes, "-", true, false, 0, 0);
break;
case MARK:
case EMPHASIS:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("_" + spanAttributes, "_", true, false, 0, 0);
break;
case INSERTED:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("+" + spanAttributes, "+", true, false, 0, 0);
break;
case CODE:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("@" + spanAttributes, "@", true, false, 0, 0);
break;
case ITALIC:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("__" + spanAttributes, "__", true, false, 0, 0);
break;
case LINK:
if (attributes instanceof LinkAttributes) {
block = new LinkBlock((LinkAttributes) attributes);
} else {
block = new SpanBlock(spanAttributes, true, false);
}
break;
case MONOSPACE:
block = new SpanBlock(spanAttributes, true, false);
break;
case STRONG:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("*" + spanAttributes, "*", true, false, 0, 0);
break;
case SUPERSCRIPT:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("^" + spanAttributes, "^", true, false, 0, 0);
break;
case SUBSCRIPT:
// $NON-NLS-1$//$NON-NLS-2$
block = new ContentBlock("~" + spanAttributes, "~", true, false, 0, 0);
break;
// case QUOTE: not supported by Textile
case UNDERLINED:
case SPAN:
default:
if (spanAttributes.length() == 0) {
// $NON-NLS-1$
block = new SpanBlock("", true, false);
} else {
block = new SpanBlock(spanAttributes, true, false);
}
break;
}
return block;
}
use of org.eclipse.mylyn.wikitext.parser.LinkAttributes in project mylyn.docs by eclipse.
the class MultiplexingDocumentBuilderTest method imageLink.
@Test
public void imageLink() {
multiplexer.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 MultiplexingDocumentBuilderTest method link.
@Test
public void link() {
multiplexer.link(new LinkAttributes(), "https://example.com", "test");
assertEvents(new LinkEvent(new LinkAttributes(), "https://example.com", "test"));
}
use of org.eclipse.mylyn.wikitext.parser.LinkAttributes in project mylyn.docs by eclipse.
the class TextileDocumentBuilderTest method testLinkWithNullHref.
public void testLinkWithNullHref() {
builder.beginDocument();
builder.characters("a ");
builder.link(new LinkAttributes(), null, "link text");
builder.characters(" test");
builder.endDocument();
String markup = out.toString();
assertEquals("a \"link text\": test\n\n", markup);
}
Aggregations