Package info.bliki.wiki.tags.util

Examples of info.bliki.wiki.tags.util.TagStack


  public int stackSize() {
    return fTagStack.size();
  }

  public TagStack swapStack(TagStack stack) {
    TagStack temp = fTagStack;
    fTagStack = stack;
    return temp;
  }
View Full Code Here


   * @param rawHead
   * @param headLevel
   */
  public ITableOfContent appendHead(String rawHead, int headLevel, boolean noToC, int headCounter, int startPosition,
      int endPosition) {
    TagStack localStack = WikipediaParser.parseRecursive(rawHead.trim(), this, true, true);

    WPTag headTagNode = new WPTag("h" + headLevel);
    headTagNode.addChildren(localStack.getNodeList());
    String tocHead = headTagNode.getBodyString();
    String anchor = Encoder.encodeDotUrl(tocHead);
    createTableOfContent(false);
    if (!noToC && (headCounter > 3)) {
      fTableOfContentTag.setShowToC(true);
View Full Code Here

   * @param rawHead
   * @param headLevel
   */
  public ITableOfContent appendHead(String rawHead, int headLevel, boolean noToC, int headCounter, int startPosition,
      int endPosition) {
    TagStack localStack = WikipediaParser.parseRecursive(rawHead.trim(), this, true, true);

    WPTag headTagNode = new WPTag("h" + headLevel);
    TagNode spanTagNode = new TagNode("span");
    // Example:
    // <h2><span class="mw-headline" id="Header_level_2">Header level
    // 2</span></h2>
    spanTagNode.addChildren(localStack.getNodeList());
    headTagNode.addChild(spanTagNode);
    String tocHead = headTagNode.getBodyString();
    String anchor = Encoder.encodeDotUrl(tocHead);
    createTableOfContent(false);
    if (!noToC && (headCounter > 3)) {
View Full Code Here

      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 = imageFormat.getAlt();
      if (altAttribute == null) {
        altAttribute = captionTagNode.getBodyString();
        imageFormat.setAlt(Encoder.encodeHtml(altAttribute));// see issue #25
      }
View Full Code Here

    if (!fInitialized) {
      fWikiListener = null;
      fToCSet = null;
      fTableOfContent = null;
      fTableOfContentTag = null;
      fTagStack = new TagStack();
      fReferences = null;
      fReferenceNames = null;
      fParserRecursionCount = 0;
      fRecursionLevel = 0;
      fTemplateRecursionCount = 0;
View Full Code Here

   */
  public void setUp() {
    fToCSet = null;
    fTableOfContent = null;
    fTableOfContentTag = null;
    fTagStack = new TagStack();
    fReferences = null;
    fReferenceNames = null;
    fParserRecursionCount = 0;
    fRecursionLevel = 0;
    fTemplateRecursionCount = 0;
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public TagStack swapStack(TagStack stack) {
    TagStack temp = fTagStack;
    fTagStack = stack;
    return temp;
  }
View Full Code Here

    }
  }

  public TagStack parseRecursiveInternal(IWikiModel wikiModel, boolean createOnlyLocalStack, boolean noTOC) {
    // local stack for this wiki snippet
    TagStack localStack = new TagStack();
    // global wiki model stack
    TagStack globalWikiModelStack = wikiModel.swapStack(localStack);
    try {
      // fix for infinite recursion

      int level = wikiModel.incrementRecursionLevel();
      // int parserRecursionLevel = wikiModel.incrementParserRecursionLevel();
      // if (parserRecursionLevel > Configuration.PARSER_RECURSION_LIMIT) {
      // TagNode error = new TagNode("span");
      // error.addAttribute("class", "error", true);
      // error.addChild(new
      // ContentToken("Error - total recursion count limit exceeded parsing wiki tags."));
      // localStack.append(error);
      // return localStack;
      // }

      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);
      setNoToC(noTOC);
      runParser();
      return localStack;
    } 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();
      // wikiModel.decrementParserRecursionLevel();
      if (!createOnlyLocalStack) {
        // append the resursively parsed local stack to the global wiki
        // model
        // stack
        globalWikiModelStack.append(localStack);
      }
      wikiModel.swapStack(globalWikiModelStack);
    }

    return localStack;
View Full Code Here

          } else {
            // definition list
            buf.append("</dl>");
          }
        } else {
          TagStack stack = ((WPListElement) element).getTagStack();
          if (stack != null) {
            converter.nodesToText(stack.getNodeList(), buf, wikiModel);
          }
        }
      }
    }
  }
View Full Code Here

        beginHTMLTag(buf, subList);
        // recursive call:
        renderSubListHTML(subList, converter, buf, wikiModel);
        endHTMLTag(buf, subList);
      } else {
        TagStack stack = ((WPListElement) element).getTagStack();
        if (stack != null) {
          converter.nodesToText(stack.getNodeList(), buf, wikiModel);
        }
      }

      if ((i < list.size() - 1) && list.get(i + 1) instanceof WPListElement) {
        lastChar = currentChar;
View Full Code Here

TOP

Related Classes of info.bliki.wiki.tags.util.TagStack

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.