* {@inheritDoc}
*/
public void appendInternalImageLink(String hrefImageLink, String srcImageLink, ImageFormat imageFormat) {
String caption = imageFormat.getCaption();
String imageType = imageFormat.getType();
TagNode divInnerTagNode = new TagNode("div");
divInnerTagNode.addAttribute("id", "image", false);
if (hrefImageLink.length() != 0) {
divInnerTagNode.addAttribute("href", hrefImageLink, false);
}
divInnerTagNode.addAttribute("src", srcImageLink, false);
setDefaultThumbWidth(imageFormat);
divInnerTagNode.addObjectAttribute("wikiobject", imageFormat);
pushNode(divInnerTagNode);
try {
// TODO: test all these cases
if (caption != null && caption.length() > 0
&& ("frame".equals(imageType) || "thumb".equals(imageType) || "thumbnail".equals(imageType))) {
TagNode captionTagNode = new TagNode("div");
String clazzValue = "caption";
String type = imageFormat.getType();
if (type != null) {
clazzValue = type + clazzValue;
}
captionTagNode.addAttribute("class", clazzValue, false);
//
TagStack localStack = WikipediaParser.parseRecursive(caption, this, true, true);
captionTagNode.addChildren(localStack.getNodeList());
String altAttribute = imageFormat.getAlt();
if (altAttribute == null) {
altAttribute = captionTagNode.getBodyString();
imageFormat.setAlt(Encoder.encodeHtml(altAttribute));// see issue #25
}
pushNode(captionTagNode);
popNode();
}