Search in sources :

Example 6 with ParserInput

use of org.jamwiki.parser.ParserInput in project OpenOLAT by OpenOLAT.

the class WikiPageMediaController method getContent.

private static String getContent(String content) {
    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(new DummyDataHandler());
        input.setVirtualWiki("/olat");
        AbstractParser parser = new JFlexParser(input);
        ParserDocument parsedDoc = parser.parseHTML(content);
        String parsedContent = parsedDoc.getContent();
        return FilterFactory.getHtmlTagAndDescapingFilter().filter(parsedContent);
    } catch (Exception e) {
        log.error("", e);
        return content;
    }
}
Also used : JFlexParser(org.jamwiki.parser.jflex.JFlexParser) AbstractParser(org.jamwiki.parser.AbstractParser) ParserInput(org.jamwiki.parser.ParserInput) ParserDocument(org.jamwiki.parser.ParserDocument)

Example 7 with ParserInput

use of org.jamwiki.parser.ParserInput in project OpenOLAT by OpenOLAT.

the class WikiArtefactDetailsController method getContent.

private static String getContent(String content) {
    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(new DummyDataHandler());
        input.setVirtualWiki("/olat");
        AbstractParser parser = new JFlexParser(input);
        ParserDocument parsedDoc = parser.parseHTML(content);
        String parsedContent = parsedDoc.getContent();
        return FilterFactory.getHtmlTagAndDescapingFilter().filter(parsedContent);
    } catch (Exception e) {
        log.error("", e);
        return content;
    }
}
Also used : JFlexParser(org.jamwiki.parser.jflex.JFlexParser) AbstractParser(org.jamwiki.parser.AbstractParser) ParserInput(org.jamwiki.parser.ParserInput) ParserDocument(org.jamwiki.parser.ParserDocument)

Example 8 with ParserInput

use of org.jamwiki.parser.ParserInput in project openolat by klemens.

the class WikiArtefactDetailsController method getContent.

private static String getContent(String content) {
    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(new DummyDataHandler());
        input.setVirtualWiki("/olat");
        AbstractParser parser = new JFlexParser(input);
        ParserDocument parsedDoc = parser.parseHTML(content);
        String parsedContent = parsedDoc.getContent();
        return FilterFactory.getHtmlTagAndDescapingFilter().filter(parsedContent);
    } catch (Exception e) {
        log.error("", e);
        return content;
    }
}
Also used : JFlexParser(org.jamwiki.parser.jflex.JFlexParser) AbstractParser(org.jamwiki.parser.AbstractParser) ParserInput(org.jamwiki.parser.ParserInput) ParserDocument(org.jamwiki.parser.ParserDocument)

Aggregations

ParserDocument (org.jamwiki.parser.ParserDocument)8 ParserInput (org.jamwiki.parser.ParserInput)8 JFlexParser (org.jamwiki.parser.jflex.JFlexParser)8 AbstractParser (org.jamwiki.parser.AbstractParser)6 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Locale (java.util.Locale)2 AJAXFlags (org.olat.core.gui.control.winmgr.AJAXFlags)2 StringOutput (org.olat.core.gui.render.StringOutput)2 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)2