geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r515634 - /geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/exportspace.groovy
Date Wed, 07 Mar 2007 16:21:46 GMT
Author: jdillon
Date: Wed Mar  7 08:21:44 2007
New Revision: 515634

URL: http://svn.apache.org/viewvc?view=rev&rev=515634
Log:
Add more filters to hack things into place for testing

Modified:
    geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/exportspace.groovy

Modified: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/exportspace.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/exportspace.groovy?view=diff&rev=515634&r1=515633&r2=515634
==============================================================================
--- geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/exportspace.groovy
(original)
+++ geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/exportspace.groovy
Wed Mar  7 08:21:44 2007
@@ -77,6 +77,11 @@
             
             def exporter = new SpaceExporter(client, engine)
             
+            //
+            // HACK: Adding very specific filters here... need to make this
+            //       configurable
+            //
+            
             // Hook up a filter to translate links for this space
             exporter.filters << new RegexSearchReplaceFilter(
                 '"' + "/confluence/display/$space/(.*?)" + '"',
@@ -96,6 +101,43 @@
                 '"' + "/confluence/images/(.*?)" + '"',
                 { matcher, ctx ->
                     return '"' + "http://geronimo.apache.org/images/" + matcher.group(1)
+ '"'
+                })
+            
+            // Translate attachments to local page attachements
+            exporter.filters << new RegexSearchReplaceFilter(
+                '"' + "/confluence/download/attachments/(.*?)/(.*?)" + '"',
+                { matcher, ctx ->
+                    def filename = matcher.group(2)
+                    def href = ctx.page.title.toLowerCase().replace(' ', '-') + '.attach/'
+ filename
+                    
+                    // Special handling for news pages, link back to export root 3 deep
+                    if (ctx.page.publishDate) {
+                        href = "../../../$href"
+                    }
+                    
+                    return '"' + href + '"'
+                })
+            
+            // Translate all space refs (w/pages) to cwiki
+            exporter.filters << new RegexSearchReplaceFilter(
+                '"' + "/confluence/display/(.*?)/(.*?)" + '"',
+                { matcher, ctx ->
+                    def page = matcher.group(2).replaceAll('\\+','-').toLowerCase() + '.html'
+                    return '"http://cwiki.apache.org/$1/' + page + '"'
+                })
+            
+            // Translate all space refs (wo/pages) to cwiki
+            exporter.filters << new RegexSearchReplaceFilter(
+                '"' + "/confluence/display/[^~](.*?)" + '"',
+                { matcher, ctx ->
+                    return '"http://cwiki.apache.org/$1"'
+                })
+            
+            // Force everything else over to cwiki/confluence
+            exporter.filters << new RegexSearchReplaceFilter(
+                '"' + "/confluence/(.*?)" + '"',
+                { matcher, ctx ->
+                    return '"http://cwiki.apache.org/confluence/$1"'
                 })
             
             // Add a filter to warn about /confluence URLS



Mime
View raw message