Search in sources :

Example 1 with AbstractParser

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

the class WikiPageDocument method getContent.

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);
        return filteredContent;
    } catch (Exception e) {
        log.error("", e);
        return wikiPage.getContent();
    }
}
Also used : JFlexParser(org.jamwiki.parser.jflex.JFlexParser) AbstractParser(org.jamwiki.parser.AbstractParser) ParserInput(org.jamwiki.parser.ParserInput) ParserDocument(org.jamwiki.parser.ParserDocument)

Example 2 with AbstractParser

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

the class WikiPageDocument method getContent.

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);
        return filteredContent;
    } catch (Exception e) {
        log.error("", e);
        return wikiPage.getContent();
    }
}
Also used : JFlexParser(org.jamwiki.parser.jflex.JFlexParser) AbstractParser(org.jamwiki.parser.AbstractParser) ParserInput(org.jamwiki.parser.ParserInput) ParserDocument(org.jamwiki.parser.ParserDocument)

Example 3 with AbstractParser

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

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 4 with AbstractParser

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

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

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