Package info.bliki.htmlcleaner

Examples of info.bliki.htmlcleaner.TagNode


  }

  @Override
  public void renderHTML(ITextConverter converter, Appendable buf, IWikiModel model) throws IOException {

    TagNode node = this;
    Map<String, String> tagAttributes = node.getAttributes();

    String exprValue = (String) tagAttributes.get("expr");
    if (exprValue == null) {
      buf.append("<a href=\"javascript:yacasEval(\'NIL\');\">NIL</a>");
      return;
View Full Code Here


  /**
   * {@inheritDoc}
   */
  public TagNode appendToCAnchor(String anchor) {
    TagNode aTagNode = new TagNode("a");
    aTagNode.addAttribute("name", anchor, true);
    aTagNode.addAttribute("id", anchor, true);
    return aTagNode;
  }
View Full Code Here

  @Override
  public void appendExternalLink(String uriSchemeName, String link, String linkName, boolean withoutSquareBrackets) {
    if (uriSchemeName.equals("tel")) {
      // example for a telephone link
      link = Utils.escapeXml(link, true, false, false);
      TagNode aTagNode = new TagNode("a");
      aTagNode.addAttribute("href", link, true);
      aTagNode.addAttribute("class", "telephonelink", true);
      aTagNode.addAttribute("title", link, true);
      if (withoutSquareBrackets) {
        append(aTagNode);
        aTagNode.addChild(new ContentToken(linkName));
      } else {
        String trimmedText = linkName.trim();
        if (trimmedText.length() > 0) {
          pushNode(aTagNode);
          WikipediaParser.parseRecursive(trimmedText, this, false, true);
View Full Code Here

  }

  @Override
  public void renderHTML(ITextConverter converter, Appendable buf, IWikiModel model) throws IOException {

    TagNode node = this;
    Map<String, String> tagAtttributes = node.getAttributes();

    StringBuilder evalUrl = new StringBuilder(512);
    // eval input fields/textareas
    Utils.appendAmpersandEscapedAttribute(evalUrl, "ci", tagAtttributes);
    // eval actions
View Full Code Here

  @Override
  public void appendExternalLink(String uriSchemeName, String link, String linkName, boolean withoutSquareBrackets) {
    if (uriSchemeName.equalsIgnoreCase("tel")) {
      // example for a telephone link
      link = Utils.escapeXml(link, true, false, false);
      TagNode aTagNode = new TagNode("a");
      aTagNode.addAttribute("href", link, true);
      aTagNode.addAttribute("class", "telephonelink", true);
      aTagNode.addAttribute("title", link, true);
      if (withoutSquareBrackets) {
        append(aTagNode);
        aTagNode.addChild(new ContentToken(linkName));
      } else {
        String trimmedText = linkName.trim();
        if (trimmedText.length() > 0) {
          pushNode(aTagNode);
          WikipediaParser.parseRecursive(trimmedText, this, false, true);
View Full Code Here

                    TagToken tag = fWikiModel.getTokenMap().get(tagName);
                    if (tag != null) {
                      tag = (TagToken) tag.clone();

                      if (tag instanceof TagNode) {
                        TagNode node = (TagNode) tag;
                        List<NodeAttribute> attributes = tagNode.getAttributesEx();
                        Attribute attr;
                        for (int i = 1; i < attributes.size(); i++) {
                          attr = attributes.get(i);
                          node.addAttribute(attr.getName(), attr.getValue(), true);
                        }
                      }
                      if (tag instanceof HTMLTag) {
                        ((HTMLTag) tag).setTemplate(isTemplate());
                      }
View Full Code Here

        if (tag instanceof IBodyTag) {
          fWikiModel.popNode();
        }
      }
    } catch (IllegalArgumentException e) {
      TagNode divTagNode = new TagNode("div");
      divTagNode.addAttribute("class", "error", true);
      divTagNode.addChild(new ContentToken("IllegalArgumentException: " + command + " - " + e.getMessage()));
      fWikiModel.append(divTagNode);
      e.printStackTrace();
    } catch (Throwable e) {
      e.printStackTrace();
      TagNode divTagNode = new TagNode("div");
      divTagNode.addAttribute("class", "error", true);
      divTagNode.addChild(new ContentToken(command + ": " + e.getMessage()));
      fWikiModel.append(divTagNode);
      e.printStackTrace();
    }
  }
View Full Code Here

                    TagToken tag = fWikiModel.getTokenMap().get(tagName);
                    if (tag != null) {
                      tag = (TagToken) tag.clone();

                      if (tag instanceof TagNode) {
                        TagNode node = (TagNode) tag;
                        List<NodeAttribute> attributes = tagNode.getAttributesEx();
                        Attribute attr;
                        String temp;
                        for (int i = 1; i < attributes.size(); i++) {
                          attr = attributes.get(i);
                          temp = attr.getValue();
                          if (temp != null) {
                            temp = parseNowiki(temp);
                          }
                          node.addAttribute(attr.getName(), temp, true);
                        }
                      }
                      if (tag instanceof HTMLTag) {
                        ((HTMLTag) tag).setTemplate(isTemplate());
                      }
View Full Code Here

        if (tag instanceof IBodyTag) {
          fWikiModel.popNode();
        }
      }
    } catch (IllegalArgumentException e) {
      TagNode divTagNode = new TagNode("div");
      divTagNode.addAttribute("class", "error", true);
      divTagNode.addChild(new ContentToken("IllegalArgumentException: " + command + " - " + e.getMessage()));
      fWikiModel.append(divTagNode);
      e.printStackTrace();
    } catch (Throwable e) {
      e.printStackTrace();
      TagNode divTagNode = new TagNode("div");
      divTagNode.addAttribute("class", "error", true);
      divTagNode.addChild(new ContentToken(command + ": " + e.getMessage()));
      fWikiModel.append(divTagNode);
      e.printStackTrace();
    }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void appendExternalImageLink(String imageSrc, String imageAltText) {
    TagNode spanTagNode = new TagNode("span");
    append(spanTagNode);
    spanTagNode.addAttribute("class", "image", true);
    TagNode imgTagNode = new TagNode("img");
    spanTagNode.addChild(imgTagNode);
    imgTagNode.addAttribute("src", imageSrc, true);
    imgTagNode.addAttribute("alt", imageAltText, true);
    // "nofollow" keyword is not allowed for XHTML
    // imgTagNode.addAttribute("rel", "nofollow", true);
  }
View Full Code Here

TOP

Related Classes of info.bliki.htmlcleaner.TagNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.