Package info.bliki.wiki.tags.util

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


   *
   * @param rawHead
   * @param headLevel
   */
  public ITableOfContent appendHead(String rawHead, int headLevel, boolean noToC, int headCounter) {
    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


      fToCSet = null;
      fTableOfContent = null;
      fCategoryNamespaces = new ArrayList<String>();
      fTemplateNamespaces = new ArrayList<String>();
      fImageNamespaces = new ArrayList<String>();
      fTagStack = new TagStack();
      fReferences = null;
      fReferenceNames = null;
      fRecursionLevel = 0;
      fSectionCounter = 0;
      fReplaceColon = false;
View Full Code Here

  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) {
    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.encodeUrl(tocHead);
    createTableOfContent(false);
    if (!noToC && (headCounter > 3)) {
      fTableOfContentTag.setShowToC(true);
View Full Code Here

            WPList.InternalList subList = (WPList.InternalList) element;
            beginLaTeXTag(_out, subList);
            renderSubListLaTeX(subList, converter, _out, model);
            endLaTeXTag(_out, subList);
          } else {
            TagStack stack = ((WPListElement) element).getTagStack();
            if (stack != null) {
              converter.nodesToText(stack.getNodeList(), _out, model);
            }
            // wikiModel.appendStack(((WPListElement)
            // element).getTagStack());
          }
        }
View Full Code Here

        beginLaTeXTag(_out, subList);
        // recursive call:
        renderSubListLaTeX(subList, converter, _out, wikiModel);
        _out.append(PropertyManager.get("List.Item.End"));
      } else {
        TagStack stack = ((WPListElement) element).getTagStack();
        converter.nodesToText(stack.getNodeList(), _out, wikiModel);
        // wikiModel.appendStack(((WPListElement)
        // element).getTagStack());
      }

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

      }
    }
  }

  public void renderLaTeX(WPCell cell, ITextConverter converter, Appendable _out, IWikiModel wikiModel) throws IOException {
    TagStack tagStack = cell.getTagStack();
    int cellType = cell.getType();
    if (tagStack != null) {
      boolean hasLBrks = false;
      List<BaseToken> list = tagStack.getNodeList();
      for (int i = 0; i < list.size(); i++) {
        if (list.get(i) instanceof BrTag) {
          hasLBrks = true;
          break; // for
        }
      }

      if (cellType == WPCell.TH) {
        _out.append(PropertyManager.get("Table.HeaderCell.Begin"));
      }
      if (hasLBrks) {
        _out.append(PropertyManager.get("Table.CellWithLBreaks.Begin"));
      }
      converter.nodesToText(tagStack.getNodeList(), _out, wikiModel);

      if (hasLBrks) {
        _out.append(PropertyManager.get("Table.CellWithLBreaks.End"));
      }
      if (cellType == WPCell.TH) {
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 {
      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);
      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();
      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

      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(altAttribute);
      }
View Full Code Here

  protected void initialize() {
    if (!fInitialized) {
      fWikiListener = null;
      fToCSet = null;
      fTableOfContent = null;
      fTagStack = new TagStack();
      fReferences = null;
      fReferenceNames = null;
      fRecursionLevel = 0;
      fSectionCounter = 0;
      fReplaceColon = false;
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.