itinitsitinthebasket
commit
06935185be
|
@ -0,0 +1,43 @@
|
||||||
|
# Rolldown
|
||||||
|
|
||||||
|
> Rolling dice in markdown!
|
||||||
|
> Can it be done??
|
||||||
|
|
||||||
|
watch the video:
|
||||||
|
|
||||||
|
<https://tube.tchncs.de/w/wvdZ36y4C4FFKNDf2MSBrn>
|
||||||
|
|
||||||
|
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
|
||||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1 @@
|
||||||
|
define(`__result', `esyscmd(recsel -P result -m 1 db.rec)')
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue