From 1cb21742a69f681e6452a7ddd0adc9543aefd72a Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Wed, 8 Jan 2025 18:40:41 +0100 Subject: Initial commit --- elenqdoc | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 elenqdoc diff --git a/elenqdoc b/elenqdoc new file mode 100755 index 0000000..aa4ed2f --- /dev/null +++ b/elenqdoc @@ -0,0 +1,43 @@ +#!/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)) -- cgit v1.2.3