use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class MarkdownDocumentBuilderTest method testImageLinkWithLinkAttributes.
public void testImageLinkWithLinkAttributes() {
builder.beginDocument();
LinkAttributes linkAttr = new LinkAttributes();
linkAttr.setTitle("Optional link title");
ImageAttributes imageAttr = new ImageAttributes();
imageAttr.setAlt("Alt text");
imageAttr.setTitle("Optional image title");
builder.imageLink(linkAttr, imageAttr, "http://example.net/", "/path/to/img.jpg");
builder.endDocument();
assertMarkup("[![Alt text](/path/to/img.jpg \"Optional image title\")](http://example.net/ \"Optional link title\")\n\n");
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class MarkdownDocumentBuilderTest method testImageLinkWithImageAttributes.
public void testImageLinkWithImageAttributes() {
builder.beginDocument();
ImageAttributes attr = new ImageAttributes();
attr.setAlt("Alt text");
attr.setTitle("Optional title");
builder.imageLink(attr, "http://example.net/", "/path/to/img.jpg");
builder.endDocument();
assertMarkup("[![Alt text](/path/to/img.jpg \"Optional title\")](http://example.net/)\n\n");
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class MarkdownDocumentBuilderTest method testImageWithTitle.
public void testImageWithTitle() {
builder.beginDocument();
ImageAttributes attr = new ImageAttributes();
attr.setAlt("Alt text");
attr.setTitle("Optional title");
builder.image(attr, "/path/to/img.jpg");
builder.endDocument();
assertMarkup("![Alt text](/path/to/img.jpg \"Optional title\")\n\n");
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class MarkdownDocumentBuilderTest method testImage.
public void testImage() {
builder.beginDocument();
builder.image(new ImageAttributes(), "/path/to/img.jpg");
builder.endDocument();
assertMarkup("![](/path/to/img.jpg)\n\n");
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class SimplifiedHtmlDocumentBuilder method image.
@Override
public void image(Attributes attributes, String url) {
// $NON-NLS-1$
writer.writeEmptyElement(getHtmlNsUri(), "img");
// $NON-NLS-1$
writer.writeAttribute("src", makeUrlAbsolute(url));
if (attributes instanceof ImageAttributes) {
ImageAttributes imageAttributes = (ImageAttributes) attributes;
writer.writeAttribute(getHtmlNsUri(), "alt", Objects.firstNonNull(imageAttributes.getAlt(), ""));
if (imageAttributes.getTitle() != null) {
writer.writeAttribute(getHtmlNsUri(), "title", imageAttributes.getTitle());
}
}
}
Aggregations