about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-06-15 10:28:56 -0500
committerCase Duckworth2022-06-15 10:28:56 -0500
commiteee9d34b4da47bf355c86a0e3819fa0be4515c1e (patch)
tree48b767ed5d31a5c3e9c762c28100a17dd334d3f3
parentMerge branch 'ht3' (diff)
downloadhat-trick-eee9d34b4da47bf355c86a0e3819fa0be4515c1e.tar.gz
hat-trick-eee9d34b4da47bf355c86a0e3819fa0be4515c1e.zip
Add posts mostly
-rw-r--r--asset/casa.css27
-rwxr-xr-xht.awk176
-rwxr-xr-xht3.awk56
-rw-r--r--src/books-to-read--sff-edition.ht20
-rw-r--r--src/it-works-on-my-machine.ht18
-rw-r--r--src/one-more-thing.ht12
-rw-r--r--src/wweekend.ht14
7 files changed, 234 insertions, 89 deletions
diff --git a/asset/casa.css b/asset/casa.css index b607bf1..ad803be 100644 --- a/asset/casa.css +++ b/asset/casa.css
@@ -1,9 +1,6 @@
1html { 1html {
2 min-height: 100vh; 2 min-height: 100vh;
3 margin:0; padding: 0; 3 margin:0; padding: 0;
4}
5
6html {
7 font: 18px serif; 4 font: 18px serif;
8} 5}
9 6
@@ -22,15 +19,21 @@ main {
22 background: #405990; 19 background: #405990;
23} 20}
24 21
25a {
26 color: yellow;
27}
28
29footer { 22footer {
30 text-align: right; 23 text-align: right;
31 padding: 1ch 0; 24 padding: 1ch 0;
32} 25}
33 26
27@media screen and (max-width: 700px) {
28 body { padding: 0; }
29 main,footer { padding: 1ch; }
30 h1 { padding: 0 1ch; }
31}
32
33a {
34 color: yellow;
35}
36
34#back { 37#back {
35 float: left; 38 float: left;
36} 39}
@@ -38,3 +41,13 @@ footer {
38code { 41code {
39 color: #c0ffee; 42 color: #c0ffee;
40} 43}
44
45blockquote { position: relative; }
46
47blockquote::before {
48 content: "“";
49 font-size: 2em;
50 position: absolute;
51 left: -1em;
52 top: -0.25em;
53}
diff --git a/ht.awk b/ht.awk index a382ae7..9288060 100755 --- a/ht.awk +++ b/ht.awk
@@ -3,96 +3,136 @@
3# (C) 2022 C. Duckworth 3# (C) 2022 C. Duckworth
4 4
5# ht.awk converts mostly-html (with some conveniences) to actual html 5# ht.awk converts mostly-html (with some conveniences) to actual html
6 6/^;/ {
7function bufpush(s) { 7 sub(/^;/, "", $0)
8 BUF = BUF (BUF ? "\n" : "") s; 8 print "<!--", esc($0), "-->"
9 next
9} 10}
10 11
11function buflush() { 12/^</ { # Raw HTML
12 if (BUF) print BUF; 13 if (! (tag == "html")) {
13 BUF = ""; 14 tag = "html"
14 if (tag && (tag != "html") && (tag != "raw")) 15 }
15 print "</" tag ">"; 16 bufpush($0)
17 next
16} 18}
17 19
18function esc(t) { 20/^```$/ { # Raw block
19 # This is of much more limited utility than I initially realized. 21 if (! (tag == "raw")) {
20 gsub(/&/, "\\&amp;", t); 22 tag = "raw"
21 gsub(/</, "\\&lt;", t); 23 getline
22 gsub(/>/, "\\&gt;", t); 24 bufpush("<pre><code>" $0)
23 sub(/^ /, "\\&nbsp;", t); 25 } else {
24 return t; 26 bufpush("</code></pre>")
27 buflush()
28 tag = ""
29 }
30 next
25} 31}
26 32
27/^;/ { sub(/^;/,""); print "<!--", esc($0), "-->"; next; } 33/^=>/ { # Links (Gemini-style)
34 if (tag == "raw") {
35 next
36 }
37 link = "<a href=\"" esc($2) "\">" $3
38 for (i = 4; i <= NF; i++) {
39 link = link " " $i
40 }
41 link = link "</a>"
42 bufpush(link)
43 next
44}
28 45
29/^</ { # Raw HTML 46/^-/ { # Unordered lists
30 if (! (tag == "html")) tag = "html"; 47 if (tag == "raw") {
31 bufpush($0); 48 next
32 next; 49 }
50 if (! (tag == "ul")) {
51 tag = "ul"
52 }
53 sub(/^-[ \t]*/, "<li>", $0)
33} 54}
34 55
35/^```$/ { # Raw block 56/^[0-9]+\./ { # Ordered lists
36 if (! (tag == "raw")) { 57 if (tag == "raw") {
37 tag = "raw"; 58 next
38 getline; 59 }
39 bufpush("<pre><code>" $0); 60 if (! (tag == "ol")) {
40 } else { 61 tag = "ol"
41 bufpush("</code></pre>"); 62 }
42 buflush(); 63 sub(/^[0-9]+\.[ \t]/, "<li>", $0)
43 tag = "";
44 }
45 next;
46} 64}
47 65
48/^=>/ { # Links (Gemini-style) 66/^>/ { # Blockquotes
49 if (tag == "raw") next; 67 if (tag == "raw") {
50 link = "<a href=\"" esc($2) "\">" $3; 68 next
51 for (i=4;i<=NF;i++) link = link " " $i; 69 }
52 link = link "</a>"; 70 if (! (tag == "blockquote")) {
53 bufpush(link); 71 tag = "blockquote"
54 next; 72 }
73 sub(/^>[ \t]*/, "", $0)
55} 74}
56 75
57/^-/ { # Unordered lists 76/^#+/ { # Headers
58 if (tag == "raw") next; 77 if (tag == "raw") {
59 if (! (tag == "ul")) tag = "ul"; 78 next
60 sub(/^-[ \t]*/, "<li>"); 79 }
80 match($0, /^#+/)
81 if (! (tag == "h" RLENGTH)) {
82 buflush()
83 tag = "h" RLENGTH
84 }
85 sub(/^#+[ \t]*/, "", $0)
61} 86}
62 87
63/^[0-9]+\./ { # Ordered lists 88/^$/ {
64 if (tag == "raw") next; 89 if (tag == "raw") {
65 if (! (tag == "ol")) tag = "ol"; 90 next
66 sub(/^[0-9]+\.[ \t]/, "<li>"); 91 }
92 buflush()
93 tag = ""
67} 94}
68 95
69/^>/ { # Blockquotes 96/./ {
70 if (tag == "raw") next; 97 if (! tag) {
71 if (! (tag == "blockquote")) tag = "blockquote"; 98 tag = "p"
72 sub(/^>[ \t]*/,""); 99 }
100 if (! BUF) {
101 bufpush("<" tag ">")
102 }
103 if (tag == "raw") {
104 $0 = esc($0)
105 }
106 bufpush($0)
73} 107}
74 108
75/^#+/ { # Headers 109END {
76 if (tag == "raw") next; 110 buflush()
77 match($0, /^#+/);
78 if (! (tag == "h" RLENGTH)) {
79 buflush();
80 tag = "h" RLENGTH;
81 }
82 sub(/^#+[ \t]*/,"");
83} 111}
84 112
85/^$/ { 113
86 if (tag == "raw") next; 114function buflush()
87 buflush(); 115{
88 tag = ""; 116 if (BUF) {
117 print BUF
118 }
119 BUF = ""
120 if (tag && (tag != "html") && (tag != "raw")) {
121 print "</" tag ">"
122 }
89} 123}
90 124
91/./ { 125function bufpush(s)
92 if (! tag) tag = "p"; 126{
93 if (! BUF) bufpush("<" tag ">"); 127 BUF = BUF (BUF ? "\n" : "") s
94 if (tag == "raw") $0 = esc($0);
95 bufpush($0);
96} 128}
97 129
98END { buflush(); } 130function esc(t)
131{
132 # This is of much more limited utility than I initially realized.
133 gsub(/&/, "\\&amp;", t)
134 gsub(/</, "\\&lt;", t)
135 gsub(/>/, "\\&gt;", t)
136 sub(/^ /, "\\&nbsp;", t)
137 return t
138}
diff --git a/ht3.awk b/ht3.awk index 996cb1a..5226af7 100755 --- a/ht3.awk +++ b/ht3.awk
@@ -15,45 +15,71 @@ BEGIN {
15 } 15 }
16 # Output buffer. The output will be chunked into blocks. 16 # Output buffer. The output will be chunked into blocks.
17 BUFFER = "" 17 BUFFER = ""
18 # Default block type
19 DEFAULT_BLOCK = "p"
18 # The current block type. We start with a standard paragraph. 20 # The current block type. We start with a standard paragraph.
19 BLOCK = "p" 21 BLOCK = DEFAULT_BLOCK
20} 22}
21 23
22### RAW TEXT 24### RAW TEXT
23/^>>>/ { 25/^>>>/ {
26 BLOCK = "raw"
27 if ($1) {
28 split($1, raw_type, ",")
29 }
24} 30}
25 31
26/^<<</ { 32/^<<</ {
33 BLOCK = DEFAULT_BLOCK
34 for (type in raw_type) {
35 delete raw_type[type]
36 }
27} 37}
28 38
29### BLOCKS 39### BLOCKS
30/^#+/ { # Headers 40block == "raw" {
41 bufpush($0, "\n")
42 next
43}
44
45/^#+/ { # Headers
46 match($0, /^#+/)
47 if (! (BLOCK == "h" RLENGTH)) {
48 buflush()
49 tag = "h" RLENGTH
50 }
51 sub(/^#+[ \t]*/, "", $0)
31} 52}
32 53
33/^>/ { # Block quote 54/^>/ { # Block quote
34} 55}
35 56
36/^-/ { # Unordered list 57/^-/ { # Unordered list
37} 58}
38 59
39/^[0-9]\./ { # Ordered list 60/^[0-9]\./ { # Ordered list
40} 61}
41 62
42/^---$/ { # Section break 63/^---$/ { # Section break
64}
65
66/^$/ { # End a block
67 buflush()
68 BLOCK = DEFAULT_BLOCK
43} 69}
44 70
45### LINES 71### LINES
46/^=>/ { # Link 72/^=>/ { # Link
47} 73}
48 74
49/^</ { # HTML tag 75/^</ { # HTML tag
50} 76}
51 77
52/^;/ { # Comment 78/^;/ { # Comment
53} 79}
54 80
55### EVERYTHING ELSE 81# EVERYTHING ELSE
56{ 82/./ {
57} 83}
58 84
59### FINISH 85### FINISH
@@ -61,6 +87,7 @@ END {
61 buflush() 87 buflush()
62} 88}
63 89
90
64### FUNCTIONS 91### FUNCTIONS
65function buflush() 92function buflush()
66{ 93{
@@ -75,10 +102,11 @@ function buflush()
75 print 102 print
76} 103}
77 104
78function bufpush(str) 105function bufpush(str, sep)
79{ 106{
80 # Push STR onto the buffer after a newline. 107 # Push STR onto the buffer after SEP (defaults to space).
81 BUFFER = BUFFER (BUFFER ? "\n" : "") str 108 sep = sep ? sep : " "
109 BUFFER = BUFFER (BUFFER ? sep : "") str
82} 110}
83 111
84function ht_print(str) 112function ht_print(str)
diff --git a/src/books-to-read--sff-edition.ht b/src/books-to-read--sff-edition.ht new file mode 100644 index 0000000..e893db0 --- /dev/null +++ b/src/books-to-read--sff-edition.ht
@@ -0,0 +1,20 @@
1;@@title: books to read, sff edition@@
2;@@date: 2022-06-13@@
3
4i make a lot of lists of books to read. here's another one.
5it's from
6=> https://www.nytimes.com/2022/05/27/books/review/new-science-fiction-fantasy.html the <em>New York Times</em>
7but they like to shut off access to their articles, so I'm repeating the list here.
8
9- <em>And Then I Woke Up</em> -- Malcolm Devlin
10- <em>Hell Followed with Us</em> -- Joseph White
11- <em>Her Majesty's Royal Coven</em> -- Juno Dawson
12- <em>Kaikeyi</em> -- Vaishnavi Patel
13- <em>In a Garden Burning Gold</em> -- Rory Power
14- <em>The Stardust Thief</em> -- Chelsea Abdullah
15
16In order to not steal
17<em>too much</em>
18from the venerable <i>Times</i>,
19I've only listed the books here.
20Subscribe, I guess, for the reviews themselves. \ No newline at end of file
diff --git a/src/it-works-on-my-machine.ht b/src/it-works-on-my-machine.ht new file mode 100644 index 0000000..60fc227 --- /dev/null +++ b/src/it-works-on-my-machine.ht
@@ -0,0 +1,18 @@
1;@@title: it works on my machine@@
2;@@date: 2022-06-09@@
3
4I keep seeing things that I wish there were comprehensive tutorials for
5&ndash; I'm thinking, now, of
6<code>gpg</code>
7and
8<code>tramp</code>
9&ndash; but I realize that really, all computer problems break down to that dreaded phrase:
10
11> Well, it works on my machine.
12
13Computers are great big balls of state, aren't they? That's why rebooting fixes so many problems. I guess you could say life is a great big ball of state, though we can't reboot it easily.
14
15Anyway, this is all to say that things are complicated, I suppose.
16And while it'd be nice to have simpler things, I think that trying too hard to simplify actually creates more problems than it's worth (see
17=> https://applied-langua.ge/posts/here-is-a-loud-announcement.html Applied Language
18for other ideas).
diff --git a/src/one-more-thing.ht b/src/one-more-thing.ht new file mode 100644 index 0000000..869ea0d --- /dev/null +++ b/src/one-more-thing.ht
@@ -0,0 +1,12 @@
1;@@title: one more thing@@
2;@@date: 2022-06-06@@
3
4i really need to figure out how to separate my content from my engine here.
5
6i just spent about 5 white-knuckle minutes trying to rebase my feature branch
7<em>(ooh, ahh!)</em>
8to not include the new posts I'm making. i'll have to do it again because i'm going
9to forget to switch branches before writing another one. i guess at least now i know
10i know how to rebase, so
11
12anyway, ideas welcome. email the guy in the last post ("<a href="./moved-in.html">moved in</a>").
diff --git a/src/wweekend.ht b/src/wweekend.ht new file mode 100644 index 0000000..97652ed --- /dev/null +++ b/src/wweekend.ht
@@ -0,0 +1,14 @@
1;@@title: wweekend@@
2;@@date: 2022-06-13@@
3
4Saw the WWE this weekend ... for
5<em>free</em>,
6as a seat filler! (ssh, don't tell anyone that the WWE fills seats.)
7
8It was an absolute blast, let me tell you. We lucked out in that we ended up filling seats that the ticket buyers never showed up for, so we just had great seats for free. Not sure how much they cost, but I figure at least over $100.
9
10Saturday we had a house-warming party which was also great, just good fun with friends. and we got to show off our new house, which is truly wonderful!
11
12now i'm at work which is... work, lol. i've actually got nothing to do
13<em>right now</em>
14which is why i'm writing this blog. i feel like, this is maybe not the best way to write this blog thing, whatever it is. hm.