On Mon, Sep 14, 2009 at 21:11, Vincent Massol <vincent(a)massol.net> wrote:
On Sep 14, 2009, at 6:22 PM, tmortagne (SVN) wrote:
Author: tmortagne
Date: 2009-09-14 18:22:10 +0200 (Mon, 14 Sep 2009)
New Revision: 23517
Added:
platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-tests/src/test/resources/escape/escape20.test
Modified:
platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/
xwiki/XWikiSyntaxEscapeHandler.java
platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-tests/src/test/java/org/xwiki/rendering/
SimpleRenderingTests.java
Log:
XWIKI-4341: Quote syntax is not escaped when HTML is parsed
Modified: platform/core/branches/xwiki-core-2.0/xwiki-rendering/
xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/
renderer/xwiki/XWikiSyntaxEscapeHandler.java
===================================================================
--- platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/
xwiki/XWikiSyntaxEscapeHandler.java 2009-09-14 16:13:16 UTC (rev
23516)
+++ platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/
xwiki/XWikiSyntaxEscapeHandler.java 2009-09-14 16:22:10 UTC (rev
23517)
@@ -43,6 +43,8 @@
private static final Pattern LIST_PATTERN =
Pattern.compile("\\p{Blank}*((\\*+[:;]*)|([1*]+\\.[:;]*)|
([:;]+))\\p{Blank}+");
+ private static final Pattern QUOTE_PATTERN = Pattern.compile("(\
\>+)");
+
private static final Pattern HEADER_PATTERN = Pattern.compile("\
\p{Blank}*(=+)");
private static final Pattern TABLE_PATTERN = Pattern.compile("\
\p{Blank}*(\\||!!)");
@@ -77,6 +79,9 @@
// Look for table character patterns at beginning of
line and escape the first character only (it's enough)
escapeFirstMatchedCharacter(TABLE_PATTERN,
accumulatedBuffer);
+
+ // Look for quote pattern at beginning of line and
escape the first character only (it's enough)
+ escapeFirstMatchedCharacter(QUOTE_PATTERN,
accumulatedBuffer);
}
// Escape table characters
@@ -136,7 +141,7 @@
// Escape begin link
replaceAll(accumulatedBuffer, "[[", ESCAPE_CHAR + "[" +
ESCAPE_CHAR + "[");
-
+
// Escape link label
int linkLevel = getLinkLevel(listenerChain);
Modified: platform/core/branches/xwiki-core-2.0/xwiki-rendering/
xwiki-rendering-tests/src/test/java/org/xwiki/rendering/
SimpleRenderingTests.java
===================================================================
--- platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-tests/src/test/java/org/xwiki/rendering/
SimpleRenderingTests.java 2009-09-14 16:13:16 UTC (rev 23516)
+++ platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-tests/src/test/java/org/xwiki/rendering/
SimpleRenderingTests.java 2009-09-14 16:22:10 UTC (rev 23517)
@@ -184,6 +184,7 @@
suite.addTestsFromResource("escape/escape17", false);
suite.addTestsFromResource("escape/escape18", false);
suite.addTestsFromResource("escape/escape19", false);
+ suite.addTestsFromResource("escape/escape20", false);
// Other
suite.addTestsFromResource("horizontalline/horizontalline1",
false);
Added: platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-tests/src/test/resources/escape/escape20.test
===================================================================
--- platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-tests/src/test/resources/escape/
escape20.test (rev 0)
+++ platform/core/branches/xwiki-core-2.0/xwiki-rendering/xwiki-
rendering-tests/src/test/resources/escape/escape20.test 2009-09-14
16:22:10 UTC (rev 23517)
@@ -0,0 +1,19 @@
+
.#---------------------------------------------------------------------------------------------------------
+.input|xwiki/2.0
+.# Verify that ) is escaped if last character of a group
The comment talks about ")" but the test below is about ">".
copy paste?
Yes as usual, always do the same mistake, fixing it. Thanks for the report.
Thanks
-Vincent
+
.#---------------------------------------------------------------------------------------------------------
+~> text
+.#-----------------------------------------------------
+.expect|event/1.0
+.#-----------------------------------------------------
+beginDocument
+beginParagraph
+onSpecialSymbol [>]
+onSpace
+onWord [text]
+endParagraph
+endDocument
+.#-----------------------------------------------------
+.expect|xwiki/2.0
+.#-----------------------------------------------------
+~> text
\ No newline at end of file
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs