Package info.bliki.htmlcleaner

Examples of info.bliki.htmlcleaner.ContentToken


          }
        } else if (rawNamespaceTopic.charAt(colonIndex + 1) == '=') {
          // found an SMW attribute
          String attributeValue = rawNamespaceTopic.substring(colonIndex + 2);
          if (addSemanticAttribute(nameSpace, attributeValue)) {
            append(new ContentToken(attributeValue));
            return true;
          }
        }

      }
View Full Code Here


        fWikiModel.append(tag);
      } else {
        fWikiModel.pushNode(tag);
        if (null != bodyString) {
          if (tag instanceof INoBodyParsingTag) {
            ((TagNode) tag).addChild(new ContentToken(bodyString));
          } else {
            // recursively filter tags within the tags body string
            WikipediaPreTagParser.parseRecursive(bodyString.trim(), fWikiModel, false, true);
          }
        }
        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

      int level = wikiModel.incrementRecursionLevel();

      if (level > Configuration.PARSER_RECURSION_LIMIT) {
        TagNode error = new TagNode("span");
        error.addAttribute("class", "error", true);
        error.addChild(new ContentToken("Error - recursion limit exceeded parsing wiki tags."));
        localStack.append(error);
        return localStack;
      }
      // WikipediaParser parser = new WikipediaParser(rawWikitext,
      // wikiModel.isTemplateTopic(), wikiModel.getWikiListener());
      setModel(wikiModel);
      runParser();
      return localStack;
    } catch (InvalidPreWikiTag ipwt) {
      createOnlyLocalStack = true;
      throw ipwt;
    } catch (Exception e) {
      e.printStackTrace();
      TagNode error = new TagNode("span");
      error.addAttribute("class", "error", true);
      error.addChild(new ContentToken(e.getClass().getSimpleName()));
      localStack.append(error);
    } catch (Error e) {
      e.printStackTrace();
      TagNode error = new TagNode("span");
      error.addAttribute("class", "error", true);
      error.addChild(new ContentToken(e.getClass().getSimpleName()));
      localStack.append(error);
    } finally {
      wikiModel.decrementRecursionLevel();
      if (!createOnlyLocalStack) {
        // append the resursively parsed local stack to the global wiki
View Full Code Here

    pushNode(aTagNode);
    if (parseRecursive) {
      WikipediaParser.parseRecursive(description.trim(), this, false, true);
    } else {
      aTagNode.addChild(new ContentToken(description));
    }
    popNode();
  }
View Full Code Here

          Object item = childrenIt.next();
          if (item != null) {
            if (item instanceof List) {
              nodesToText((List) item, resultBuffer, model);
            } else if (item instanceof ContentToken) {
              ContentToken contentToken = (ContentToken) item;
              String content = contentToken.getContent();
              Utils.escapeXmlToBuffer(content, resultBuffer, true, true, true);
            } else if (item instanceof HTMLTag) {
              ((HTMLTag) item).renderHTML(this, resultBuffer, model);
            } else if (item instanceof TagNode) {
              TagNode node = (TagNode) item;
View Full Code Here

      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

      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

    // aTagNode.addAttribute("class", cssClass, true);
    // }
    // aTagNode.addObjectAttribute("wikilink", topic);

    // Show only descriptions no internal wiki links
    ContentToken text = new ContentToken(topicDescription);
    append(text);
    // aTagNode.addChild(text);
  }
View Full Code Here

    // aTagNode.addAttribute("class", cssClass, true);
    // }
    // aTagNode.addObjectAttribute("wikilink", topic);

    // Show only descriptions no internal wiki links
    ContentToken text = new ContentToken(topicDescription);
    append(text);
    // aTagNode.addChild(text);
  }
View Full Code Here

        // self link?
        if (title.equals(pageName)) {
          HTMLTag selfLink = new HTMLTag("strong");
          selfLink.addAttribute("class", "selflink", false);
          pushNode(selfLink);
          selfLink.addChild(new ContentToken(description));
          popNode();
          return;
        }
      }

      String encodedtopic = encodeTitleToUrl(topic, true);
      if (replaceColon()) {
        encodedtopic = encodedtopic.replace(':', '/');
      }
      hrefLink = getWikiBaseURL().replace("${title}", encodedtopic);
      if (!topicExists) {
        if (cssClass == null) {
          cssClass = "new";
        }
        if (hrefLink.indexOf('?') != -1) {
          hrefLink += "&";
        } else {
          hrefLink += "?";
        }
        hrefLink += "action=edit&redlink=1";
        String redlinkString = Messages.getString(getResourceBundle(),
            Messages.WIKI_TAGS_RED_LINK,
            "${title} (page does not exist)");
        title = redlinkString.replace("${title}", title);
      }
      aTagNode.addAttribute("title", title, true);
    } else {
      // assume, the own topic exists
      if (hashSection != null) {
        hrefLink = "";
        if (description.length() == 0) {
          description = "#" + hashSection; // #....
        }
      } else {
        hrefLink = getWikiBaseURL().replace("${title}", "");
      }
    }

    String href = hrefLink;
    if (topicExists && hashSection != null) {
      href = href + '#' + encodeTitleDotUrl(hashSection, false);
    }
    aTagNode.addAttribute("href", href, true);
    if (cssClass != null) {
      aTagNode.addAttribute("class", cssClass, true);
    }
    aTagNode.addObjectAttribute("wikilink", topic);

    pushNode(aTagNode);
    if (parseRecursive) {
      WikipediaPreTagParser
          .parseRecursive(description, this, false, true);
    } else {
      aTagNode.addChild(new ContentToken(description));
    }
    popNode();
  }
View Full Code Here

TOP

Related Classes of info.bliki.htmlcleaner.ContentToken

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.