/** * Render an input with text markup and return a String with e.g. HTML * * @param content String with the input to render * @param context Special context for the filter engine, e.g. with configuration information * @return result Output with rendered content */ @Override public String render(String content, RenderContext context) { FilterContext filterContext = new BaseFilterContext(); filterContext.setRenderContext(context); return this.fp.filter(content, filterContext); }
@Override protected void setUp(FilterContext context) { context.getRenderContext().setCacheable(true); }
public void handleMatch(StringBuffer buffer, MatchResult result, FilterContext context) { // Call the XWikiCodeMacro macro... Writer writer = new StringBufferWriter(buffer); MacroParameter mParams = context.getMacroParameter(); mParams.setParams(result.group(2)); mParams.setContent(result.group(3)); try { this.codeMacro.execute(writer, mParams); } catch (Throwable e) { log.warn("CodeFilter: unable to format macro: " + result.group(1), e); buffer.append("<div class=\"error\">" + result.group(1) + ": " + e.getMessage() + "</div>"); } } }
MacroParameter mParams = context.getMacroParameter(); switch(result.groups()) { case 3: } else if (command.startsWith("!")) { RenderEngine engine = context.getRenderContext().getRenderEngine(); if (engine instanceof IncludeRenderEngine) { String include = ((IncludeRenderEngine) engine).include(command.substring(1));
/** * Render an input with text markup and return a String with e.g. HTML * * @param content * String with the input to render * @param context * Special context for the filter engine, e.g. with configuration * information * @return result Output with rendered content */ public String render(String content, RenderContext context) { FilterContext filterContext = new BaseFilterContext(); filterContext.setRenderContext(context); return fp.filter(content, filterContext); }
MacroParameter mParams = context.getMacroParameter(); RenderEngine engine = context.getRenderContext() .getRenderEngine(); if (engine instanceof IncludeRenderEngine) .include(command.substring(1),context.getRenderContext()); if (null != include)
/** * @see CodeRemoveFilter#handleMatch(StringBuffer, MatchResult, FilterContext) */ public void handleMatch(StringBuffer buffer, MatchResult result, FilterContext context) { LinkedList contentList = (LinkedList) context.getRenderContext().get(CodeRemoveFilter.CODE_MACRO_CONTENT); buffer.append(result.group(1)); buffer.append((String) contentList.removeFirst()); buffer.append("{code}"); } }
MacroParameter mParams = context.getMacroParameter(); switch(result.groups()) { case 3:
/** * Render an input with text markup and return a String with e.g. HTML * * @param content * String with the input to render * @param context * Special context for the filter engine, e.g. with configuration * information * @return result Output with rendered content */ public String render(String content, RenderContext context) { init(); FilterContext filterContext = new BaseFilterContext(); filterContext.setRenderContext(context); return fp.filter(content, filterContext); }
MacroParameter mParams = context.getMacroParameter(); RenderEngine engine = context.getRenderContext() .getRenderEngine(); if (engine instanceof IncludeRenderEngine) .include(command.substring(1),context.getRenderContext()); if (null != include)
public void handleMatch(StringBuffer buffer, MatchResult result, FilterContext context) { Map param = context.getRenderContext().getParameters(); String name = result.group(1); if (param.containsKey(name)) { Object value = param.get(name); if (value instanceof String[]) { buffer.append(((String[]) value)[0]); } else { buffer.append(value); } } else { buffer.append("<"); buffer.append(name); buffer.append(">"); } }
/** * Render an input with text markup and return a String with e.g. HTML * * @param content * String with the input to render * @param context * Special context for the filter engine, e.g. with configuration * information * @return result Output with rendered content */ public String render(String content, RenderContext context) { init(); FilterContext filterContext = new BaseFilterContext(); filterContext.setRenderContext(context); return fp.filter(content, filterContext); }
RenderContext renderContext = context.getRenderContext();
public void handleMatch(StringBuffer buffer, MatchResult result, FilterContext context) { // Remove the content inside the code macro. It'll be put back in CodeRestoreFilter // We save the content in the Filter context so that it can restored later on. // Important: This filter is called for all code macros on the page before the restore // filter is called. Thus we need to save the removed content for ALL code macros and this // is why we're using a LinkedList inside the CODE_MACRO_CONTENT context key. LinkedList contentList = (LinkedList) context.getRenderContext().get(CODE_MACRO_CONTENT); if (contentList == null) { contentList = new LinkedList(); context.getRenderContext().set(CODE_MACRO_CONTENT, contentList); } contentList.add(result.group(4)); buffer.append(result.group(1)); buffer.append("{code}"); } }
public void handleMatch(StringBuffer buffer, MatchResult result, FilterContext context) { Map param = context.getRenderContext().getParameters(); String name = result.group(1); if (param.containsKey(name)) { Object value = param.get(name); if (value instanceof String[]) { buffer.append(((String[]) value)[0]); } else { buffer.append(value); } } else { buffer.append("<"); buffer.append(name); buffer.append(">"); } }
RenderContext renderContext = context.getRenderContext();
@Override public void handleMatch(StringBuffer buffer, org.radeox.regex.MatchResult result, FilterContext context) { XWikiContext xcontext = (XWikiContext) context.getRenderContext().get("xcontext"); String url = result.group(0); url = Utils.createPlaceholder(url, xcontext); buffer.append(this.formatter.format(new Object[] {url})); } }
public void handleMatch(StringBuffer buffer, MatchResult result, FilterContext context) { buffer.append(result.group(1)); // Does our engine know images? RenderEngine engine = context.getRenderContext().getRenderEngine(); String externalImage = ""; if (engine instanceof ImageRenderEngine) { buffer.append(((ImageRenderEngine) engine).getExternalImageLink()); } buffer.append(formatter.format(new Object[] { externalImage, result.group(2), Encoder.toEntity(result.group(2).charAt(0)) + result.group(2).substring(1) })); return; } }
public void handleMatch(StringBuffer buffer, MatchResult result, FilterContext context) { buffer.append(result.group(1)); // Does our engine know images? RenderEngine engine = context.getRenderContext().getRenderEngine(); String externalImage = ""; if (engine instanceof ImageRenderEngine) { buffer.append(((ImageRenderEngine) engine).getExternalImageLink()); } buffer.append(formatter.format(new Object[] { externalImage, result.group(2), Encoder.toEntity(result.group(2).charAt(0)) + result.group(2).substring(1) })); return; } }
String numbering = ""; RenderContext rcontext = context.getRenderContext(); XWikiContext xcontext = ((XWikiRadeoxRenderEngine) rcontext.getRenderEngine()).getXWikiContext(); VelocityContext vcontext = (VelocityContext) xcontext.get("vcontext");