cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1496595 - in /cxf/web/src/main/java/org/apache/cxf/cwiki: ConfluenceCleanupWriter.java SiteExporter.java
Date Tue, 25 Jun 2013 19:11:56 GMT
Author: dkulp
Date: Tue Jun 25 19:11:55 2013
New Revision: 1496595

URL: http://svn.apache.org/r1496595
Log:
Update to allow better formatting

Modified:
    cxf/web/src/main/java/org/apache/cxf/cwiki/ConfluenceCleanupWriter.java
    cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java

Modified: cxf/web/src/main/java/org/apache/cxf/cwiki/ConfluenceCleanupWriter.java
URL: http://svn.apache.org/viewvc/cxf/web/src/main/java/org/apache/cxf/cwiki/ConfluenceCleanupWriter.java?rev=1496595&r1=1496594&r2=1496595&view=diff
==============================================================================
--- cxf/web/src/main/java/org/apache/cxf/cwiki/ConfluenceCleanupWriter.java (original)
+++ cxf/web/src/main/java/org/apache/cxf/cwiki/ConfluenceCleanupWriter.java Tue Jun 25 19:11:55
2013
@@ -219,7 +219,7 @@ public class ConfluenceCleanupWriter ext
             }
         } else if ("img".equals(localName.toLowerCase())
             || "img".equals(qName.toLowerCase())) {
-            String href = atts.getValue("src");
+            String href = exporter.stripHost(atts.getValue("src"));
             if ("absmiddle".equalsIgnoreCase(atts.getValue("align"))) {
                 newAtts.addMapping("align", "middle");
             }

Modified: cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java
URL: http://svn.apache.org/viewvc/cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java?rev=1496595&r1=1496594&r2=1496595&view=diff
==============================================================================
--- cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java (original)
+++ cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java Tue Jun 25 19:11:55 2013
@@ -231,7 +231,9 @@ public class SiteExporter implements Run
         Page p = findPage(s);
         if (p != null) {
             pages.remove(p.getId());
-            modifiedPages.add(p);
+            if (!modifiedPages.contains(p)) {
+                modifiedPages.add(p);
+            }
         }
     }
     
@@ -311,7 +313,7 @@ public class SiteExporter implements Run
         if (!modifiedBlog.isEmpty()) {
             //blogs changed, see if any pages have blogs
             for (Page p : pages.values()) {
-                if (p.hasBlog()) {
+                if (p.hasBlog() && !modifiedPages.contains(p)) {
                     modifiedPages.add(p);
                 }
             }
@@ -1030,7 +1032,9 @@ public class SiteExporter implements Run
                     page.setExporter(SiteExporter.this);
                     Page oldPage = pages.put(page.getId(), page);
                     if (oldPage == null || page.getModifiedTime().compare(oldPage.getModifiedTime())
> 0) {
-                        modifiedPages.add(page);
+                        if (!modifiedPages.contains(page)) {
+                            modifiedPages.add(page);
+                        }
                         if (oldPage == null) {
                             //need to check parents to see if it has a {children} tag so
we can re-render
                             newPages.add(page);
@@ -1058,6 +1062,14 @@ public class SiteExporter implements Run
         content = w.toString();
         content = content.substring("<html><body>".length());
         content = content.substring(0, content.lastIndexOf("</body></html>"));
+        
+        int idx = content.indexOf('>');
+        if (idx != -1
+            && content.substring(idx + 1).startsWith("<p></p>")) {
+            //new confluence tends to stick an empty paragraph at the beginning for some
pages (like Banner)
+            //that causes major formatting issues.  Strip it.
+            content = content.substring(0, idx) + content.substring(idx + 8);
+        }
         return content;
     }
     protected XMLReader createTagSoupParser() throws Exception {
@@ -1191,5 +1203,12 @@ public class SiteExporter implements Run
     public int getAPIVersion() {
         return apiVersion;
     }
+
+    public String stripHost(String value) {
+        if (value.startsWith(HOST)) {
+            value = value.substring(HOST.length());
+        }
+        return value;
+    }
     
 }



Mime
View raw message