You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ja...@apache.org on 2009/04/04 19:31:12 UTC

svn commit: r761970 - in /incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH: ChangeLog src/com/ecyrd/jspwiki/Release.java src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java tests/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslatorTest.java

Author: jalkanen
Date: Sat Apr  4 17:31:11 2009
New Revision: 761970

URL: http://svn.apache.org/viewvc?rev=761970&view=rev
Log:
JSPWIKI-391: FCK editor ruins the anchors inside the page

Modified:
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslatorTest.java

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog?rev=761970&r1=761969&r2=761970&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog Sat Apr  4 17:31:11 2009
@@ -1,3 +1,12 @@
+2008-04-04  Janne Jalkanen <ja...@apache.org>
+
+        * 2.8.3-svn-1
+        
+        * JSPWIKI-391: FCK editor ruins the anchors inside the page
+        
+        * JSPWIKI-493: FCK editor adds newlines before and after text 
+        formatted as "code"
+
 2009-03-20 Harry Metske <me...@apache.org>
 
         * 2.8.2-svn-15

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java?rev=761970&r1=761969&r2=761970&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java Sat Apr  4 17:31:11 2009
@@ -57,7 +57,7 @@
      *  <p>
      *  If the POSTFIX is empty, it is not added to the version string.
      */
-    private static final String    POSTFIX       = "";
+    private static final String    POSTFIX       = "svn";
 
     /** The JSPWiki major version. */
     public static final int        VERSION       = 2;
@@ -66,7 +66,7 @@
     public static final int        REVISION      = 8;
 
     /** The minor revision.  */
-    public static final int        MINORREVISION = 2;
+    public static final int        MINORREVISION = 3;
 
     /** The build number/identifier.  This is a String as opposed to an integer, just
      *  so that people can add other identifiers to it.  The build number is incremented
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "";
+    public static final String     BUILD         = "1";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java?rev=761970&r1=761969&r2=761970&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java Sat Apr  4 17:31:11 2009
@@ -390,9 +390,20 @@
                                 ref = trimLink( ref );
                                 if( ref != null )
                                 {
-                                    if( ref.startsWith( "#" ) )
+                                    if( ref.startsWith( "#" ) ) // This is a link to a footnote.
                                     {
-                                        print( e );
+                                        // convert "#ref-PageName-1" to just "1"
+                                        String href = ref.replaceFirst( "#ref-.+-(\\d+)", "$1" );
+                                        
+                                        // remove the brackets around "[1]"
+                                        String textValue = e.getValue().substring( 1, (e.getValue().length() - 1) );
+                                        
+                                        if( href.equals( textValue ) ){ // handles the simplest case. Example: [1]
+                                            print( e );
+                                        }                                        
+                                        else{ // handles the case where the link text is different from the href. Example: [something|1]
+                                            m_out.print( "[" + textValue + "|" + href + "]" );
+                                        }
                                     }
                                     else
                                     {

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslatorTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslatorTest.java?rev=761970&r1=761969&r2=761970&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslatorTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslatorTest.java Sat Apr  4 17:31:11 2009
@@ -54,6 +54,11 @@
 
        assertEquals( "[AugumentedWikiLinks|AugumentedWikiLinks|title='my \"custom\" title' target='_blank']", html2wiki
                      .translate( "<a class=\"wikipage\" href=\"Wiki.jsp?page=AugumentedWikiLinks\" target=\"_blank\" title=\"my 'custom' title\">AugumentedWikiLinks</a>" ) );
+       
+       // footnote links
+       assertEquals( "[23]", html2wiki.translate( "<a class=\"footnoteref\" href=\"#ref-PageName-23\">[23]</a>" ) );
+       assertEquals( "[something|23]", html2wiki.translate( "<a class=\"footnoteref\" href=\"#ref-PageName-23\">[something]</a>" ) );
+       
     }
     
     public void testTable() throws Exception