Package info.bliki.wiki.tags

Examples of info.bliki.wiki.tags.WPATag


  public String encodeTitleToUrl(String wikiTitle, boolean firstCharacterAsUpperCase) {
    return Encoder.encodeTitleToUrl(wikiTitle, firstCharacterAsUpperCase);
  }

  public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass, boolean parseRecursive) {
    WPATag aTagNode = new WPATag();
    // append(aTagNode);
    aTagNode.addAttribute("id", "w", true);
    String href = encodeTitleToUrl(topic, true);
    if (hashSection != null) {
      href = href + '#' + encodeTitleToUrl(hashSection, true);
    }
    aTagNode.addAttribute("href", href, true);
    if (cssClass != null) {
      aTagNode.addAttribute("class", cssClass, true);
    }
    aTagNode.addObjectAttribute("wikilink", topic);

    pushNode(aTagNode);
    if (parseRecursive) {
      WikipediaParser.parseRecursive(topicDescription.trim(), this, false, true);
    } else {
      aTagNode.addChild(new ContentToken(topicDescription));
    }
    popNode();

    // ContentToken text = new ContentToken(topicDescription);
    // aTagNode.addChild(text);
View Full Code Here


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

    WPATag aTagNode = new WPATag();
    // append(aTagNode);
    aTagNode.addAttribute("id", "w", true);
    String href = topic;
    if (hashSection != null) {
      href = href + '#' + hashSection;
    }
    aTagNode.addAttribute("href", href, true);
    if (cssClass != null) {
      aTagNode.addAttribute("class", cssClass, true);
    }
    aTagNode.addObjectAttribute("wikilink", topic);
    pushNode(aTagNode);
    WikipediaParser.parseRecursive(topicDescription.trim(), this, false, true);
    popNode();
    // ContentToken text = new ContentToken(topicDescription);
    // aTagNode.addChild(text);
View Full Code Here

    popNode(); // div

  }

  public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass, boolean parseRecursive) {
    WPATag aTagNode = new WPATag();
    append(aTagNode);
    aTagNode.addAttribute("id", "w", true);
    String href = topic;
    if (hashSection != null) {
      href = href + '#' + hashSection;
    }
    aTagNode.addAttribute("href", href, true);
    aTagNode.addObjectAttribute("wikilink", topic);

    ContentToken text = new ContentToken(topicDescription);
    aTagNode.addChild(text);
  }
View Full Code Here

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

    WPATag aTagNode = new WPATag();
    // append(aTagNode);
    aTagNode.addAttribute("id", "w", true);
    String href = topic;
    if (hashSection != null) {
      href = href + '#' + hashSection;
    }
    aTagNode.addAttribute("href", href, true);
    if (cssClass != null) {
      aTagNode.addAttribute("class", cssClass, true);
    }
    aTagNode.addObjectAttribute("wikilink", topic);
    pushNode(aTagNode);
    WikipediaParser.parseRecursive(topicDescription.trim(), this, false, true);
    popNode();
    // ContentToken text = new ContentToken(topicDescription);
    // aTagNode.addChild(text);
View Full Code Here

      e.printStackTrace();
    }
  }

  public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass, boolean parseRecursive) {
    WPATag aTagNode = new WPATag();
    // append(aTagNode);
    aTagNode.addAttribute("id", "w", true);
    String titleURL = Encoder.encodeTitleLocalUrl(topic);
    String href = titleURL + ".html";
    if (hashSection != null) {
      href = href + '#' + hashSection;
    }
    aTagNode.addAttribute("href", href, true);
    if (cssClass != null) {
      aTagNode.addAttribute("class", cssClass, true);
    }
    aTagNode.addObjectAttribute("wikilink", topic);
    pushNode(aTagNode);
    WikipediaParser.parseRecursive(topicDescription.trim(), this, false, true);
    popNode();
    // ContentToken text = new ContentToken(topicDescription);
    // aTagNode.addChild(text);
View Full Code Here

        return null;
    }

    @Override
    public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass, boolean isParseRecursive) {
        WPATag tagNode = new WPATag();
        tagNode.addAttribute("id", "w", true);
        String href = topic;
        if(hashSection != null) {
            href = href + '#' + hashSection;
        }
        tagNode.addAttribute("href", href, true);
        if(cssClass != null) {
            tagNode.addAttribute("class", cssClass, true);
        }
        tagNode.addObjectAttribute("wikilink", topic);

        pushNode(tagNode);
        WikipediaParser.parseRecursive(topicDescription.trim(), this, false, true);
        popNode();
    }
View Full Code Here

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

    WPATag aTagNode = new WPATag();
    // append(aTagNode);
    aTagNode.addAttribute("id", "w", true);
    String href = topic;
    if (hashSection != null) {
      href = href + '#' + hashSection;
    }
    aTagNode.addAttribute("href", href, true);
    if (cssClass != null) {
      aTagNode.addAttribute("class", cssClass, true);
    }
    aTagNode.addObjectAttribute("wikilink", topic);
    pushNode(aTagNode);
    WikipediaParser.parseRecursive(topicDescription.trim(), this, false, true);
    popNode();
    // ContentToken text = new ContentToken(topicDescription);
    // aTagNode.addChild(text);
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass, boolean parseRecursive) {
    WPATag aTagNode = new WPATag();
    String href = encodeTitleToUrl(topic, true);
    if (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(topicDescription.trim(), this, false, true);
    } else {
      aTagNode.addChild(new ContentToken(topicDescription));
    }
    popNode();
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass, boolean parseRecursive) {
    WPATag aTagNode = new WPATag();
    String href = encodeTitleToUrl(topic, true);
    if (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) {
      WikipediaParser.parseRecursive(topicDescription.trim(), this, false, true);
    } else {
      aTagNode.addChild(new ContentToken(topicDescription));
    }
    popNode();
  }
View Full Code Here

  protected void appendInternalLink(String topic, String hashSection, String topicDescription,
      String cssClass, boolean parseRecursive, boolean topicExists) {
    String hrefLink;
    String description = topicDescription.trim();
    WPATag aTagNode = new WPATag();
    if (topic.length() > 0) {
      String title = Encoder.normaliseTitle(topic, true, ' ', true);
      if (hashSection == null) {
        String pageName = Encoder.normaliseTitle(fPageTitle, true, ' ', true);
        // 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.wiki.tags.WPATag

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.