# EXAMPLE: markdown
#
# DESCRIPTION
# This example requires pandoc installed. It defines three actions for
# editing, compiling to PDF and viewing a compiled PDF file.
#
# SETUP
# Copy all bu the General section to your config file.
# Alternatively, you can test this configuration with a temporary data base,
# by calling
#   export TASKOPENRC=/path/to/examples/markdown
#   taskopen ...
# In order to operate on the temporary data base with taskwarrior, you may
# define an alias like:
#   alias tx="task rc.data.location=/tmp"

[General]
# remove if used productively
taskargs = "rc.data.location=/tmp"

[Actions]

# compile action: compile markdown file to pdf with pandoc
mdcompile.regex = "^[\\.\\/~]+.*\\.(md|pandoc|mdwn|markdown)"
mdcompile.command = "cd `dirname $FILE`; pandoc -o `basename ${FILE%.*}.pdf` $FILE"

# edit action: open markdown file
mdedit.regex = "^[\\.\\/~]+.*\\.(md|pandoc|mdwn|markdown)"
mdedit.command = "$EDITOR $FILE"

# view action: open compiled pdf
mdview.regex = "^[\\.\\/~]+.*\\.(md|pandoc|mdwn|markdown)"
mdview.command = "xdg-open ${FILE%.*}.pdf 2>/dev/null &"
mdview.filtercommand = "test -e ${FILE%.*}.pdf"

[CLI]
alias.md = "any --include=mdcompile,mdedit,mdview"
