You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@attic.apache.org by se...@apache.org on 2020/11/28 16:25:17 UTC

svn commit: r1883900 - /attic/site/xdocs/scripts/attic_filter.lua

Author: sebb
Date: Sat Nov 28 16:25:17 2020
New Revision: 1883900

URL: http://svn.apache.org/viewvc?rev=1883900&view=rev
Log:
ATTIC-189 - 'Retired' banner does not work for some sites

Modified:
    attic/site/xdocs/scripts/attic_filter.lua

Modified: attic/site/xdocs/scripts/attic_filter.lua
URL: http://svn.apache.org/viewvc/attic/site/xdocs/scripts/attic_filter.lua?rev=1883900&r1=1883899&r2=1883900&view=diff
==============================================================================
--- attic/site/xdocs/scripts/attic_filter.lua (original)
+++ attic/site/xdocs/scripts/attic_filter.lua Sat Nov 28 16:25:17 2020
@@ -9,6 +9,9 @@
   
   Note: This filter was introduced in April 2018, so not all projects in the Attic use this filter. 
   Previously the project websites themselves were changed.
+  
+  The following describes how to code Lua filters:
+  https://httpd.apache.org/docs/trunk/mod/mod_lua.html#modifying_buckets
 ]]--
 
 function output_filter(r)
@@ -22,15 +25,18 @@ function output_filter(r)
     local name = host:gsub("^%l", string.upper)
     local sty1 = 'font-size:x-large;padding:15px;color:white;background:red;' ;
     local sty2 = 'color:white;text-decoration:underline' ;
-    coroutine.yield ( ([[
-      <div style='%s'>
-        Project <i>%s</i> has retired. For details please refer to its
-        <a style='%s' href="https://attic.apache.org/projects/%s.html">
-        Attic page</a>.
-      </div>]]):format(sty1, name, sty2, host) )
+    local bodydiv = ([[<body>
+    <div style='%s'>
+      Project <i>%s</i> has retired. For details please refer to its
+      <a style='%s' href="https://attic.apache.org/projects/%s.html">
+      Attic page</a>.
+    </div>
+    ]]):format(sty1, name, sty2, host)
+    -- intial output
+    coroutine.yield('') -- required
     -- spit out the actual page
     while bucket do
-        coroutine.yield(bucket)
+        local output=bucket:gsub("<body>", bodydiv, 1)
+        coroutine.yield(output)
     end
-
 end