Created
May 21, 2018 12:46
-
-
Save turbinenreiter/309fa8750489c0fe3205d16e0f1a3f5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require markdown) | |
(require web-server/servlet) | |
(provide/contract (start (request? . -> . response?))) | |
(define (article-fnames path-to-articles) | |
(directory-list (string->path path-to-articles))) | |
(define (article-paths path-to-articles article-fnames) | |
(map (lambda (fname) | |
(build-path path-to-articles fname)) | |
article-fnames)) | |
(define (article-paths->xeprs article-paths) | |
(map parse-markdown article-paths)) | |
(define fnames | |
(article-fnames "articles")) | |
(define articles | |
(article-paths->xeprs (article-paths "articles" fnames))) | |
;(define html | |
; (map (lambda (article) | |
; (map display-xexpr article)) | |
; articles)) | |
(define (start request) | |
(response/xexpr | |
`(html (head (title ,(path->string (first fnames)))) | |
(body ,(first articles))))) | |
(require web-server/servlet-env) | |
(serve/servlet start | |
#:launch-browser? #t | |
#:quit? #f | |
#:listen-ip #f | |
#:port 8000 | |
#:servlet-path | |
"/servlets/gantty.rkt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment