#!/bin/sh # Setting Vars FILE=$(basename "$1") EXTENSION=$(echo "$FILE" | awk -F . '{if (NF>1) {print $NF}}') BASE=$(basename "$FILE" ."$EXTENSION") # Filter to compile other types of files case $EXTENSION in md|rmd) FORMAT=$(printf "PDF\nHTML\nBeamer\nODT\nDOCX\nPPTX\n" | dmenu -c -l 15 -i -p "Format:") case "$FORMAT" in PDF) pandoc "$FILE" --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash \ --output "$BASE".pdf --self-contained --highlight-style tango --pdf-engine pdflatex \ --variable graphics --variable 'geometry:margin=1in' ;; HTML) pandoc "$FILE" --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash \ --output "$BASE".html --email-obfuscation none --self-contained --standalone --section-divs \ --template ~/.local/src/templates/default.html --no-highlight --variable highlightjs=1 \ --variable 'theme:bootstrap' --mathjax ;; Beamer) pandoc "$FILE" --to beamer --from markdown+autolink_bare_uris+tex_math_single_backslash --output "$BASE".pdf \ --highlight-style tango --pdf-engine pdflatex --self-contained ;; ODT) pandoc "$FILE" --to odt --from markdown+autolink_bare_uris+tex_math_single_backslash --output "$BASE".odt ;; DOCX) pandoc "$FILE" --to docx --from markdown+autolink_bare_uris+tex_math_single_backslash --output "$BASE".docx \ --highlight-style tango ;; PPTX) pandoc "$FILE" --to pptx --from markdown+autolink_bare_uris+tex_math_single_backslash --output "$BASE".pptx esac ;; ms) groff -k -T pdf -m -ms "$FILE" > "$BASE.pdf" ;; java) java "$FILE" ;; c|h) cc -o "$BASE" ./*.c esac