blob: 2d1313e228aac746dcaf73059897a801e3df31da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/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 -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 xelatex \
--variable graphics --variable 'geometry:margin=1in' -V 'mathfont:Symbola'
;;
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
|