#!/usr/bin/env guile !# (use-modules (ice-9 match)) ;; Remove the alias and make it better! ;; alias pandoc-xelatex="pandoc $@ --pdf-engine=xelatex --to latex -N" ;; alias elenqdoc-article="pandoc-xelatex $@ --standalone --template elenq-article --metadata=documentclass:article --resource-path=~/.pandoc:." ;; alias elenqdoc-book="pandoc-xelatex $@ --standalone --template elenq-book --metadata=documentclass:book --top-level-division=chapter --resource-path=~/.pandoc:." (define (pandoc-xelatex args) ;; If I don't want numbered sections: mark them as unnumbered or try to ;; `--number-sections=false` on top `("pandoc" "--pdf-engine=xelatex" "--to=latex" "-N" ,(string-append "--data-dir=" (getenv "ELENQDOC_DATADIR")) ,@args)) (define (invoke . args) (display "Calling: ") (display (string-join args " ")) (newline) (apply system* args)) (define (help) (format #t "Wrong command~%Use `book` or `article`.~%") (exit 1)) (define (main name command . args) (match command ("article" (apply invoke (pandoc-xelatex (cons* "--template=elenq-article" "--metadata=documentclass:article" args)))) ("book" (apply invoke (pandoc-xelatex (cons* "--template=elenq-book" "--metadata=documentclass:book" "--top-level-division=chapter" args)))) (else (help)))) (apply main (command-line))