@Override public void imageLink(Attributes linkAttributes, Attributes imageAttributes, String href, String imageUrl) { for (DocumentBuilder builder : builders) { builder.imageLink(linkAttributes, imageAttributes, href, imageUrl); } }
/** * Create a hyperlink whose visual representation is an image. Implementations must apply the attributes to the * image tag. For example, if the builder constructs HTML, the builder would emit * <code><a href="..."><img src="..."/></a></code>. In this case if the attributes define a css class then * the resulting HTML should look like this: <code><a href="..."><img src="..." class="..."/></a></code> * * @param attributes * the attributes of the image, which may be {@link ImageAttributes} * @param href * the url (which may be internal to the page if prefixed with a hash '#') * @param imageUrl * the url of the image, which may be relative * @see #imageLink(Attributes, Attributes, String, String) */ public final void imageLink(Attributes attributes, String href, String imageUrl) { imageLink(new LinkAttributes(), attributes, href, imageUrl); }
/** * @see #imageLink(Attributes, String, String) */ public final void imageLink(String href, String imageUrl) { imageLink(new LinkAttributes(), new ImageAttributes(), href, imageUrl); }
@Override public void emit() { String alignment = group(ALIGNMENT_GROUP); String imageUrl = group(CONTENT_GROUP); String altAndTitle = group(CONTENT_GROUP + 1); String href = group(CONTENT_GROUP + 3); String namedLinkUrl = href == null ? null : ((TextileContentState) getState()).getNamedLinkUrl(href); if (namedLinkUrl != null) { href = namedLinkUrl; } ImageAttributes attributes = new ImageAttributes(); attributes.setTitle(altAndTitle); attributes.setAlt(altAndTitle); if (alignment != null) { if ("<".equals(alignment)) { //$NON-NLS-1$ attributes.setAlign(Align.Left); } else if (">".equals(alignment)) { //$NON-NLS-1$ attributes.setAlign(Align.Right); } else if ("=".equals(alignment)) { //$NON-NLS-1$ attributes.setAlign(Align.Center); } } Textile.configureAttributes(this, attributes, ATTRIBUTES_OFFSET, false); if (href != null) { builder.imageLink(attributes, href, imageUrl); } else { builder.image(attributes, imageUrl); } } }
@Override public void emit() { String hyperlinkBoundaryText = group(1); String hyperlinkSrc = group(2 + Textile.ATTRIBUTES_GROUP_COUNT); String href = group(3 + Textile.ATTRIBUTES_GROUP_COUNT); String namedLinkUrl = ((TextileContentState) getState()).getNamedLinkUrl(href); if (namedLinkUrl != null) { href = namedLinkUrl; } if (hyperlinkBoundaryText.equals("\"")) { //$NON-NLS-1$ LinkAttributes attributes = new LinkAttributes(); attributes.setHref(href); Textile.configureAttributes(this, attributes, ATTRIBUTES_OFFSET, false); builder.beginSpan(SpanType.LINK, attributes); getMarkupLanguage().emitMarkupLine(parser, state, start(2), hyperlinkSrc, 0); builder.endSpan(); } else { final ImageAttributes attributes = new ImageAttributes(); Textile.configureAttributes(this, attributes, ATTRIBUTES_OFFSET, false); builder.imageLink(attributes, href, hyperlinkSrc); } } }