add latex/compile script
This commit is contained in:
parent
aa33b73377
commit
d3b2d0f9e6
2
justfile
2
justfile
@ -1,4 +1,4 @@
|
|||||||
allTags := "nvim,xmonad,git"
|
allTags := "nvim,xmonad,git,scripts"
|
||||||
|
|
||||||
default:
|
default:
|
||||||
just --list
|
just --list
|
||||||
|
33
roles/scripts/files/compiledoc
Normal file
33
roles/scripts/files/compiledoc
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# takes a file and compiles it into a pdf file, if possible
|
||||||
|
# inspiration from https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/compiler
|
||||||
|
|
||||||
|
file=$(readlink -f "$1")
|
||||||
|
dir=${file%/*}
|
||||||
|
base="${file%.*}"
|
||||||
|
ext="${file##*.}"
|
||||||
|
|
||||||
|
cd "$dir" || exit 1
|
||||||
|
|
||||||
|
compile_tex() { \
|
||||||
|
if [ -e "$dir/Tectonic.toml"]; then
|
||||||
|
tectonic -X build
|
||||||
|
else
|
||||||
|
params=""
|
||||||
|
( grep -q minted $file) && params="$params -Z shell-escape"
|
||||||
|
tectonic -X compile "$params" $file
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$ext" in
|
||||||
|
md) pandoc -t pdf \
|
||||||
|
--pdf-engine tectonic \
|
||||||
|
-f gfm \
|
||||||
|
-V linkcolor:blue \
|
||||||
|
-V geometry:a4paper \
|
||||||
|
-V geometry:margin=2cm \
|
||||||
|
-V mainfont="Liberation Sans" \
|
||||||
|
-V monofont="Liberation Mono" \
|
||||||
|
-o "$base".pdf "$file" ;;
|
||||||
|
tex) textype "$file" ;;
|
||||||
|
esac
|
25
roles/scripts/tasks/main.yml
Normal file
25
roles/scripts/tasks/main.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
- name: Install packages required by scripts
|
||||||
|
ansible.builtin.package:
|
||||||
|
name:
|
||||||
|
- tectonic
|
||||||
|
- pandoc
|
||||||
|
- ttf-liberation
|
||||||
|
state: present
|
||||||
|
tags: pc
|
||||||
|
|
||||||
|
- name: Create a local bin directory if it doesn't exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: ~/.local/bin
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
tags: pc
|
||||||
|
|
||||||
|
- name: Copy over all scripts
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
mode: '0755'
|
||||||
|
with_items:
|
||||||
|
- { src: compiledoc, dest: ~/.local/bin/compiledoc }
|
||||||
|
tags: pc
|
16
site.yml
16
site.yml
@ -3,12 +3,22 @@
|
|||||||
connection: local
|
connection: local
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
tasks:
|
tasks:
|
||||||
- ansible.builtin.include_role:
|
- name: Nvim role
|
||||||
|
ansible.builtin.include_role:
|
||||||
name: nvim
|
name: nvim
|
||||||
tags: nvim
|
tags: nvim
|
||||||
- ansible.builtin.include_role:
|
|
||||||
|
- name: Xmonad role
|
||||||
|
ansible.builtin.include_role:
|
||||||
name: xmonad
|
name: xmonad
|
||||||
tags: xmonad
|
tags: xmonad
|
||||||
- ansible.builtin.include_role:
|
|
||||||
|
- name: Git role
|
||||||
|
ansible.builtin.include_role:
|
||||||
name: git
|
name: git
|
||||||
tags: git
|
tags: git
|
||||||
|
|
||||||
|
- name: Scripts role
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: scripts
|
||||||
|
tags: scripts
|
||||||
|
Loading…
Reference in New Issue
Block a user