Package org.radeox.api.engine

Examples of org.radeox.api.engine.RenderEngine


        InitialRenderContext initialContext = new BaseInitialRenderContext();
        initialContext.set(RenderContext.INPUT_LOCALE, new Locale("atabaque", ""));
        initialContext.set(RenderContext.OUTPUT_LOCALE, new Locale("atabaque", ""));
        Filter filter = new UnderlineFilter();
        filter.setInitialContext(initialContext);
        RenderEngine engineWithContext = new BaseRenderEngine(initialContext);
        return engineWithContext.render(arg, context);
    }
View Full Code Here


   * @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));
  }
View Full Code Here

   * @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));
  }
View Full Code Here

    private static final String WIKI_START_TAG = "<wiki>";
    private static final String WIKI_END_TAG = "</wiki>";

    public static String wikify(String content) {
        InitialRenderContext renderContext = new BaseInitialRenderContext();
        RenderEngine renderEngine = new RadeoxWikiRenderEngine(renderContext);
        // is there work to do?
        if (content == null || content.length() == 0) {
            return "";
        }

        // this pattern says "take the shortest match you can find where there are
        // one or more characters between wiki tags"
        //  - the match is case insensitive and DOTALL means that newlines are
        //  - considered as a character match
        Pattern p = Pattern.compile(WIKI_START_TAG + ".+?" + WIKI_END_TAG,
                Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
        Matcher m = p.matcher(content);

        // while there are blocks to be escaped
        while (m.find()) {
            int start = m.start();
            int end = m.end();

            // grab the text, strip off the escape tags and transform it
            String textToWikify = content.substring(start, end);
            textToWikify = textToWikify.substring(WIKI_START_TAG.length(), textToWikify.length() - WIKI_END_TAG.length());
            textToWikify = renderEngine.render(textToWikify, renderContext);

            // now add it back into the original text
            content = content.substring(0, start) + textToWikify + content.substring(end, content.length());
            m = p.matcher(content);
        }
View Full Code Here

TOP

Related Classes of org.radeox.api.engine.RenderEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.