public void appendInternalImageLink(String hrefImageLink, String srcImageLink, ImageFormat imageFormat) {
int pxWidth = imageFormat.getWidth();
int pxHeight = imageFormat.getHeight();
String caption = imageFormat.getCaption();
TagNode divTagNode = new TagNode("div");
divTagNode.addAttribute("id", "image", false);
// String link = imageFormat.getLink();
// if (link != null) {
// String href = encodeTitleToUrl(link, true);
// divTagNode.addAttribute("href", href, false);
// } else {
if (hrefImageLink.length() != 0) {
divTagNode.addAttribute("href", hrefImageLink, false);
}
// }
divTagNode.addAttribute("src", srcImageLink, false);
divTagNode.addObjectAttribute("wikiobject", imageFormat);
if (pxHeight != -1) {
if (pxWidth != -1) {
divTagNode.addAttribute("style", "height:" + pxHeight + "px; " + "width:" + pxWidth + "px", false);
} else {
divTagNode.addAttribute("style", "height:" + pxHeight + "px", false);
}
} else {
if (pxWidth != -1) {
divTagNode.addAttribute("style", "width:" + pxWidth + "px", false);
}
}
pushNode(divTagNode);
String imageType = imageFormat.getType();
// 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(altAttribute);
}
pushNode(captionTagNode);
// WikipediaParser.parseRecursive(caption, this);
popNode();