geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r515615 - in /geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey: commands/exportspace.groovy exporter/filters/RegexWarnFilter.groovy
Date Wed, 07 Mar 2007 15:45:56 GMT
Author: jdillon
Date: Wed Mar  7 07:45:55 2007
New Revision: 515615

URL: http://svn.apache.org/viewvc?view=rev&rev=515615
Log:
Add a warning filter, warn about all "/confluence/.*" quoted strings in exported pages

Added:
    geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/filters/RegexWarnFilter.groovy
  (with props)
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=515615&r1=515614&r2=515615
==============================================================================
--- 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 07:45:55 2007
@@ -27,6 +27,7 @@
 import hokeypokey.exporter.SpaceExporter
 import hokeypokey.exporter.TemplateEngine
 import hokeypokey.exporter.filters.RegexSearchReplaceFilter
+import hokeypokey.exporter.filters.RegexWarnFilter
 
 /**
  * Do the Hokey Pokey!
@@ -91,6 +92,11 @@
                     
                     return '"' + href + '"'
                 })
+            
+            //
+            // HACK: Add a filter to warn about /confluence URLS
+            //
+            exporter.filters << new RegexWarnFilter('"/confluence/.*?"')
             
             exporter.export(space)
         }

Added: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/filters/RegexWarnFilter.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/filters/RegexWarnFilter.groovy?view=auto&rev=515615
==============================================================================
--- geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/filters/RegexWarnFilter.groovy
(added)
+++ geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/filters/RegexWarnFilter.groovy
Wed Mar  7 07:45:55 2007
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// $Id$
+//
+
+package hokeypokey.exporter.filters
+
+import hokeypokey.exporter.Filter
+import hokeypokey.exporter.FilterContext
+
+import java.util.regex.Pattern
+
+/**
+ * Do the Hokey Pokey!
+ */
+class RegexWarnFilter
+    extends Filter
+{
+    def from
+    
+    def RegexWarnFilter(from) {
+        assert from
+        
+        this.from = from
+    }
+    
+    def filter(FilterContext ctx, Reader reader, PrintWriter writer) {
+        assert reader
+        assert writer
+        
+        def p = Pattern.compile(from)
+        
+        reader.eachLine { line ->
+            def m = p.matcher(line)
+            
+            if (m.find()) {
+                def tmp = m.group()
+                println "WARN: Found: $tmp"
+            }
+            
+            writer.println(line)
+        }
+    }
+}
+

Propchange: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/filters/RegexWarnFilter.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/filters/RegexWarnFilter.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/exporter/filters/RegexWarnFilter.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message