Search in sources :

Example 6 with AbstractParser

use of org.jamwiki.parser.AbstractParser 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

AbstractParser (org.jamwiki.parser.AbstractParser)6 ParserDocument (org.jamwiki.parser.ParserDocument)6 ParserInput (org.jamwiki.parser.ParserInput)6 JFlexParser (org.jamwiki.parser.jflex.JFlexParser)6