Package org.jamwiki.parser

Examples of org.jamwiki.parser.ParserDocument


   
    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("\">");
   
      AbstractParser parser = new JFlexParser(input);
      parsedDoc = parser.parseHTML(wikiComp.getWikiContent());
    } catch (UnsupportedEncodingException e) {
      //encoding utf-8 should be ok
    } catch (Exception e) {
      throw new OLATRuntimeException(this.getClass(), "error while rendering wiki page with content:"+ wikiComp.getWikiContent(), e);
    }
    // Use global js math formatter for latex formulas
    sb.append(Formatter.formatLatexFormulas(parsedDoc.getContent()));
    sb.append("</div>");
    //set targets of media, image and external links to target "_blank"
    sb.append("<script type=\"text/javascript\">/* <![CDATA[ */ ");
    sb.append("changeAnchorTargets('").append(uniqueId).append("');");
    sb.append("/* ]]> */</script>");
 
View Full Code Here


      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);
      return filteredContent;
    } catch(Exception e) {
      e.printStackTrace();
      log.error("", e);
View Full Code Here

      else sb.append(page.getPageName());
      sb.append("</h3>");
      sb.append("<hr><div id=\"olat-wiki\">");
      VFSLeaf file = tempFolder.createChildLeaf(page.getPageId()+".html");
      try {
        ParserDocument doc = parser.parseHTML(page.getContent());
        sb.append(doc.getContent());
      } catch (Exception e) {
        throw new OLATRuntimeException("error while parsing from wiki to cp. ores:"+ores.getResourceableId(), e);
      }
      sb.append("</div></body></html>");
      FileUtils.save(file.getOutputStream(false), sb.toString(), "utf-8");
View Full Code Here

TOP

Related Classes of org.jamwiki.parser.ParserDocument

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.