commit 06935185bed41c41194130a105a3cec5b3a5c6e5 Author: dozens Date: Tue Nov 1 15:18:05 2022 -0600 itinitsitinthebasket diff --git a/README.md b/README.md new file mode 100644 index 0000000..ab04ce5 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Rolldown + +> Rolling dice in markdown! +> Can it be done?? + +watch the video: + + + +this repo contains: + +``` +. +├── README.md +├── db.rec +├── justfile +├── macros.m4 +└── story.md +``` + +1. README.md -- this file +2. db.rec -- a 'recfile' containing one record per possible outcome of rolling 2d6 based on a loose interpretation of the Powered By The Apocalypse system +3. justfile -- just a collection of scripts +4. macros.m4 -- an m4 macros file. no longer used, but preserved for historical value +5. story.md -- a daring story about love, danger, and potatoes + +other goodies: + +- tmux: `tmux send-keys` allows you to send arbitrary key strokes to other tmux panes. In the video, I used it to tell lynx to refresh itself each time the html file is recompiled. + +- snippets: here's the snippet i ended up using to roll the dice: + + snippet res "roll 2d6!" + `recsel -P result -m 1 db.rec` + endsnippet + +more reading: + +- https://www.gnu.org/software/recutil/ +- https://mbreen.com/m4.html +- http://eradman.com/entrproject/ +- https://github.com/SirVer/ultisnips + diff --git a/db.rec b/db.rec new file mode 100644 index 0000000..682e989 --- /dev/null +++ b/db.rec @@ -0,0 +1,35 @@ +%rec: roll +%doc: a dice roll + +id: 2 +result: hella bad + +id: 3 +result: bad + +id: 4 +result: bad + +id: 5 +result: bad + +id: 6 +result: bad + +id: 7 +result: mixed success + +id: 8 +result: success with consequence + +id: 9 +result: hard choice + +id: 10 +result: good + +id: 11 +result: good + +id: 12 +result: uncomfortably good diff --git a/justfile b/justfile new file mode 100644 index 0000000..0b96a14 --- /dev/null +++ b/justfile @@ -0,0 +1,23 @@ +# show all commands +default: + just --list --unsorted + +# build html +html: + pandoc -t html story.md -o index.html + +# watch for updates and build html +watch: + ls story.md | entr -c just html + +# m4 demonstration +m4: + echo "hello this is patrick" | m4 -D "patrick=krusty krab" + +# roll some dice +roll: + recsel -P result -m 1 db.rec + +# show all bad results +bad: + recsel -e "id <= 6" -G result -p id,result db.rec diff --git a/macros.m4 b/macros.m4 new file mode 100644 index 0000000..1583730 --- /dev/null +++ b/macros.m4 @@ -0,0 +1 @@ +define(`__result', `esyscmd(recsel -P result -m 1 db.rec)') diff --git a/story.md b/story.md new file mode 100644 index 0000000..3ef5cba --- /dev/null +++ b/story.md @@ -0,0 +1,24 @@ +# my story # + +## in the beginning ## + +i was walking down the street and things were bad + +## and then ## + +I saw a bear! and i tried to run away, and I did bad. so i did not evade the bear, in fact i tripped and fell! + +## and so + +and so i tried to appeal to reason, and i the bear paused and i got to get away, but i sprained my ankle! and had to hide behind a dumpster for 3 hours until it went away + +## eventually + +I finally got to the library and was able to return my books, but the books were so overdue, that the feral librarians sold me into indentured servitude + +## later + +I was toiling away at the hobbit's potato farm. and i made a plan to escape. but the farmer's daughter found out, and threatened to tell if I dind't take her with me. + +so under the cover of night, we tried to escape, but were captured by orcs, who planned eat us during the Festival of the Blood Moon +