On Mar 4, 2010, at 4:27 PM, tmortagne (SVN) wrote:
Author: tmortagne
Date: 2010-03-04 16:27:02 +0100 (Thu, 04 Mar 2010)
New Revision: 27446
Added:
platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/util/TOCGeneratorTest.java
Modified:
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/util/TOCGenerator.java
Log:
XWIKI-4971: Header generated ids are wrong in 1.0 syntax
Modified:
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/util/TOCGenerator.java
===================================================================
---
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/util/TOCGenerator.java 2010-03-04
14:57:59 UTC (rev 27445)
+++
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/util/TOCGenerator.java 2010-03-04
15:27:02 UTC (rev 27446)
@@ -119,7 +119,7 @@
public static String makeHeadingID(String text, int occurence, XWikiContext context)
{
- text = "H" + Util.encodeURI(text, context);
+ text = "H" + text;
text = text.replaceAll("[^a-zA-Z0-9]", "");
if (occurence > 0) {
Added:
platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/util/TOCGeneratorTest.java
===================================================================
---
platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/util/TOCGeneratorTest.java
(rev 0)
+++
platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/util/TOCGeneratorTest.java 2010-03-04
15:27:02 UTC (rev 27446)
@@ -0,0 +1,16 @@
+package com.xpn.xwiki.util;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+public class TOCGeneratorTest
missing license header + @since/@version javadoc.
Thanks
-Vincent
+{
+ @Test
+ public void testMakeHeadingID()
+ {
+ Assert.assertEquals("Hheader",
TOCGenerator.makeHeadingID("header", 0, null));
+ Assert.assertEquals("Hheaderwithspace",
TOCGenerator.makeHeadingID("header with space", 0, null));
+ Assert.assertEquals("Hheader-1",
TOCGenerator.makeHeadingID("header", 1, null));
+ }
+}
Property changes on:
platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/util/TOCGeneratorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain