~chambln/cosine.blue

ref: 8de164183d797cab59e3161d2f5c326da1186e30 cosine.blue/src/index.html.sh -rw-r--r-- 1.5 KiB
8de16418Gregory Chamberlain Add sp5.jpg cover photo for with-package article 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

# cosine.blue -- static site generator
# Copyright (C) 2020  Gregory L Chamberlain <greg@cosine.blue>

# This file is part of cosine.blue.
#
# cosine.blue is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cosine.blue is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cosine.blue.  If not, see
# <https://www.gnu.org/licenses/>.

. share/lib.sh

x h2 Recently

find src/article -type f | sort -r | head -n3 | while IFS= read -r item
do
    [ -f "$item" ] || continue
    basename=${item##*/}
    case $item in
        *.md) href=${basename%.md}.html ;;
        *.md.sh) href=${basename%.md.sh}.html ;;
        *.html.sh) href=${basename%.sh} ;;
        *) href=$basename ;;
    esac
    href="${basename%%.*}.html"
    :|(
        . env/"$basename".sh
        x "a href=\"$href\"" "$title" | x h2
        [ "$description" ] && x p "$description"
    ) | x li
done | x 'ol id="recently" reversed'

x 'a href="/archive.html"' 'More posts →' | x 'p id="archive"'

x h2 Resources

cmark <<EOF
- [Recommended Hardware And Software](/recommended.html)
EOF