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>");