@Override public void link(Attributes attributes, String hrefOrHashName, String text) { writer.writeStartElement(htmlNsUri, spanTypeToElementName.get(SpanType.LINK)); emitAnchorHref(hrefOrHashName); applyLinkAttributes(attributes, hrefOrHashName); characters(text); writer.writeEndElement(); }
@Override public void beginSpan(SpanType type, Attributes attributes) { String elementName = spanTypeToElementName.get(type); if (elementName == null) { throw new IllegalStateException(type.name()); } writer.writeStartElement(htmlNsUri, elementName); if (type == SpanType.LINK && attributes instanceof LinkAttributes) { String href = ((LinkAttributes) attributes).getHref(); emitAnchorHref(href); applyLinkAttributes(attributes, href); } else { applyAttributes(attributes); } }
@Override public void imageLink(Attributes linkAttributes, Attributes imageAttributes, String href, String imageUrl) { writer.writeStartElement(htmlNsUri, "a"); //$NON-NLS-1$ emitAnchorHref(href); applyLinkAttributes(linkAttributes, href); writer.writeEmptyElement(htmlNsUri, "img"); //$NON-NLS-1$ applyImageAttributes(imageAttributes); imageUrl = prependImageUrl(imageUrl); writer.writeAttribute("src", makeUrlAbsolute(imageUrl)); //$NON-NLS-1$ writer.writeEndElement(); // a }