tmortagne (SVN) wrote:
> Author: tmortagne
> Date: 2009-06-22 15:07:18 +0200 (Mon, 22 Jun 2009)
> New Revision: 21405
> 
> Added:
>    
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/main/java/org/xwiki/rendering/internal/macro/velocity/filter/IndentVelocityMacroFilter.java
>    
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/test/java/org/xwiki/rendering/internal/macro/velocity/filter/IndentVelocityMacroFilterTest.java
> Log:
> XWIKI-4018: Create an indentation velocity macro filter
> 
> Added: 
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/main/java/org/xwiki/rendering/internal/macro/velocity/filter/IndentVelocityMacroFilter.java
> ===================================================================
> --- 
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/main/java/org/xwiki/rendering/internal/macro/velocity/filter/IndentVelocityMacroFilter.java
>                          (rev 0)
> +++ 
> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/main/java/org/xwiki/rendering/internal/macro/velocity/filter/IndentVelocityMacroFilter.java
>  2009-06-22 13:07:18 UTC (rev 21405)

> +    /**
> +     * Match indentation spaces.
> +     */
> +    private static final Pattern INDENT_PATTERN = Pattern.compile("^[ \t]*", 
> Pattern.MULTILINE);

Replace with "^[ \t]++":
- * means that it matches all line starts, doing a useless replace for 
the empty string. Thus the first +.
- The second + is not that useful, since there's no backtracking to 
perform, but just to be explicit, it might save some ifs and elses.

-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to