This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/attic-docker.git


The following commit(s) were added to refs/heads/main by this push:
     new 538547c  Allow for Javadoc frames
538547c is described below

commit 538547c432b02912baf013474a7a4471ec49b5ae
Author: Sebb <s...@apache.org>
AuthorDate: Wed Mar 26 15:18:38 2025 +0000

    Allow for Javadoc frames
---
 config/attic_filter.lua | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/config/attic_filter.lua b/config/attic_filter.lua
index 7964c3a..1e52eb4 100644
--- a/config/attic_filter.lua
+++ b/config/attic_filter.lua
@@ -1,7 +1,7 @@
 --[[
   This is an output filter for HTML files
   It adds a banner for projects that are flagged as in the attic.
-  
+
   It is invoked by the tlp vhosts if the following directory exists:
   /var/www/attic.apache.org/flagged/%{HTTP_HOST}
 
@@ -26,7 +26,7 @@
     - repeat until a suitable location is found and find a tag or other string 
that uniquely identifies it
     - add the host-specific processing to the filter along the lines of the 
existing host exceptions
 
-  Note: This filter was introduced in April 2018, so not all projects in the 
Attic use this filter. 
+  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.
 ]]--
 
@@ -53,6 +53,14 @@ function output_filter(r)
         Attic page</a>.
       </div>]]):format(divstyle, astyle, host)
 
+    -- Javadoc uses frames, so link needs to open in new page
+    local divnew = ([[
+      <div style='%s'>
+        This project has retired. For details please refer to its
+        <a style='%s' href="https://attic.apache.org/projects/%s.html"; 
target="_blank">
+        Attic page</a>.
+      </div>]]):format(divstyle, astyle, host)
+
     -- add header:
     -- special processing needed for some hosts
     if host == 'predictionio' or host == 'eagle' or host == 'metamodel' or 
host == 'mxnet' or host == 'twill'
@@ -66,16 +74,18 @@ function output_filter(r)
     while bucket ~= nil do
         -- special processing needed for hosts as above
         if host == 'predictionio'
-        then    
+        then
             local output = bucket:gsub('<header>', '<header>'..div, 1)
             coroutine.yield(output)
         elseif host == 'mxnet'
-        then    
+        then
             local output = bucket:gsub('</header>', div..'</header>', 1)
             coroutine.yield(output)
         elseif host == 'twill'
-        then    
-            local output = bucket:gsub('</header>', div..'</header>', 
1):gsub('<div class="topNav">', div..'<div class="topNav">', 1)
+        then
+            -- Fix for Javadocs: </header> does not appear in them, and
+            -- topNav only appears in the Javadoc pages that can take the div 
without failing
+            local output = bucket:gsub('</header>', div..'</header>', 
1):gsub('<div class="topNav">', divnew..'<div class="topNav">', 1)
             coroutine.yield(output)
         elseif host == 'eagle'
         then
@@ -83,7 +93,7 @@ function output_filter(r)
             coroutine.yield(output)
         elseif host == 'metamodel'
         then
-            local output = bucket:gsub('</nav>', div..'</nav>', 1)
+            local output = bucket:gsub('</nav>', div..'</nav>', 1):gsub('<div 
class="topNav">', divnew..'<div class="topNav">', 1)
             coroutine.yield(output)
         else
             coroutine.yield(bucket)

Reply via email to