From 920b1d5df49d0bf16084150ac0994807f9c66447 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 29 Mar 2023 23:33:04 -0500 Subject: Ready for testing --- wikme.scm | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'wikme.scm') diff --git a/wikme.scm b/wikme.scm index 7f992a3..74d672f 100644 --- a/wikme.scm +++ b/wikme.scm @@ -1,6 +1,7 @@ ;;; wikme.scm --- build a wiki from a folder of markdown --- executable (import (args) + (chicken pathname) (chicken process-context) (chicken port)) @@ -8,32 +9,44 @@ - ;; (make-wiki base-url ; base URL for links - ;; origin-dir ; origin directory - ;; destination-dir ; destination directory - ;; page-template ; template for pages - ;; file-transformers ; list of filename transformers - ;; transformers ; list of source transformer functions - ;; pages ; list of s - ;; ) - - -(define options - (list (args:make-option ))) +(define +opts+ + (list (args:make-option + (u base-url) (optional: "URL") + "Base URL for the generated Wiki.") + (args:make-option + (s source) (optional: "DIRECTORY") + "Directory containing source files (default: PWD).") + (args:make-option + (o out) (optional: "DIRECTORY") + "Directory in which to place rendered files (default: PWD/out).") + (args:make-option + (t template) (optional: "FILE") + "Template file for wiki pages (default: PWD/template.html)."))) (define (usage) (with-output-to-port (current-error-port) (lambda () - (print "Usage: " (car (argv)) " [options...] [directory]") + (print "Usage: " (car (argv)) " [options...]") (newline) - (print (args:usage options)))) + (print (args:usage +opts+)))) (exit 1)) (define (main args) (receive (options operands) - (args:parse args options) - #f)) + (args:parse args +opts+) + (render-wiki + (directory->wiki + (or (alist-ref 'source options) + (current-directory)) + #:base-url (or (alist-ref 'base-url options) + "https://www.example.com") + #:destination-directory (or (alist-ref 'out options) + (make-pathname + (current-directory) "out")) + #:page-template (or (alist-ref 'template options) + (make-pathname + (current-directory "template.html"))))))) (main (command-line-arguments)) -- cgit 1.4.1-21-gabe81