Skip to content

Commit

Permalink
print index per version
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Feb 6, 2025
1 parent 99c65a8 commit 332aff9
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions .github/motives.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,36 @@ while IFS= read -r f; do
echo "${n} -> $(du -b "${html}" | cut -f1) bytes"
done < <(find src/main/resources/org/eolang/motives -name '*.md')

(
printf '<html><body style="font-family: monospace;">\n'
printf '<p>Latest version: %s</p>\n' "${tag}"
printf '<p>List of lints in this version<p>'
function list_them() {
printf "<ul>\n"
while IFS= read -r f; do
n=$(basename "${f}" ".html")
printf '<li><a href="%s">%s</a></li>\n' \
"/lints/${tag}/${n}.html" "${n}"
done < <(find "gh-pages/${tag}" -name '*.html' | sort)
printf '</ul>\n'
}

function head() {
printf '<html><body style="font-family: monospace;">\n'
}

function tail() {
printf '<p>Published on %s.</p>\n' "$(date)"
printf '</body></html>'
}

(
head
printf '<p>Latest version: <a href="/lints/%s/index.html">%s</a></p>\n' "${tag}" "${tag}"
printf '<p>List of lints in this version:<p>'
list_them
tail
) > "gh-pages/index.html"

(
head
printf "<p>List of lints in %s:<p>" "${tag}"
list_them
tail
) > "gh-pages/${tag}/index.html"

0 comments on commit 332aff9

Please sign in to comment.