You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
#! /usr/bin/env sh |
|
exec guile -e '(@ (bible2latex) main)' -s "$0" "$@" |
|
!# |
|
|
|
(define-module (bible2latex) |
|
#:use-module (bible-tools) |
|
#:use-module (bible-tools latex-export) |
|
#:use-module (srfi srfi-1) |
|
#:use-module (srfi srfi-26) |
|
#:export (main)) |
|
|
|
(define print-text (compose display as-latex)) |
|
|
|
(define (help) |
|
(display "Usage: bible2latex [-b book] [-c chapter] [-h] [-v]\n") |
|
(display "\t-b book\t\texport the book to latex\n") |
|
(display "\t-c chapter\texport this chapter to latex\n") |
|
(display "\t-h\t\tdisplay this help message\n") |
|
(display "\t-v\t\tdisplay the current version\n")) |
|
|
|
(define (version) |
|
(display "bible2latex v1.0.0\n")) |
|
|
|
(define (main args) |
|
(define flag? (cut member <> args)) |
|
(define get (compose cadr flag?)) |
|
(define-syntax conf |
|
(syntax-rules (else) |
|
((_ (f e)... (else g)) (cond ((flag? f) e)... (else g))))) |
|
(with-bible "jantzen" |
|
(conf ("-h" (help)) |
|
("-v" (version)) |
|
("-b" (if (flag? "-c") |
|
(call-with-chapter (get "-b") (get "-c") |
|
print-text) |
|
(call-with-book (get "-b") print-text))) |
|
(else print-text))))
|
|
|