Re: [xwiki-devs] [xwiki-notifications] r21347 - in platform/core/branches/xwiki-core-1.9/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src: main/java/org/xwiki/rendering/internal/macro/velocity/filter test/java/org/xwiki/rendering/internal/macro/velocity/filter
tmortagne (SVN) wrote:
Author: tmortagne Date: 2009-06-19 13:02:05 +0200 (Fri, 19 Jun 2009) New Revision: 21347
Modified: platform/core/branches/xwiki-core-1.9/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/main/java/org/xwiki/rendering/internal/macro/velocity/filter/HTMLVelocityMacroFilter.java platform/core/branches/xwiki-core-1.9/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/test/java/org/xwiki/rendering/internal/macro/velocity/filter/HTMLVelocityMacroFilterTest.java Log: XWIKI-3988: Default Velocity macro filter does not match directives on multiple lines * add support for non UNIX newlines
Modified: platform/core/branches/xwiki-core-1.9/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/main/java/org/xwiki/rendering/internal/macro/velocity/filter/HTMLVelocityMacroFilter.java =================================================================== --- platform/core/branches/xwiki-core-1.9/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/main/java/org/xwiki/rendering/internal/macro/velocity/filter/HTMLVelocityMacroFilter.java 2009-06-19 07:28:54 UTC (rev 21346) +++ platform/core/branches/xwiki-core-1.9/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/main/java/org/xwiki/rendering/internal/macro/velocity/filter/HTMLVelocityMacroFilter.java 2009-06-19 11:02:05 UTC (rev 21347)
+ * Match not UNIX new lines to replace them. + */ + private static final Pattern MSNEWLINE_PATTERN = Pattern.compile("\\r\\n|\\r");
I ran a quick test, and using \\r\\n? instead of \\r\\n|\\r is 40% faster. I think it's also safer, since '?' is by definition greedy, while '|' doesn't clearly indicate which of the two branches is executed, so it might replace just the \r with a new \n, leaving the old \n in place, thus yielding the wrong result. And I don't like this name, since \r is MacOS. You could call it ALTERNATIVE_LINE_ENDINGS.
participants (1)
-
Sergiu Dumitriu