jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject svn commit: r1172281 - in /incubator/jspwiki/trunk: ChangeLog src/java/org/apache/wiki/Release.java src/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java tests/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java
Date Sun, 18 Sep 2011 13:28:38 GMT
Author: metskem
Date: Sun Sep 18 13:28:38 2011
New Revision: 1172281

URL: http://svn.apache.org/viewvc?rev=1172281&view=rev
Log:
2011-09-18  Harry Metske <metskem@apache.org>

        * 3.0.0-svn-233
        
        * JSPWIKI-391: FCK editor ruins the anchors inside the page
        
        * JSPWIKI-493: FCK editor adds newlines before and after text 
        formatted as "code"

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=1172281&r1=1172280&r2=1172281&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sun Sep 18 13:28:38 2011
@@ -1,5 +1,14 @@
 2011-09-18  Harry Metske <metskem@apache.org>
 
+        * 3.0.0-svn-233
+        
+        * JSPWIKI-391: FCK editor ruins the anchors inside the page
+        
+        * JSPWIKI-493: FCK editor adds newlines before and after text 
+        formatted as "code"
+
+2011-09-18  Harry Metske <metskem@apache.org>
+
         * 3.0.0-svn-232
         
         * fixed JSPWIKI-705 (Log a clear hint to a running security manager).

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java?rev=1172281&r1=1172280&r2=1172281&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Sun Sep 18 13:28:38 2011
@@ -77,7 +77,7 @@ public final class Release
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "232";
+    public static final String     BUILD         = "233";
 
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java?rev=1172281&r1=1172280&r2=1172281&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java
Sun Sep 18 13:28:38 2011
@@ -387,9 +387,20 @@ public class XHtmlElementToWikiTranslato
                                 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/trunk/tests/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java?rev=1172281&r1=1172280&r2=1172281&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java
(original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java
Sun Sep 18 13:28:38 2011
@@ -75,6 +75,11 @@ public class HtmlStringToWikiTranslatorT
 
        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



Mime
View raw message