use of org.jamwiki.parser.ParserDocument 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;
}
}
use of org.jamwiki.parser.ParserDocument in project openolat by klemens.
the class WikiToCPExport method wikiPageToHtml.
protected String wikiPageToHtml(WikiPage page) {
StringBuilder sb = new StringBuilder();
sb.append("<html>");
sb.append("<head>\n");
sb.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n");
sb.append("<style type=\"text/css\">img {float:right;padding:10px;}</style>\n");
// sb.append("<script type=\"text/javascript\" src=\"cp_offline_menu_mat/jsMath/easy/load.js\"></script>\n");
sb.append("<script type=\"text/javascript\" src=\"cp_offline_menu_mat/wiki.js\"></script>\n");
sb.append("<script type=\"text/javascript\" src=\"mapping.js\"></script>\n");
sb.append("<link rel=\"StyleSheet\" href=\"cp_offline_menu_mat/wiki.css\" type=\"text/css\" media=\"screen, print\">\n");
sb.append("</head>\n");
sb.append("<body>\n");
sb.append("<h3>").append(getTranslatedWikiPageName(page)).append("</h3>");
sb.append("<hr><div id=\"olat-wiki\">");
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>");
return sb.toString();
}
use of org.jamwiki.parser.ParserDocument 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;
}
}
use of org.jamwiki.parser.ParserDocument 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;
}
}
use of org.jamwiki.parser.ParserDocument 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;
}
}
Aggregations