use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class ConfluenceDocumentBuilder method writeImageAttributes.
private void writeImageAttributes(Attributes attributes) throws IOException {
if (attributes instanceof ImageAttributes) {
ImageAttributes imageAttributes = (ImageAttributes) attributes;
String attributeMarkup = "";
if (!Strings.isNullOrEmpty(imageAttributes.getAlt())) {
attributeMarkup = "alt=\"" + imageAttributes.getAlt() + "\"";
}
if (!Strings.isNullOrEmpty(imageAttributes.getTitle())) {
if (!attributeMarkup.isEmpty()) {
attributeMarkup += ",";
}
attributeMarkup += "title=\"" + imageAttributes.getTitle() + "\"";
}
if (!attributeMarkup.isEmpty()) {
currentBlock.write('|');
currentBlock.write(attributeMarkup);
}
}
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class Image method emit.
@Override
public void emit(DocumentBuilder builder) {
ImageAttributes attributes = new ImageAttributes();
attributes.setTitle(title);
List<Inline> contents = getContents();
if (!contents.isEmpty()) {
attributes.setAlt(InlineParser.toStringContent(contents));
}
builder.image(attributes, src);
}
use of org.eclipse.mylyn.wikitext.parser.ImageAttributes in project mylyn.docs by eclipse.
the class MultiplexingDocumentBuilderTest method image.
@Test
public void image() {
multiplexer.image(new ImageAttributes(), "http://example.com/foo.png");
assertEvents(new ImageEvent(new ImageAttributes(), "http://example.com/foo.png"));
}
Aggregations