diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2025-01-08 18:40:41 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2025-01-08 19:12:09 +0100 |
commit | 1cb21742a69f681e6452a7ddd0adc9543aefd72a (patch) | |
tree | 4b511b549ba96881c8a60523201d5e0ff4864926 |
Initial commit
-rwxr-xr-x | elenqdoc | 43 |
1 files changed, 43 insertions, 0 deletions
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)) |