diff options
author | Case Duckworth | 2024-04-19 14:10:59 -0500 |
---|---|---|
committer | Case Duckworth | 2024-04-19 14:10:59 -0500 |
commit | bc5d01c53a97d8cb652f87b16a63e0e258a051ab (patch) | |
tree | e25f7b0bda24f94e34434700a2250382f3a15441 | |
parent | Update base_url (diff) | |
download | ll-main.tar.gz ll-main.zip |
2024-04-19 main
-rw-r--r-- | good-soups.ul | 13 | ||||
-rwxr-xr-x | ll | 100 | ||||
-rw-r--r-- | ok | 2 | ||||
-rw-r--r-- | titles-of-poems.ul | 3 | ||||
-rw-r--r-- | what-i-had-for-lunch-today.ol | 7 | ||||
-rw-r--r-- | why-dont-i-blog.ul | 17 |
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 @@ | |||
1 | good soups | ||
2 | |||
3 | minestrone | ||
4 | miso | ||
5 | tomato | ||
6 | borscht (veggie) | ||
7 | mulligatawny (in name only) | ||
8 | chili (with beans, fight me) | ||
9 | ramen noodle | ||
10 | pho | ||
11 | hell, any noodle | ||
12 | ice water | ||
13 | the 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" | |||
7 | BACK_LINK=index.html,back | 7 | BACK_LINK=index.html,back |
8 | 8 | ||
9 | wrap() { | 9 | wrap() { |
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> |
15 | body{max-width:48em;font:20px/1.4 serif;margin:auto;padding:1em;} | 17 | body{max-width:48em;font:20px/1.4 serif;margin:auto;padding:1em; |
16 | footer{position:absolute;bottom:0;left:0;padding:1em;background:white;} | 18 | margin-bottom:4em;} |
19 | footer{position:fixed;bottom:0;left:0;padding:1em;background:white;} | ||
17 | dt{font-weight:bold;} | 20 | dt{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> |
22 | HEAD | 25 | HEAD |
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> |
32 | FOOT | 41 | FOOT |
@@ -44,7 +53,7 @@ al()(list ul -F"\n" -vRS= '{printf "<li><a href=\"%s\">%s</a></li>\n",$1,$2}') | |||
44 | dl()(list dl -F"\n" -vRS= '{printf "<dt>%s</dt>\n<dd>%s</dd>\n",$1,$2}') | 53 | dl()(list dl -F"\n" -vRS= '{printf "<dt>%s</dt>\n<dd>%s</dd>\n",$1,$2}') |
45 | 54 | ||
46 | rss() { | 55 | rss() { |
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> |
56 | HEAD | 65 | HEAD |
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 | } |
73 | function 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 | } | ||
80 | function slurp (file, out, bodyp) { | 82 | function 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> |
92 | FOOT | 94 | FOOT |
93 | } | 95 | } |
94 | 96 | ||
97 | modtime() { | ||
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 |
96 | main() { | 108 | main() { |
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 | ||
118 | main "$@" | 132 | main "$@" |
diff --git a/ok b/ok index 26ec2b7..6cf1c9c 100644 --- a/ok +++ b/ok | |||
@@ -3,7 +3,7 @@ | |||
3 | watch(){ # repeatedly serve directory as files change | 3 | watch(){ # 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 @@ | |||
1 | titles of poems i have not written and may never write | ||
2 | |||
3 | birds 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 @@ | |||
1 | what i had for lunch today | ||
2 | |||
3 | 6 lance crackers (toast chee) | ||
4 | 1 peanut butter (crunchy) and jelly sandwich | ||
5 | 1 mozzarella cheese stick | ||
6 | 1 apple (gala) | ||
7 | water \ 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 @@ | |||
1 | why don't i blog? | ||
2 | |||
3 | too much friction to start a new post | ||
4 | busy with work and other software hobby projects | ||
5 | no ideas | ||
6 | too easy to make excuses | ||
7 | nothing to say | ||
8 | anxiety over being perceived | ||
9 | unsure of tone to strike | ||
10 | i write all day at work as is | ||
11 | i don't read; why would i write | ||
12 | too much pressure on myself to do something good | ||
13 | other reasons | ||
14 | other reasons i should not worry about | ||
15 | other reasons i am using to put a lot of pressure on myself | ||
16 | other "shoulds" | ||
17 | things i can just let go \ No newline at end of file | ||