about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-05-24 17:16:49 -0500
committerCase Duckworth2022-05-24 17:16:49 -0500
commit849013a6d2ae99ea1b088298b8f2067818b7404d (patch)
treeec3b58022c90b82425e855fd3c8f864f2671071d
parentUse rsync -u to avoid .last_build (diff)
downloadhat-trick-849013a6d2ae99ea1b088298b8f2067818b7404d.tar.gz
hat-trick-849013a6d2ae99ea1b088298b8f2067818b7404d.zip
Generate a feed
-rw-r--r--.last_build0
-rw-r--r--Makefile12
-rwxr-xr-xht.awk9
-rw-r--r--src/beans.html21
-rw-r--r--src/compile.ht1
-rw-r--r--src/favicon.ht1
-rw-r--r--src/friday.ht15
-rw-r--r--tmpl.feed.xml27
-rw-r--r--tmpl.index.htm6
9 files changed, 62 insertions, 30 deletions
diff --git a/.last_build b/.last_build deleted file mode 100644 index e69de29..0000000 --- a/.last_build +++ /dev/null
diff --git a/Makefile b/Makefile index 87e730d..e7c5863 100644 --- a/Makefile +++ b/Makefile
@@ -41,7 +41,13 @@ ITMPR = \
41 env HTTMP='$T' HTOUT='\$$@' \ 41 env HTTMP='$T' HTOUT='\$$@' \
42 ${HTSH} "${ITMPL}" < /dev/null > '\$$@' 42 ${HTSH} "${ITMPL}" < /dev/null > '\$$@'
43 43
44TMPL = ${PTMPL} ${ITMPL} 44RTMPL = tmpl.feed.xml
45RTMPR = \
46 feed.xml: ${RTMPL} index.html $$(cat ${TPG}); \
47 env HTTMP='$T' HTOUT='\$$@' \
48 ${HTSH} "${RTMPL}" < /dev/null > '\$$@'
49
50TMPL = ${PTMPL} ${ITMPL} ${RTMPL}
45BUILD_INPUTS = ${INPUT}/* ${TMPL} ${HT} 51BUILD_INPUTS = ${INPUT}/* ${TMPL} ${HT}
46 52
47RSYNCEXCLUDE = \ 53RSYNCEXCLUDE = \
@@ -51,6 +57,7 @@ RSYNCEXCLUDE = \
51 "*.mk" \ 57 "*.mk" \
52 "*.awk" \ 58 "*.awk" \
53 "*.bod.txt" \ 59 "*.bod.txt" \
60 "tmpl.*" \
54 "tmp/" 61 "tmp/"
55RSYNCEXCLUDEFILE = ${BUILD}/.rsync-exclude 62RSYNCEXCLUDEFILE = ${BUILD}/.rsync-exclude
56RSYNC = rsync -auvz --exclude-from="${RSYNCEXCLUDEFILE}" --delete 63RSYNC = rsync -auvz --exclude-from="${RSYNCEXCLUDEFILE}" --delete
@@ -75,7 +82,8 @@ ${HTMK}: Makefile ${INPUT}/*.ht $T
75 done >> '$@' 82 done >> '$@'
76 83
77 @printf '%s\n' "${ITMPR}" >> '$@' 84 @printf '%s\n' "${ITMPR}" >> '$@'
78 @printf "build: $$(cat ${TPG}) index.html" >> '$@' 85 @printf '%s\n' "${RTMPR}" >> '$@'
86 @printf "build: $$(cat ${TPG}) index.html feed.xml" >> '$@'
79 @printf '%s\n' 'done' 87 @printf '%s\n' 'done'
80 88
81$T: ; mkdir -p "$@" 89$T: ; mkdir -p "$@"
diff --git a/ht.awk b/ht.awk index 5328361..faa729d 100755 --- a/ht.awk +++ b/ht.awk
@@ -15,6 +15,7 @@ function buflush() {
15} 15}
16 16
17function esc(t) { 17function esc(t) {
18 # This is of much more limited utility than I initially realized.
18 gsub(/&/, "\\&amp;", t); 19 gsub(/&/, "\\&amp;", t);
19 gsub(/</, "\\&lt;", t); 20 gsub(/</, "\\&lt;", t);
20 gsub(/>/, "\\&gt;", t); 21 gsub(/>/, "\\&gt;", t);
@@ -30,8 +31,8 @@ function esc(t) {
30} 31}
31 32
32/^=>/ { # Links (Gemini-style) 33/^=>/ { # Links (Gemini-style)
33 link = "<a href=\"" esc($2) "\">" esc($3); 34 link = "<a href=\"" esc($2) "\">" $3;
34 for (i=4;i<=NF;i++) link = link " " esc($i); 35 for (i=4;i<=NF;i++) link = link " " $i;
35 link = link "</a>"; 36 link = link "</a>";
36 bufpush(link); 37 bufpush(link);
37 next; 38 next;
@@ -39,20 +40,17 @@ function esc(t) {
39 40
40/^-/ { # Unordered lists 41/^-/ { # Unordered lists
41 if (! (tag == "ul")) tag = "ul"; 42 if (! (tag == "ul")) tag = "ul";
42 esc($0);
43 sub(/^-[ \t]*/, "<li>"); 43 sub(/^-[ \t]*/, "<li>");
44} 44}
45 45
46/^[0-9]+\./ { # Ordered lists 46/^[0-9]+\./ { # Ordered lists
47 if (! (tag == "ol")) tag = "ol"; 47 if (! (tag == "ol")) tag = "ol";
48 esc($0);
49 sub(/^[0-9]+\.[ \t]/, "<li>"); 48 sub(/^[0-9]+\.[ \t]/, "<li>");
50} 49}
51 50
52/^>/ { # Blockquotes 51/^>/ { # Blockquotes
53 if (! (tag == "blockquote")) tag = "blockquote"; 52 if (! (tag == "blockquote")) tag = "blockquote";
54 sub(/^>[ \t]*/,""); 53 sub(/^>[ \t]*/,"");
55 esc($0);
56} 54}
57 55
58/^#+/ { # Headers 56/^#+/ { # Headers
@@ -62,7 +60,6 @@ function esc(t) {
62 tag = "h" RLENGTH; 60 tag = "h" RLENGTH;
63 } 61 }
64 sub(/^#+[ \t]*/,""); 62 sub(/^#+[ \t]*/,"");
65 esc($0);
66} 63}
67 64
68/^$/ { 65/^$/ {
diff --git a/src/beans.html b/src/beans.html deleted file mode 100644 index ff89934..0000000 --- a/src/beans.html +++ /dev/null
@@ -1,21 +0,0 @@
1html,body {
2 min-height: 100vh;
3 margin:0; padding: 0;
4}
5
6html {
7 font: 18px serif;
8 background: #385180;
9}
10
11body {
12 max-width: 79ch;
13 padding: 0 2ch;
14 margin: 0 auto;
15 background: #405990;
16 color: white;
17}
18
19a {
20 color: yellow;
21}
diff --git a/src/compile.ht b/src/compile.ht index 5764828..9fb91c9 100644 --- a/src/compile.ht +++ b/src/compile.ht
@@ -1,4 +1,5 @@
1;@@title: Compiling!@@ 1;@@title: Compiling!@@
2;@@date: 2022-05-24@@
2 3
3I've been using Emacs to write this site so far, and it has a convenient 4I've been using Emacs to write this site so far, and it has a convenient
4<code>M-x compile</code> command that is fun to use. However, I frequently want 5<code>M-x compile</code> command that is fun to use. However, I frequently want
diff --git a/src/favicon.ht b/src/favicon.ht index b9df118..adb0ea6 100644 --- a/src/favicon.ht +++ b/src/favicon.ht
@@ -1,4 +1,5 @@
1;@@title: Embedded data-url favicon@@ 1;@@title: Embedded data-url favicon@@
2;@@date: 2022-05-18@@
2 3
3You might notice that I have a <b>new favicon</b> on this site. 4You might notice that I have a <b>new favicon</b> on this site.
4I didn't want to make a whole nother request, so I took a page from 5I didn't want to make a whole nother request, so I took a page from
diff --git a/src/friday.ht b/src/friday.ht new file mode 100644 index 0000000..a1180e8 --- /dev/null +++ b/src/friday.ht
@@ -0,0 +1,15 @@
1;@@title: Friday@@
2;@@date: 2022-05-20@@
3
4It's Friday, y'all.
5I don't want to do nothin' at all today.
6
7I'm going to fun concert tonight with friends, which is nice.
8And getting ready to move at the end of the month this weekend.
9
10I'm about to be in a game jam soon, which is going to be great.
11And I'm writing this. I kind of want to re-do it in scheme...
12
13Anyway, I don't know. I'm vibing but I'd love to be vibing at home.
14
15What <em>do</em> I want to do with my life, anyway? \ No newline at end of file
diff --git a/tmpl.feed.xml b/tmpl.feed.xml new file mode 100644 index 0000000..d133471 --- /dev/null +++ b/tmpl.feed.xml
@@ -0,0 +1,27 @@
1<?xml version="1.0" encoding="utf-8"?>
2<feed xmlns="http://www.w3.org/2005/Atom">
3 <title>acdw.casa</title>
4 <subtitle>mi casa es su casa</subtitle>
5 <link href="https://acdw.casa" rel="self" />
6 <link href="https://acdw.casa" />
7 <id>acdw.casa</id>
8 <generator uri="https://git.acdw.net/hat-trick.git/" version="infinite">hat-trick</generator>
9 <rights>Copyright (C) 2022 CC-BY-SA Case Duckworth</rights>
10 <updated>$(date -u +%FT%TZ)</updated>
11
12 $(set -x;cat .tmp/index-list | while read line; do
13 entry_date="$(echo "$line" | sed 's/.*<li><!-- \(.*\) -->.*/\1/')"
14 entry_title="$(echo "$line" | sed 's#.*<a href=".*">\(.*\)</a>.*#\1#')"
15 entry_html="$(echo "$line" | sed 's#.*<a href="\(.*\)">.*#\1#')"
16 entry_url="https://acdw.casa/$entry_html"
17 print "<entry>"
18 print "<id>$entry_url</id>"
19 print "<link rel=\"alternate\" type=\"text/html\" href=\"$entry_url\" />"
20 print "<title>$entry_title</title>"
21 print "<updated>$entry_date</updated>"
22 print "<author><name>Case Duckworth</name></author>"
23 print "<content type=\"html\"><![CDATA[$(sed 1d "${entry_html%ml}.bod.txt")]]></content>"
24 print "</entry>"
25 done)
26
27</feed>
diff --git a/tmpl.index.htm b/tmpl.index.htm index 427be53..9dd605b 100644 --- a/tmpl.index.htm +++ b/tmpl.index.htm
@@ -9,7 +9,11 @@ $(sed 's#$(title)#acdw.casa#' _head.htm)
9 <section id="pages"> 9 <section id="pages">
10 <h2>pages here</h2> 10 <h2>pages here</h2>
11 <ul> 11 <ul>
12 $(for p in ".tmp"/*.env; do . "$p"; print "<li><a href=\"$HTOUT\">$(title)</a></li>"; done) 12 $(: > .tmp/index-list;
13 for p in .tmp/*.env; do date() { echo "2022-05-01"; }; title() { :; }; . "$p";
14 print "<li><!-- $(date) --><a href=\"$HTOUT\">$(title)</a></li>" \
15 >> .tmp/index-list; done)
16 $(sort -r .tmp/index-list)
13 </ul> 17 </ul>
14 </section> 18 </section>
15</main> 19</main>