summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-05-29 18:41:55 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2017-05-29 18:41:55 +0200
commitbd4e529b57b3a70248845c48e4f54e3ec46b8035 (patch)
treeab2226f6f43b3d37242a34b70add2db5f88b63db
parented5b2c1bc595a5fe2e64071c5998193607e4c924 (diff)
downloadalpine-mksite-bd4e529b57b3a70248845c48e4f54e3ec46b8035.tar.bz2
alpine-mksite-bd4e529b57b3a70248845c48e4f54e3ec46b8035.tar.xz
downloads: refactor ordering
There are no way to predict the order in which lua will iterate over a hashtable so we use an array instead. We also set a fixed number of colors which we pick insstead of hardcode the flavor name in the CSS. This is so we can change name of the flavors without needing to modify the CSS.
-rw-r--r--_scripts/generate_releases.lua54
-rw-r--r--_static/css/styles.css15
-rw-r--r--downloads/index.md4
3 files changed, 41 insertions, 32 deletions
diff --git a/_scripts/generate_releases.lua b/_scripts/generate_releases.lua
index c064f74..637322d 100644
--- a/_scripts/generate_releases.lua
+++ b/_scripts/generate_releases.lua
@@ -6,63 +6,64 @@ url_prefix="https://nl.alpinelinux.org/alpine"
t = { flavors={} }
flavor_def = {
- ["alpine-standard"] = {
+ {
+ flavor = "alpine-standard",
title = "Standard",
desc = {
"Alpine as it was intended",
"Just enough to get you started",
"Network connection recommended",
},
- },
- ["alpine-extended"] = {
+ }, {
+ flavor = "alpine-extended",
title = "Extended",
desc = {
"Most common used packages included",
"Suitable for routers and servers",
"Runs from RAM",
},
- },
- ["alpine-vanilla"] = {
+ }, {
+ flavor = "alpine-vanilla",
title = "Vanilla",
desc = {
"Includes a vanilla kernel",
"Does not include grsec patch set",
"Suitable for debugging",
},
- },
- ["alpine-virt"] = {
+ }, {
+ flavor = "alpine-virt",
title = "Virtual",
desc = {
"Similar to standard",
"Slimmed down kernel",
"Optimized for virtual systems",
},
- },
- ["alpine-xen"] = {
+ }, {
+ flavor = "alpine-xen",
title = "Xen",
desc = {
"Build-in support for Xen Hypervisor",
"Includes packages targed at Xen usage",
"Includes grsec kernel",
},
- },
- ["alpine-minirootfs"] = {
+ }, {
+ flavor = "alpine-minirootfs",
title = "Mini root filesystem",
desc = {
"Minimal root filesystem",
"For use in containers",
"and minimal chroots",
},
- },
- ["alpine-rpi"] = {
+ }, {
+ flavor = "alpine-rpi",
title = "Raspberry Pi",
desc = {
"Includes Raspberry Pi kernel",
"Does not include grsec patchset",
"And much more...",
},
- },
- ["alpine-uboot"] = {
+ }, {
+ flavor = "alpine-uboot",
title = "Generic ARM",
desc = {
"Has default ARM kernel",
@@ -72,6 +73,14 @@ flavor_def = {
}
}
+-- number of different colors for flavors in CSS
+num_colors = 7
+
+flavor_index = {}
+for i,f in pairs(flavor_def) do
+ flavor_index[f.flavor] = i
+end
+
for i = 1,#arg do
local f = assert(io.open(arg[i]))
@@ -86,25 +95,26 @@ for i = 1,#arg do
v.sig_url = ("%s.sig"):format(v.iso_url)
v.size_mb=math.floor(v.size/(1024*1024))
-
- local flavor = t[v.flavor]
+ local n = flavor_index[v.flavor]
+ local flavor = t.flavors[n]
if flavor == nil then
- local def = flavor_def[v.flavor] or {title="", desc=""}
+ local def = flavor_def[n] or {title="", desc=""}
flavor = {
archs = {},
flavor_title = def.title,
flavor_desc = def.desc,
flavor_name = string.lower(v.flavor),
+ flavor_color = (flavor_index[v.flavor]-1) % num_colors
}
- table.insert(t.flavors, flavor)
+ t.flavors[n] = flavor
end
- flavor[v.arch] = v
+-- flavor[v.arch] = v
table.insert(flavor.archs, v)
- t[v.flavor] = flavor
+-- t[v.flavor] = flavor
end
end
-- default release
-t.default = t["alpine-standard"].x86_64
+t.default = t.flavors[1].archs[1]
io.write(lyaml.dump{t})
diff --git a/_static/css/styles.css b/_static/css/styles.css
index 46e925c..a81e2f5 100644
--- a/_static/css/styles.css
+++ b/_static/css/styles.css
@@ -366,14 +366,13 @@ footer a { color: #ddd; }
* http://www.colourlovers.com/home/trends/interior-looks/7760/Dive_Into_Color
*/
-.flavor-alpine-standard h2 { background: #CBB063; }
-.flavor-alpine-extended h2 { background: #AA8B4A; }
-.flavor-alpine-vanilla h2 { background: #3C2C1F; }
-.flavor-alpine-virt h2 { background: #B63731; }
-.flavor-alpine-xen h2 { background: #E68804; }
-.flavor-alpine-rpi h2 { background: #376160; }
-.flavor-alpine-uboot h2 { background: #36384D; }
-.flavor-alpine-minirootfs h2 { background: #36384D; }
+.flavor-color-0 h2 { background: #CBB063; }
+.flavor-color-1 h2 { background: #AA8B4A; }
+.flavor-color-2 h2 { background: #3C2C1F; }
+.flavor-color-3 h2 { background: #B63731; }
+.flavor-color-4 h2 { background: #E68804; }
+.flavor-color-5 h2 { background: #376160; }
+.flavor-color-6 h2 { background: #36384D; }
/*
* MEDIA queries
diff --git a/downloads/index.md b/downloads/index.md
index f5167f3..4876876 100644
--- a/downloads/index.md
+++ b/downloads/index.md
@@ -13,7 +13,7 @@
{{#releases.flavors}}
<div class="pure-u-1 pure-u-md-1-2">
- <div class="download flavor-{{flavor_name}}">
+ <div class="download flavor-color-{{flavor_color}}">
<h2>{{flavor_title}}</h2>
<div class="features">
<ul>
@@ -25,7 +25,7 @@
<div class="buttons">
{{#archs}}
<a class="pure-button" href="{{iso_url}}">
- <i class="fa fa-download"></i>
+ <i class="fa fa-download"></i>
{{arch}}
</a>
{{/archs}}