use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class AsciiDocDocumentBuilderTest method testImageNoUrl.
@Test
public void testImageNoUrl() {
builder.beginDocument();
ImageAttributes attr = new ImageAttributes();
attr.setAlt("Alt text");
attr.setTitle("Optional title");
builder.image(attr, null);
builder.endDocument();
assertMarkup("image:[Alt text, title=\"Optional title\"]\n\n");
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class TextileDocumentBuilderTest method testImageNoUrl.
public void testImageNoUrl() {
builder.beginDocument();
builder.characters("a ");
builder.image(new ImageAttributes(), null);
builder.characters(" test");
builder.endDocument();
String markup = out.toString();
assertEquals("a test\n\n", markup);
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class TextileDocumentBuilderTest method testImageLink.
public void testImageLink() {
builder.beginDocument();
builder.characters("a ");
builder.imageLink(new LinkAttributes(), new ImageAttributes(), "#foo", "fooImage.png");
builder.characters(" test");
builder.endDocument();
String markup = out.toString();
assertEquals("a !fooImage.png!:#foo test\n\n", markup);
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class TextileDocumentBuilderTest method testImage.
public void testImage() {
builder.beginDocument();
builder.characters("a ");
builder.image(new ImageAttributes(), "fooImage.png");
builder.characters(" test");
builder.endDocument();
String markup = out.toString();
assertEquals("a !fooImage.png! test\n\n", markup);
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class MarkdownDocumentBuilder method computeImage.
private String computeImage(Attributes attributes, String url) {
// ![](/path/to/img.jpg) or
// ![alt text](path/to/img.jpg "title")
// $NON-NLS-1$
String altText = "";
// $NON-NLS-1$
String title = "";
if (attributes instanceof ImageAttributes) {
ImageAttributes imageAttr = (ImageAttributes) attributes;
altText = Strings.nullToEmpty(imageAttr.getAlt());
}
if (!Strings.isNullOrEmpty(attributes.getTitle())) {
// $NON-NLS-1$
title = " \"" + attributes.getTitle() + '"';
}
// $NON-NLS-1$ //$NON-NLS-2$
return "![" + altText + "](" + Strings.nullToEmpty(url) + title + ')';
}
Aggregations