Example #1
0
 @Override
 public void renderHTML(ITextConverter converter, Appendable buf, IWikiModel wikiModel)
     throws IOException {
   if (NEW_LINES) {
     buf.append("\n<blockquote");
   } else {
     buf.append("<blockquote");
   }
   HTMLTag.appendEscapedAttributes(buf, fAttributes);
   buf.append(">");
   String rawWikiText = Utils.ltrimNewline(contents);
   AbstractParser parser = wikiModel.createNewInstance(rawWikiText);
   TagStack fStack = parser.parseRecursiveInternal(wikiModel, true, false);
   converter.nodesToText(fStack.getNodeList(), buf, wikiModel);
   buf.append("</blockquote>");
 }
Example #2
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
  }