summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-04-19 14:10:59 -0500
committerCase Duckworth2024-04-19 14:10:59 -0500
commitbc5d01c53a97d8cb652f87b16a63e0e258a051ab (patch)
treee25f7b0bda24f94e34434700a2250382f3a15441
parentUpdate base_url (diff)
downloadll-bc5d01c53a97d8cb652f87b16a63e0e258a051ab.tar.gz
ll-bc5d01c53a97d8cb652f87b16a63e0e258a051ab.zip
2024-04-19 main
-rw-r--r--good-soups.ul13
-rwxr-xr-xll100
-rw-r--r--ok2
-rw-r--r--titles-of-poems.ul3
-rw-r--r--what-i-had-for-lunch-today.ol7
-rw-r--r--why-dont-i-blog.ul17
6 files changed, 98 insertions, 44 deletions
diff --git a/good-soups.ul b/good-soups.ul new file mode 100644 index 0000000..1cd1357 --- /dev/null +++ b/good-soups.ul
@@ -0,0 +1,13 @@
1good soups
2
3minestrone
4miso
5tomato
6borscht (veggie)
7mulligatawny (in name only)
8chili (with beans, fight me)
9ramen noodle
10pho
11hell, any noodle
12ice water
13the kind with croutons in \ No newline at end of file
diff --git a/ll b/ll index 6ce90db..da9da55 100755 --- a/ll +++ b/ll
@@ -7,26 +7,35 @@ SITE_COPYRIGHT="Case Duckworth"
7BACK_LINK=index.html,back 7BACK_LINK=index.html,back
8 8
9wrap() { 9wrap() {
10 title="$(sed 1q "$1")" 10 title="$(sed 1q "$1")"
11 cat <<HEAD 11 cat <<HEAD
12<!DOCTYPE html> 12<!DOCTYPE html>
13<meta charset="utf8">
14<meta name="viewport" content="width=device-width, initial-scale=1">
13<title>$title</title> 15<title>$title</title>
14<style> 16<style>
15body{max-width:48em;font:20px/1.4 serif;margin:auto;padding:1em;} 17body{max-width:48em;font:20px/1.4 serif;margin:auto;padding:1em;
16footer{position:absolute;bottom:0;left:0;padding:1em;background:white;} 18margin-bottom:4em;}
19footer{position:fixed;bottom:0;left:0;padding:1em;background:white;}
17dt{font-weight:bold;} 20dt{font-weight:bold;}
18</style> 21</style>
19<body> 22<body>
20<!-- LIST_START --> 23<!-- LIST_START -->
21<h1>$title</h1> 24<h1>$title</h1>
22HEAD 25HEAD
23 cat 26 cat
24 cat <<FOOT 27 cat <<FOOT
25<!-- LIST_END --> 28<!-- LIST_END -->
26<footer> 29<footer>
27$(test "$2" && printf '<a href="%s">%s</a>' "${2%%,*}" "${2##*,}") 30$(test "$2" && printf '<a href="%s">%s</a>' "${2%%,*}" "${2##*,}")
28$(case "$1" in (*index*) printf '<a href="%s">%s</a>' \ 31$(case "$1" in (*index*)
29 "$BASE_URL/feed.xml" feed ;; esac) 32 echo '<ul style="margin:0;padding:0;">'
33 printf '<li style="list-style:none;margin:0"><a href="%s">%s</a></li>\n' \
34 "$BASE_URL/feed.xml" feed \
35 "https://git.acdw.net/ll" source \
36 "https://www.acdw.net" home
37 echo "</ul>"
38 ;; esac)
30</footer> 39</footer>
31</body></html> 40</body></html>
32FOOT 41FOOT
@@ -44,7 +53,7 @@ al()(list ul -F"\n" -vRS= '{printf "<li><a href=\"%s\">%s</a></li>\n",$1,$2}')
44dl()(list dl -F"\n" -vRS= '{printf "<dt>%s</dt>\n<dd>%s</dd>\n",$1,$2}') 53dl()(list dl -F"\n" -vRS= '{printf "<dt>%s</dt>\n<dd>%s</dd>\n",$1,$2}')
45 54
46rss() { 55rss() {
47 cat <<HEAD 56 cat <<HEAD
48<?xml version="1.0" encoding="utf-8"?> 57<?xml version="1.0" encoding="utf-8"?>
49<feed xmlns="http://www.w3.org/2005/Atom"> 58<feed xmlns="http://www.w3.org/2005/Atom">
50<title>$(sed 1q index.al)</title> 59<title>$(sed 1q index.al)</title>
@@ -54,29 +63,22 @@ rss() {
54<rights>$SITE_COPYRIGHT</rights> 63<rights>$SITE_COPYRIGHT</rights>
55<updated>$(date +%FT%TZ)</updated> 64<updated>$(date +%FT%TZ)</updated>
56HEAD 65HEAD
57 # entries 66 # entries
58 awk -F"\n" -vRS= \ 67 awk -F"\n" -vRS= \
59 -vbase="$BASE_URL" \ 68 -vbase="$BASE_URL" \
60 -vauthor="$SITE_COPYRIGHT" \ 69 -vauthor="$SITE_COPYRIGHT" \
61 'NR==1{next} 70 'NR==1{next}
62{ url=$1; title=$2; 71{ url=$1; title=$2; updated=$3;
63 file=url; sub(base "/", "", file) 72 file=url; sub(base "/", "", file)
64 printf "<entry>\n<id>%s</id>\n", url 73 printf "<entry>\n<id>%s</id>\n", url
65 printf "<link rel=\"alternate\" href=\"%s\" />\n", url 74 printf "<link rel=\"alternate\" href=\"%s\" />\n", url
66 printf "<title>%s</title>\n", title 75 printf "<title>%s</title>\n", title
67 printf "<author><name>%s</name></author>\n", author 76 printf "<author><name>%s</name></author>\n", author
68 printf "<updated>%s</updated>\n", updated(file) 77 printf "<updated>%s</updated>\n", updated
69 printf "<content type=\"html\"><![CDATA[%s]]></content>\n", 78 printf "<content type=\"html\"><![CDATA[%s]]></content>\n",
70 slurp(file) 79 slurp(file)
71 printf "</entry>\n" 80 printf "</entry>\n"
72} 81}
73function updated (file) {
74 cmd = "stat -c %y " file " 2>/dev/null"
75 cmd = cmd " || stat -f %Sm -t %FT%TZ " file " 2>/dev/null"
76 cmd | getline upd
77 close(cmd)
78 return upd
79}
80function slurp (file, out, bodyp) { 82function slurp (file, out, bodyp) {
81 oldRS=RS; RS="\n" 83 oldRS=RS; RS="\n"
82 while ((getline < file) > 0) { 84 while ((getline < file) > 0) {
@@ -87,32 +89,44 @@ function slurp (file, out, bodyp) {
87 RS=oldRS 89 RS=oldRS
88 return out 90 return out
89}' 91}'
90 cat <<FOOT 92 cat <<FOOT
91</feed> 93</feed>
92FOOT 94FOOT
93} 95}
94 96
97modtime() {
98 mtime="$(stat -c%Y "$1" 2>/dev/null ||
99 stat -f%Sm -t%FT%TZ "$1" 2>/dev/null)"
100 if test -n "$mtime"
101 then
102 # busybox date
103 date -u -d "@$mtime" +%FT%TZ
104 fi
105}
106
95# Main 107# Main
96main() { 108main() {
97 printf "%s\n\n" "$SITE_TITLE" > index.al 109 printf "%s\n\n" "$SITE_TITLE" > index.al
98 ls -t *.ul *.dl *.ol *.al 2>/dev/null | 110 ls -t *.ul *.dl *.ol *.al 2>/dev/null |
99 sed '/index.al/d' | 111 sed '/index.al/d' |
100 while read -r lst 112 while read -r lst
101 do 113 do
102 printf >&2 "Processing %s..." "$lst" 114 printf >&2 "Processing %s..." "$lst"
103 "${lst##*.}" < "$lst" | 115 "${lst##*.}" < "$lst" |
104 wrap "$lst" "$BACK_LINK" > "${lst%%.*}.html" 116 wrap "$lst" "$BACK_LINK" > "${lst%%.*}.html"
105 echo "$BASE_URL/${lst%%.*}.html" >> index.al 117 printf '%s\n%s\n%s\n\n' \
106 echo "$(sed 1q "$lst")" >> index.al 118 "$BASE_URL/${lst%%.*}.html" \
107 echo >> index.al 119 "$(sed 1q "$lst")" \
108 echo >&2 ok 120 "$(modtime "$lst")" \
109 done 121 >> index.al
110 printf >&2 "Processing index..." 122 echo >&2 ok
111 al < index.al | wrap index.al > index.html && 123 done
112 echo >&2 ok 124 printf >&2 "Processing index..."
113 printf >&2 "Processing rss..." 125 al < index.al | wrap index.al > index.html &&
114 rss < index.al > feed.xml && 126 echo >&2 ok
115 echo >&2 ok 127 printf >&2 "Processing rss..."
128 rss < index.al > feed.xml &&
129 echo >&2 ok
116} 130}
117 131
118main "$@" 132main "$@"
diff --git a/ok b/ok index 26ec2b7..6cf1c9c 100644 --- a/ok +++ b/ok
@@ -3,7 +3,7 @@
3watch(){ # repeatedly serve directory as files change 3watch(){ # repeatedly serve directory as files change
4 while : 4 while :
5 do 5 do
6 printf '%s\n' *.ul *.ol *.al *.dl | 6 printf '%s\n' *.ul *.ol *.al *.dl ll |
7 ok entr -d -r ok serve 7 ok entr -d -r ok serve
8 $NORUN && break 8 $NORUN && break
9 done 9 done
diff --git a/titles-of-poems.ul b/titles-of-poems.ul new file mode 100644 index 0000000..6fc42b9 --- /dev/null +++ b/titles-of-poems.ul
@@ -0,0 +1,3 @@
1titles of poems i have not written and may never write
2
3birds fly to the stars, i guess
diff --git a/what-i-had-for-lunch-today.ol b/what-i-had-for-lunch-today.ol new file mode 100644 index 0000000..e460232 --- /dev/null +++ b/what-i-had-for-lunch-today.ol
@@ -0,0 +1,7 @@
1what i had for lunch today
2
36 lance crackers (toast chee)
41 peanut butter (crunchy) and jelly sandwich
51 mozzarella cheese stick
61 apple (gala)
7water \ No newline at end of file
diff --git a/why-dont-i-blog.ul b/why-dont-i-blog.ul new file mode 100644 index 0000000..671869c --- /dev/null +++ b/why-dont-i-blog.ul
@@ -0,0 +1,17 @@
1why don't i blog?
2
3too much friction to start a new post
4busy with work and other software hobby projects
5no ideas
6too easy to make excuses
7nothing to say
8anxiety over being perceived
9unsure of tone to strike
10i write all day at work as is
11i don't read; why would i write
12too much pressure on myself to do something good
13other reasons
14other reasons i should not worry about
15other reasons i am using to put a lot of pressure on myself
16other "shoulds"
17things i can just let go \ No newline at end of file