geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r515528 - in /geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter: PageFinder.groovy SpaceExporter.groovy
Date Wed, 07 Mar 2007 10:51:01 GMT
Author: jdillon
Date: Wed Mar  7 02:51:00 2007
New Revision: 515528

URL: http://svn.apache.org/viewvc?view=rev&rev=515528
Log:
Use closures for helpers, they kick ass... basic export now functional except for the bread-crumbs

Removed:
    geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/PageFinder.groovy
Modified:
    geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/SpaceExporter.groovy

Modified: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/SpaceExporter.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/SpaceExporter.groovy?view=diff&rev=515528&r1=515527&r2=515528
==============================================================================
--- geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/SpaceExporter.groovy
(original)
+++ geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/SpaceExporter.groovy
Wed Mar  7 02:51:00 2007
@@ -53,32 +53,35 @@
         
         def pages = client.getPages(space.key)
         
-        // Export each page with the clean style (no html preamble/style muck)
-        def renderParams = [ style: 'clean' ]
-        
         outputDirectory.mkdirs()
         
+        def renderPage = { page ->
+            assert page
+            
+            return client.renderContent(page.space, page.id, '', [ style: 'clean' ])
+        }
+        
+        def findPage = { title ->
+            assert title
+            
+            for (page in pages) {
+                if (title == page.title) {
+                    return page
+                }
+            }
+        }
+        
         pages.each { page ->
             println page
             
-            def body = client.renderContent(page.space, page.id, '', renderParams)
+            def body = renderPage(page)
             
             template.params.body = body
             template.params.space = space
             template.params.page = page
             
-            //
-            // NOTE: May want to set this for AE compatiblity
-            //
-            //       template.params.page.space = space
-            //
-            
-            // Helper to find pages
-            template.params.pageFinder = new PageFinder(client, pages)
-            
-            //
-            // TODO: Add render helper
-            //
+            template.params.findPage = findPage
+            template.params.renderPage = renderPage
             
             def fileName = page.title.toLowerCase().replace(' ', '-') + '.html'
             def file = new File(outputDirectory, fileName)



Mime
View raw message