1 -- This script may be used with the email-filter or repo.email-filter settings in cgitrc.
2 -- It adds libravatar icons to author names. It is designed to be used with the lua:
7 -- <http://25thandclement.com/~william/projects/luaossl.html>
10 local digest = require("openssl.digest")
12 function md5_hex(input)
13 local b = digest.new("md5"):final(input)
16 x = x .. string.format("%.2x", string.byte(b, i))
21 function filter_open(email, page)
23 md5 = md5_hex(email:sub(2, -2):lower())
26 function filter_close()
27 baseurl = os.getenv("HTTPS") and "https://seccdn.libravatar.org/" or "http://cdn.libravatar.org/"
28 html("<img src='" .. baseurl .. "avatar/" .. md5 .. "?s=13&d=retro' width='13' height='13' alt='Libravatar' /> " .. buffer)
32 function filter_write(str)
33 buffer = buffer .. str