/** * @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}"); } }
XWikiContext xcontext = (XWikiContext) params.getContext().get("xcontext"); XWiki xwiki = xcontext.getWiki(); String defaulttarget = xwiki.Param("xwiki.render.externallinks.defaulttarget", "");
name = (String) context.getRenderContext().get("uk.ac.cam.caret.sakai.rwiki.service.api.model.RWikiObject.name"); //$NON-NLS-1$
@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})); } }
Writer writer = new StringBufferWriter(buffer); XWikiContext xcontext = (XWikiContext) context.getRenderContext().get("xcontext"); String str = result.group(1); if (str != null) {
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}"); } }
name = (String) context.getRenderContext().get("uk.ac.cam.caret.sakai.rwiki.service.api.model.RWikiObject.name"); //$NON-NLS-1$
XWikiContext xcontext = (XWikiContext) params.getContext().get("xcontext"); XWiki xwiki = xcontext.getWiki();
public void execute(Writer writer, MacroParameter params) throws IllegalArgumentException, IOException { RenderContext context = params.getContext(); VelocityContext vcontext = (VelocityContext) context.get("vcontext"); Document doc = (Document) vcontext.get("doc"); com.xpn.xwiki.api.Object obj; // We lookup the className for this object String classname = params.get("classname", 0); // Optionnaly we see if it was asked for an object number String snb = params.get("nb", 1); // We find the corresponding object if (snb!=null) obj = doc.getObject(classname, Integer.parseInt(snb)); else obj = doc.getObject(classname); // We assign this object as the used object // Future calls to doc.display() or {field} will make use of this object doc.use(obj); } }