src:="wellness-lite"

# show all recipes
default:
  just --list --unsorted

# make text
@txt:
  [ {{src}}. -nt {{src}}.html ] \
  && nroff -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"

build: txt html pdf
