private void initRadeoxEngine() { // This is needed so that our local config is used InitialRenderContext ircontext = new BaseInitialRenderContext(); Locale locale = new Locale("xwiki", "xwiki"); ircontext.set(RenderContext.INPUT_LOCALE, locale); ircontext.set(RenderContext.OUTPUT_LOCALE, locale); ircontext.set(RenderContext.LANGUAGE_LOCALE, locale); ircontext.setParameters(new HashMap()); this.initialRenderContext = ircontext; this.filterPipe = initFilterPipe(ircontext); }
public RadeoxWikiRenderEngine(InitialRenderContext context, Blog blog) { super(context); context.setRenderEngine(this); this.blog = blog; }
public static void main(String[] args) { String test = "__SnipSnap__ {link:Radeox|http://radeox.org} ==Other Bold=="; RenderContext context = new BaseRenderContext(); RenderEngine engine = new BaseRenderEngine(); log.info("Rendering with default:"); log.info(engine.render(test, context)); log.info("Rendering with alternative Wiki:"); InitialRenderContext initialContext = new BaseInitialRenderContext(); initialContext.set(RenderContext.INPUT_LOCALE, new Locale("otherwiki", "")); RenderEngine engineWithContext = new BaseRenderEngine(initialContext); log.info(engineWithContext.render(test, context)); } }
public static void main(String[] args) { String test = "__SnipSnap__ {link:Radeox|http://radeox.org} ==Other Bold=="; RenderContext context = new BaseRenderContext(); RenderEngine engine = new BaseRenderEngine(); log.info("Rendering with default:"); log.info(engine.render(test, context)); log.info("Rendering with alternative Wiki:"); InitialRenderContext initialContext = new BaseInitialRenderContext(); initialContext.set(RenderContext.INPUT_LOCALE, new Locale("otherwiki", "")); RenderEngine engineWithContext = new BaseRenderEngine(initialContext); log.info(engineWithContext.render(test, context)); } }
/** * Decorates the specified static page. * * @param context the context in which the decoration is running * @param staticPage the static page to be decorated */ public void decorate(ContentDecoratorContext context, StaticPage staticPage) { InitialRenderContext initialContext = new BaseInitialRenderContext(); initialContext.set(RenderContext.INPUT_LOCALE, getBlog().getLocale()); RenderEngine engineWithContext = new RadeoxWikiRenderEngine(initialContext, getBlog()); staticPage.setBody(wikify(staticPage.getBody(), engineWithContext, initialContext)); }
/** * Decorates the specified blog entry. * * @param context the context in which the decoration is running * @param blogEntry the blog entry to be decorated */ public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) { InitialRenderContext initialContext = new BaseInitialRenderContext(); initialContext.set(RenderContext.INPUT_LOCALE, getBlog().getLocale()); RenderEngine engineWithContext = new RadeoxWikiRenderEngine(initialContext, getBlog()); blogEntry.setExcerpt(wikify(blogEntry.getExcerpt(), engineWithContext, initialContext)); blogEntry.setBody(wikify(blogEntry.getBody(), engineWithContext, initialContext)); }
public void setInitialContext(InitialRenderContext context) { super.setInitialContext(context); Locale outputLocale = (Locale) context.get(RenderContext.OUTPUT_LOCALE); String outputName = (String) context .get(RenderContext.OUTPUT_BUNDLE_NAME); ResourceBundle outputMessages = ResourceBundle.getBundle(outputName, outputLocale); start = outputMessages.getString(getLocaleKey() + ".start"); //$NON-NLS-1$ end = outputMessages.getString(getLocaleKey() + ".end"); //$NON-NLS-1$ }
public void setInitialContext(InitialRenderContext context) { super.setInitialContext(context); Locale outputLocale = (Locale) context.get(RenderContext.OUTPUT_LOCALE); String outputName = (String) context .get(RenderContext.OUTPUT_BUNDLE_NAME); ResourceBundle outputMessages = ResourceBundle.getBundle(outputName, outputLocale); start = outputMessages.getString(getLocaleKey() + ".start"); //$NON-NLS-1$ end = outputMessages.getString(getLocaleKey() + ".end"); //$NON-NLS-1$ }