Esempio n. 1
0
  public void parseInternalImageLink(String imageNamespace, String name) {
    // see JAMHTMLConverter#imageNodeToText() for the real HTML conversion
    // routine!!!
    ImageFormat imageFormat = ImageFormat.getImageFormat(name, imageNamespace);

    int pxWidth = imageFormat.getWidth();
    String caption = imageFormat.getCaption();
    TagNode divTagNode = new TagNode("div");
    divTagNode.addAttribute("id", "image", false);
    // divTagNode.addAttribute("href", hrefImageLink, false);
    // divTagNode.addAttribute("src", srcImageLink, false);
    divTagNode.addObjectAttribute("wikiobject", imageFormat);
    if (pxWidth != -1) {
      divTagNode.addAttribute("style", "width:" + pxWidth + "px", false);
    }
    pushNode(divTagNode);

    if (caption != null && caption.length() > 0) {

      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 = captionTagNode.getBodyString();
      imageFormat.setAlt(altAttribute);
      pushNode(captionTagNode);
      // WikipediaParser.parseRecursive(caption, this);
      popNode();
    }

    popNode(); // div
  }