about summary refs log tree commit diff stats
path: root/wikme.scm
diff options
context:
space:
mode:
authorCase Duckworth2023-04-03 08:57:02 -0500
committerCase Duckworth2023-04-03 08:57:02 -0500
commit42474bb6c851314d804c89b1501b49eed0e6005f (patch)
tree81d7c77b1817ade3ca8c40d17c0b5c3672c319a8 /wikme.scm
parentReorganize (diff)
downloadwikme-42474bb6c851314d804c89b1501b49eed0e6005f.tar.gz
wikme-42474bb6c851314d804c89b1501b49eed0e6005f.zip
It builds now
Diffstat (limited to 'wikme.scm')
-rw-r--r--wikme.scm56
1 files changed, 4 insertions, 52 deletions
diff --git a/wikme.scm b/wikme.scm index b0a5177..10b1a1a 100644 --- a/wikme.scm +++ b/wikme.scm
@@ -1,52 +1,4 @@
1;;; wikme.scm --- build a wiki from a folder of markdown --- executable 1(module wikme *
2 2 (import scheme
3(import (args) 3 (chicken base))
4 (chicken pathname) 4 (include "wikme-impl.scm"))
5 (chicken process-context)
6 (chicken port))
7
8(include "wikme-module")
9
10
11
12(define +opts+
13 (list (args:make-option
14 (u base-url) (optional: "URL")
15 "Base URL for the generated Wiki.")
16 (args:make-option
17 (s source) (optional: "DIRECTORY")
18 "Directory containing source files (default: PWD).")
19 (args:make-option
20 (o out) (optional: "DIRECTORY")
21 "Directory in which to place rendered files (default: PWD/out).")
22 (args:make-option
23 (t template) (optional: "FILE")
24 "Template file for wiki pages (default: PWD/template.html).")))
25
26
27
28(define (usage)
29 (with-output-to-port (current-error-port)
30 (lambda ()
31 (print "Usage: " (car (argv)) " [options...]")
32 (newline)
33 (print (args:usage +opts+))))
34 (exit 1))
35
36(define (main args)
37 (receive (options operands)
38 (args:parse args +opts+)
39 (render-wiki
40 (directory->wiki
41 (or (alist-ref 'source options)
42 (current-directory))
43 #:base-url (or (alist-ref 'base-url options)
44 "https://www.example.com")
45 #:destination-directory (or (alist-ref 'out options)
46 (make-pathname
47 (current-directory) "out"))
48 #:page-template (or (alist-ref 'template options)
49 (make-pathname
50 (current-directory) "template.html"))))))
51
52(main (command-line-arguments))