Skip to content

Commit 332aff9

Browse files
committed
print index per version
1 parent 99c65a8 commit 332aff9

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

.github/motives.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,36 @@ while IFS= read -r f; do
4040
echo "${n} -> $(du -b "${html}" | cut -f1) bytes"
4141
done < <(find src/main/resources/org/eolang/motives -name '*.md')
4242

43-
(
44-
printf '<html><body style="font-family: monospace;">\n'
45-
printf '<p>Latest version: %s</p>\n' "${tag}"
46-
printf '<p>List of lints in this version<p>'
43+
function list_them() {
4744
printf "<ul>\n"
4845
while IFS= read -r f; do
4946
n=$(basename "${f}" ".html")
5047
printf '<li><a href="%s">%s</a></li>\n' \
5148
"/lints/${tag}/${n}.html" "${n}"
5249
done < <(find "gh-pages/${tag}" -name '*.html' | sort)
5350
printf '</ul>\n'
51+
}
52+
53+
function head() {
54+
printf '<html><body style="font-family: monospace;">\n'
55+
}
56+
57+
function tail() {
5458
printf '<p>Published on %s.</p>\n' "$(date)"
5559
printf '</body></html>'
60+
}
61+
62+
(
63+
head
64+
printf '<p>Latest version: <a href="/lints/%s/index.html">%s</a></p>\n' "${tag}" "${tag}"
65+
printf '<p>List of lints in this version:<p>'
66+
list_them
67+
tail
5668
) > "gh-pages/index.html"
69+
70+
(
71+
head
72+
printf "<p>List of lints in %s:<p>" "${tag}"
73+
list_them
74+
tail
75+
) > "gh-pages/${tag}/index.html"

0 commit comments

Comments
 (0)