about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-03-29 23:45:11 -0500
committerCase Duckworth2023-03-29 23:45:11 -0500
commit0f4890de4d9b0117bca058c74bcc4b41ec696197 (patch)
treef67067ba7be45d41b68b82187bb7c233ca79f125
parentReady for testing (diff)
downloadwikme-0f4890de4d9b0117bca058c74bcc4b41ec696197.tar.gz
wikme-0f4890de4d9b0117bca058c74bcc4b41ec696197.zip
Add README and Makefile
-rw-r--r--Makefile11
-rw-r--r--README.txt19
-rw-r--r--src/wikme.scm10
-rw-r--r--wikme.scm2
4 files changed, 38 insertions, 4 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..21b4479 --- /dev/null +++ b/Makefile
@@ -0,0 +1,11 @@
1# wikme
2
3PREFIX = /usr/bin
4
5wikme: wikme.scm src/wikme.scm
6 csc -o $@ wikme.scm
7
8.PHONY: install
9
10install: wikme
11 install -Dt $(DESTDIR)$(PREFIX)/$@ $<
diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..8fd6f44 --- /dev/null +++ b/README.txt
@@ -0,0 +1,19 @@
1wikme --- build a wiki out of a directory of markdown files
2
3made with <3 by case duckworth for kindrobot
4
5requirements:
6
7- cmark
8- chicken scheme with the following eggs:
9 - cmark
10 - srfi-152
11 - utf8
12
13build:
14
15- make
16
17install:
18
19- make install
diff --git a/src/wikme.scm b/src/wikme.scm index 752aa8b..14167d6 100644 --- a/src/wikme.scm +++ b/src/wikme.scm
@@ -50,12 +50,14 @@
50 (make-wiki base-url 50 (make-wiki base-url
51 directory 51 directory
52 destination-directory 52 destination-directory
53 page-template
53 file-transformers 54 file-transformers
54 transformers 55 transformers
55 '())) 56 '()))
56 57
57 (set! wiki-pages (map (lambda (f) (file->page f wiki)) 58 (set! (wiki-pages wiki)
58 (glob (make-pathname directory "*.md")))) 59 (map (lambda (f) (file->page f wiki))
60 (glob (make-pathname directory "*.md"))))
59 61
60 wiki) 62 wiki)
61 63
@@ -264,8 +266,10 @@
264 266
265(define (render-wiki wiki) 267(define (render-wiki wiki)
266 ;;; Render the files in WIKI to disk. 268 ;;; Render the files in WIKI to disk.
269 (create-directory (wiki-destination-dir wiki) #:parents)
267 (for-each (lambda (page) 270 (for-each (lambda (page)
268 (with-output-to-file (page-destination page) 271 (with-output-to-file (page-destination page)
269 (lambda () 272 (lambda ()
270 (write-string (render-page (wiki-page-template wiki) page))))) 273 (write-string
274 (render-page (wiki-page-template wiki) page)))))
271 (wiki-pages wiki))) 275 (wiki-pages wiki)))
diff --git a/wikme.scm b/wikme.scm index 74d672f..ac7111c 100644 --- a/wikme.scm +++ b/wikme.scm
@@ -47,6 +47,6 @@
47 (current-directory) "out")) 47 (current-directory) "out"))
48 #:page-template (or (alist-ref 'template options) 48 #:page-template (or (alist-ref 'template options)
49 (make-pathname 49 (make-pathname
50 (current-directory "template.html"))))))) 50 (current-directory) "template.html"))))))
51 51
52(main (command-line-arguments)) 52(main (command-line-arguments))