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