wellnessgame/dodeca/justfile

47 lines
1004 B
Plaintext

src:="wellness-dodeca"
# show all recipes
default:
just --list --unsorted
# make text
@txt:
[ {{src}}.t -nt {{src}}.txt ] \
&& nroff -t -ms {{src}}.t > {{src}}.txt \
|| echo "Nothing to be done"
# make html
@html:
[ {{src}}.t -nt {{src}}.html ] \
&& sed '/tbl start/,/tbl end/ s/^/.\\" /' {{src}}.t \
| sed '/markdown start/,/markdown end/ s/^\.\\" //' \
| sed '/:::/d' \
| groff -ms -Thtml \
| gsed "/style type/a body { max-width: 80ch; margin-inline: auto; }" \
> {{src}}.html \
|| echo "Nothing to be done"
# make pdf
@pdf:
[ {{src}}.t -nt {{src}}.pdf ] \
&& cat {{src}}.t | groff -ms -t -Tpdf > {{src}}.pdf \
|| echo "Nothing to be done"
# make text html and pdf
build: txt html pdf
test:
#!/bin/zsh
&& ed {{src}}.t << 'EOE'
H
/tbl start/,/tbl end/d
/markdown start/,/markdown end/ s/\.\\" //
/BEGINTABLE/+,/ENDTABLE/- w /tmp/table.ed
/markdown start/- kt
/markdown start/,/markdown end/d
'tr !cat /tmp/table.ed | pandoc -t html
,p
Q
EOE