12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #!/bin/sh
- template() {
- cat <<EOF
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>toymaker</title>
- <style>
- * {
- box-sizing: border-box;
- }
- a {
- color: #00afff;
- }
- a:hover {
- background-color: #db9d3b;
- color: #000000;
- }
- </style>
- </head>
- <body style="background-color: #292929; color: #fafafa;">
- <header style="font-size: 1.25rem; padding-top: .3125rem; padding-bottom: .3125rem;">
- <a href="/toys/" style="font-family: monospace; text-decoration: none;">toymaker</a>
- </header>
- <main style="margin-left: 1rem; margin-top: 2rem;">
- <ul>
- EOF
- for toy in $1
- do
- printf '\t\t\t\t<li>\n'
- status=$(echo "$toy" | cut -d ';' -f1)
- name=$(echo "$toy" | cut -d ';' -f2)
- if [ "$status" = '0' ]
- then
- printf '\t\t\t\t\t<span style="color: #5af78e; font-size: .75rem; margin-right: .5rem;">OK</span>\n'
- elif [ "$status" = 'n' ]
- then
- printf '\t\t\t\t\t<span style="font-size: .75rem; margin-right: .5rem;">N_</span>\n'
- elif [ "$status" = 'r' ]
- then
- printf '\t\t\t\t\t<span style="font-size: .75rem; margin-right: .5rem;">R_</span>\n'
- else
- printf '\t\t\t\t\t<span style="color: #ff5c57; font-size: .75rem; margin-right: .5rem;">ER</span>\n'
- fi
- printf '\t\t\t\t\t<a href="/toys/%s"><span style="font-size: 1.5rem;">%s</span></a>\n' "$name" "$name"
- printf '\t\t\t\t</li>\n'
- done
- cat <<EOF
- </ul>
- </main>
- </body>
- </html>
- EOF
- }
|