public String render(String content, XWikiDocument contentdoc, XWikiDocument contextdoc, XWikiContext context) { Util util = context.getUtil(); // Remove the content that is inside "{pre}" PreTagSubstitution preTagSubst = new PreTagSubstitution(util, isRemovePre()); content = preTagSubst.substitute(content); RenderContext rcontext = (RenderContext) context.get("rcontext"); if (rcontext == null) { rcontext = new BaseRenderContext(); // This is needed as otherwise some macros throw exceptions rcontext.setParameters(new HashMap()); rcontext.set("xcontext", context); } if (rcontext.getRenderEngine() == null) { XWikiRadeoxRenderEngine radeoxengine = new XWikiRadeoxRenderEngine(this.initialRenderContext, this.filterPipe, context); rcontext.setRenderEngine(radeoxengine); } // If global placeholders are not enabled, then use local placeholders. boolean useLocalPlaceholders = !Utils.arePlaceholdersEnabled(context); if (useLocalPlaceholders) { Utils.enablePlaceholders(context); } String result = rcontext.getRenderEngine().render(content, rcontext); if (useLocalPlaceholders) { result = Utils.replacePlaceholders(result, context); Utils.disablePlaceholders(context); } return preTagSubst.insertNonWikiText(result); }