Author: buildbot
Date: Sat Dec 16 13:47:53 2023
New Revision: 1914714
URL: http://svn.apache.org/viewvc?rev=1914714&view=rev
Log:
Automatic Site Publish by Buildbot
Modified:
attic/site/docs/scripts/attic_filter.lua
Modified: attic/site/docs/scripts/attic_filter.lua
URL:
http://svn.apache.org/viewvc/attic/site/docs/scripts/attic_filter.lua?rev=1914714&r1=1914713&r2=1914714&view=diff
==============================================================================
--- attic/site/docs/scripts/attic_filter.lua (original)
+++ attic/site/docs/scripts/attic_filter.lua Sat Dec 16 13:47:53 2023
@@ -6,26 +6,7 @@
/var/www/attic.apache.org/flagged/%{HTTP_HOST}
See the tlp vhost definitions in
https://github.com/apache/infrastructure-p6/blob/production/data/roles/tlpserver.yaml
-
- The mod_lua API is described here:
- https://httpd.apache.org/docs/current/mod/mod_lua.html#modifying_buckets
-
- How it works:
- For simplicity, we add the banner to the start of the page.
-
- This is not really valid HTML, but seems to work in most cases, and avoids
having to find a better
- place to insert it. It does not work for some hosts, especially those that
have a static menu bar
- with scrolling content. In such cases, the code looks for a specific tag
(which should only occur once
- in any of the site pages, otherwise two banners may be added) and adds the
banner either before or after it.
-
- The best location for this is found by trial and error:
- - download a copy of a page
- - move the banner from the start of the page (where it is added by
default) and try it in various
- other parts of the page.
- - try the same in some other pages that have a different layout.
- - 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.
Previously the project websites themselves were changed.
]]--
@@ -34,11 +15,11 @@ function output_filter(r)
-- We only filter text/html types
if not r.content_type:match("text/html") then return end
+ -- add header:
-- get TLP part of hostname
local host = r.hostname:match("^([^.]+)")
- -- create the customised banner
- local divstyle =
'font-size:x-large;padding:15px;color:white;background:red;z-index:99;' ;
+ local divstyle =
'font-size:x-large;padding:15px;color:white;background:red;z-index: 99;' ;
local astyle = 'color:white;text-decoration:underline' ;
local div = ([[
<div style='%s'>
@@ -47,7 +28,6 @@ function output_filter(r)
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'
then
@@ -55,9 +35,8 @@ function output_filter(r)
else
coroutine.yield(div)
end
-
-- spit out the actual page
- while bucket ~= nil do
+ while bucket do
-- special processing needed for hosts as above
if host == 'predictionio'
then
@@ -80,6 +59,4 @@ function output_filter(r)
end
end
- -- no need to add anything at the end of the content
-
end