Package org.jamwiki.parser

Examples of org.jamwiki.parser.ParserInput


   
    //ParserInput parserInput = wikiComp.getParserInput();
   
   
   
    ParserInput input = new ParserInput();
    input.setWikiUser(null);
    input.setAllowSectionEdit(false);
    input.setDepth(10);
    input.setContext("");
    //input.setTableOfContents(null);
    input.setLocale(new Locale("en"));
    //input.setVirtualWiki(Long.toString(wikiComp.getOres().getResourceableId()));
    input.setTopicName("dummy");
    input.setUserIpAddress("0.0.0.0");
    OlatWikiDataHandler dataHandler = new OlatWikiDataHandler(wikiComp.getOres(), wikiComp.getImageBaseUri());
    input.setDataHandler(dataHandler);
   
    StringOutput out = new StringOutput();
    ubu.buildURI(out, null , null, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    String uri = out.toString();
   
    ParserDocument parsedDoc = null;

   
   
    String uniqueId = "o_wiki"+wikiComp.getDispatchID();
    try {
      uri = URLDecoder.decode(uri, "utf-8");
      input.setVirtualWiki(uri.substring(1, uri.length()-1));
      if (iframePostEnabled) {
        StringOutput so = new StringOutput();
        ubu.appendTarget(so);
        input.setURLTarget(so.toString());
      }
      sb.append("<div style=\"min-height:"+ wikiComp.getMinHeight() +"px\" id=\"");
      sb.append(uniqueId);
      sb.append("\">");
   
View Full Code Here


    return wikiPageDocument.getLuceneDocument();
  }
 
  private static String getContent(WikiPage wikiPage) {
    try {
      ParserInput input = new ParserInput();
      input.setWikiUser(null);
      input.setAllowSectionEdit(false);
      input.setDepth(2);
      input.setContext("");
      input.setLocale(Locale.ENGLISH);
      input.setTopicName("dummy");
      input.setUserIpAddress("0.0.0.0");
      input.setDataHandler(DUMMY_DATA_HANDLER);
      input.setVirtualWiki("/olat");

      AbstractParser parser = new JFlexParser(input);
      ParserDocument parsedDoc = parser.parseHTML(wikiPage.getContent());
      String parsedContent = parsedDoc.getContent();
      String filteredContent = FilterFactory.getHtmlTagAndDescapingFilter().filter(parsedContent);
View Full Code Here

    this.trans = trans;
   
    StaticExportWikiDataHandler datahandler = new StaticExportWikiDataHandler();
    datahandler.setWiki(ores);
 
    ParserInput parserInput = new ParserInput();
    parserInput.setWikiUser(null);
    parserInput.setAllowSectionEdit(false);
    parserInput.setDepth(10);
    parserInput.setContext("");
    //input.setTableOfContents(null);
    parserInput.setLocale(new Locale("en"));
    parserInput.setVirtualWiki("");
    parserInput.setTopicName("dummy");
    parserInput.setUserIpAddress("0.0.0.0");
    parserInput.setDataHandler(datahandler);
   
    parser = new JFlexParser(parserInput);
  }
View Full Code Here

      // if (sectionEdit && !ServletUtil.isEditable(virtualWiki, topicName,
      // userDetails)) {
      boolean sectionEdit = false;
      // }
      WikiUser user = ServletUtil.currentWikiUser();
      ParserInput parserInput = new ParserInput();
      // parserInput.setContext(request.getContextPath());
      // parserInput.setLocale(request.getLocale());
      parserInput.setWikiUser(user);
      parserInput.setTopicName(topicName);
      // parserInput.setUserIpAddress(ServletUtil.getIpAddress(request));
      parserInput.setVirtualWiki(virtualWiki);
      parserInput.setAllowSectionEdit(sectionEdit);
      ParserOutput parserOutput = new ParserOutput();
      String content = null;
      try {
        content = ParserUtil.parse(parserInput, parserOutput, topic
            .getTopicContent());
View Full Code Here

      if (topic == null) {
        return "";
      }
      content = topic.getTopicContent();
      if (cook) {
        ParserInput parserInput = new ParserInput();
        parserInput.setContext(context);
        parserInput.setLocale(locale);
        parserInput.setVirtualWiki(virtualWiki);
        parserInput.setTopicName(topicName);
        content = ParserUtil.parse(parserInput, null, content);
      }
      // WikiCache.addToCache(WikiBase.CACHE_PARSED_TOPIC_CONTENT, key,
      // content);
    } catch (Exception e) {
View Full Code Here

    // if (sectionEdit
    // && !ServletUtil.isEditable(virtualWiki, topicName, userDetails)) {
    // sectionEdit = false;
    // }
    WikiUser user = ServletUtil.currentWikiUser();
    ParserInput parserInput = new ParserInput();
    parserInput.setContext(request.getContextPath());
    parserInput.setLocale(request.getLocale());
    parserInput.setWikiUser(user);
    parserInput.setTopicName(topicName);
    parserInput.setUserDisplay(ServletUtil.getIpAddress(request));
    parserInput.setVirtualWiki(virtualWiki);
    parserInput.setAllowSectionEdit(sectionEdit);
    ParserOutput parserOutput = new ParserOutput();
    String content = null;
    try {
      content = ParserUtil.parse(parserInput, parserOutput, topic.getTopicContent());
    } catch (ParserException e) {
View Full Code Here

    Set<String> allItems = new TreeSet<String>();
    List<String> unlinkedTopics = WikiBase.getDataHandler().getAllTopicNames(
        virtualWiki);
    Topic topic;
    List<SearchResultEntry> topicLinks = null;
    ParserInput parserInput;
    ParserOutput parserOutput;
    for (String topicName : unlinkedTopics) {
      topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName,
          true, null);
      if (topic == null) {
        logger.warning("No topic found: " + virtualWiki + " / " + topicName);
        continue;
      }
      if (topic.getTopicType() != Topic.TYPE_ARTICLE) {
        continue;
      }
      // only mark them orphaned if there is neither category defined in it, nor
      // a link to it!
      // topicLinks = WikiBase.getSearchEngine().findLinkedTo(virtualWiki,
      // topicName);
      if (topicLinks == null || !topicLinks.isEmpty()) {
        continue;
      }
      parserInput = new ParserInput();
      parserInput.setContext(request.getContextPath());
      parserInput.setLocale(request.getLocale());
      parserInput.setWikiUser(ServletUtil.currentWikiUser());
      parserInput.setTopicName(topicName);
      parserInput.setUserDisplay(ServletUtil.getIpAddress(request));
      parserInput.setVirtualWiki(virtualWiki);
      parserInput.setAllowSectionEdit(false);
      parserOutput = new ParserOutput();
      ParserUtil.parse(parserInput, parserOutput, topic.getTopicContent());
      if (parserOutput.getCategories().size() == 0) {
        allItems.add(topic.getName());
      }
View Full Code Here

      return;
    }
    // parse for signatures and other syntax that should not be saved in raw
    // form
    WikiUser user = ServletUtil.currentWikiUser();
    ParserInput parserInput = new ParserInput();
    parserInput.setContext(request.getContextPath());
    parserInput.setLocale(request.getLocale());
    parserInput.setWikiUser(user);
    parserInput.setTopicName(topicName);
    parserInput.setUserDisplay(ServletUtil.getIpAddress(request));
    parserInput.setVirtualWiki(virtualWiki);
    ParserOutput parserOutput = ParserUtil.parseMetadata(parserInput, contents);
    // parse signatures and other values that need to be updated prior to saving
    contents = ParserUtil.parseMinimal(parserInput, contents);
    topic.setTopicContent(contents);
    // if (!StringUtils.isBlank(parserOutput.getRedirect())) {
View Full Code Here

      lexer.endState();
    }
    try {
      int level = (Integer)args[0];
      String tagText = raw.substring(level, raw.length() - level).trim();
      ParserInput tmpParserInput = new ParserInput(lexer.getParserInput());
      String tocText = JFlexParserUtil.parseFragment(tmpParserInput, tagText, JFlexParser.MODE_PROCESS);
      tocText = Utilities.stripMarkup(tocText);
      String tagName = lexer.getParserInput().getTableOfContents().checkForUniqueName(tocText);
      // re-convert any &uuml; or other (converted by the parser) entities back
      tagName = StringEscapeUtils.unescapeHtml(tagName);
View Full Code Here

TOP

Related Classes of org.jamwiki.parser.ParserInput

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.