Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 68397E9B0 for ; Tue, 25 Jun 2013 19:12:18 +0000 (UTC) Received: (qmail 68155 invoked by uid 500); 25 Jun 2013 19:12:16 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 68098 invoked by uid 500); 25 Jun 2013 19:12:16 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 68070 invoked by uid 99); 25 Jun 2013 19:12:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jun 2013 19:12:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jun 2013 19:12:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 59FE12388A6E; Tue, 25 Jun 2013 19:11:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130625191156.59FE12388A6E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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("".length()); content = content.substring(0, content.lastIndexOf("")); + + int idx = content.indexOf('>'); + if (idx != -1 + && content.substring(idx + 1).startsWith("

")) { + //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; + } }