Randomly order organisation donation links too

This commit is contained in:
TEC 2022-10-17 23:32:39 +08:00
parent 98a1cd0ba5
commit 7d741972d7
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
2 changed files with 36 additions and 36 deletions

View File

@ -182,7 +182,15 @@ function submit(forminfo::Dict; backpage::Bool=false)
end end
end end
const DONATION_INDIVIDUALS = [ const DONATION_ENTITIES = [
("https://my.fsf.org/donate",
"The Free Software Foundation",
"https://www.fsf.org/",
"principle organisational sponsor of the GNU project"),
("https://liberapay.com/org-mode/",
"The Org Project",
"https://orgmode.org",
["org-mode" => "https://orgmode.org"]),
("https://liberapay.com/hlissner/", ("https://liberapay.com/hlissner/",
"Henrik Lissner", "hlissner", "Henrik Lissner", "hlissner",
["Doom Emacs" => "doomemacs/doomemacs", "assorted packages"]), ["Doom Emacs" => "doomemacs/doomemacs", "assorted packages"]),
@ -217,20 +225,7 @@ const DONATION_INDIVIDUALS = [
["this survey", "a few other things"]) ["this survey", "a few other things"])
] ]
function donationlinks() donationlinks() = donate_spec_to_link.(shuffle(DONATION_ENTITIES))
donate_org = ("https://liberapay.com/org-mode/",
"The Org Project",
"https://orgmode.org",
["org-mode" => "https://orgmode.org"])
donate_fsf = ("https://my.fsf.org/donate",
"The Free Software Foundation",
"https://www.fsf.org/",
["an assortment of projects"])
donate_specs = vcat(donate_org,
shuffle(DONATION_INDIVIDUALS),
donate_fsf)
donate_spec_to_link.(donate_specs)
end
function donate_spec_to_link((link, name, site, projects)) function donate_spec_to_link((link, name, site, projects))
string("<li><a href=\"$link\"><b>Donate to</b></a> ", string("<li><a href=\"$link\"><b>Donate to</b></a> ",
@ -246,26 +241,30 @@ function donate_spec_to_link((link, name, site, projects))
style=\"color: var(--secondary)\" \ style=\"color: var(--secondary)\" \
title=\"GitHub profile\">@$site</a>" title=\"GitHub profile\">@$site</a>"
end, end,
" (responsible for ", if projects isa String
join(map(projects) do proj " ($projects"
if proj isa String else
proj " (responsible for " *
elseif proj isa Pair{String,String} join(map(projects) do proj
string("<a href=\"", if proj isa String
if occursin("http", proj[2]) proj
proj[2] elseif proj isa Pair{String,String}
elseif occursin("/", proj[2]) string("<a href=\"",
"https://github.com/$(proj[2])" if occursin("http", proj[2])
elseif !isnothing(site) proj[2]
"https://github.com/$site/$(proj[2])" elseif occursin("/", proj[2])
end, "https://github.com/$(proj[2])"
"\" target=\"_blank\" title=\"Project page\" \ elseif !isnothing(site)
style=\"color: var(--h1-color)\">", "https://github.com/$site/$(proj[2])"
proj[1], "</a>") end,
else "\" target=\"_blank\" title=\"project page\" \
"" style=\"color: var(--h1-color)\">",
end proj[1], "</a>")
end, ", ", ", and "), else
""
end
end, ", ", ", and ")
end,
")</li>") ")</li>")
end end

View File

@ -22,7 +22,8 @@
the work they do and helps people find and justify the time they spend the work they do and helps people find and justify the time they spend
improving the state of Emacs' ecosystem.</p> improving the state of Emacs' ecosystem.</p>
<p>Should this sound like something you would be interested in, here <p>Should this sound like something you would be interested in, here
is a small selection of donation links that may be of interest.</p> is a small (randomly ordered) selection of donation links that may be of
interest.</p>
<ul> <ul>
$(join(donateitems, '\n')) $(join(donateitems, '\n'))
</ul> </ul>