added poems and redesigned
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
index.html
|
index.html
|
||||||
|
out/
|
||||||
|
40
compile.zp
40
compile.zp
@@ -4,28 +4,48 @@
|
|||||||
(import-all "mustache")
|
(import-all "mustache")
|
||||||
(import-all "pandoc")
|
(import-all "pandoc")
|
||||||
|
|
||||||
(define tpl (read-contents "layout.html"))
|
(define post-tpl (read-contents "post.html"))
|
||||||
|
(define list-tpl (read-contents "list.html"))
|
||||||
(define poem-dir "poems/")
|
(define poem-dir "poems/")
|
||||||
|
(define out-dir "out/")
|
||||||
|
|
||||||
(define (all-poems)
|
(define (all-sites)
|
||||||
(let* ((ls (os:ls poem-dir))
|
(let* ((ls (os:ls poem-dir))
|
||||||
(ls (filter ($ (not (in? ["." ".."] %))) ls)))
|
(ls (filter ($ (not (in? ["." ".."] %))) ls)))
|
||||||
(map (curry ++ poem-dir) ls)))
|
ls))
|
||||||
|
|
||||||
(define (from-path file)
|
(define (all-poems elem)
|
||||||
(regex:sub r/.md$/ "" (list:last (string:split file "/"))))
|
(let* ((dir (++ poem-dir elem "/"))
|
||||||
|
(ls (os:ls dir))
|
||||||
|
(ls (filter ($ (not (in? ["." ".."] %))) ls)))
|
||||||
|
(map (curry ++ dir) ls)))
|
||||||
|
|
||||||
|
(define (filename file)
|
||||||
|
(list:last (string:split file "/")))
|
||||||
|
|
||||||
(define (treat str)
|
(define (treat str)
|
||||||
(regex:gsub r/<br \/>/ "</p><p>" (regex:gsub r/<p>/ "<p class='paragraph'>" str)))
|
(regex:gsub r/<br \/>/ "</p><p>" (regex:gsub r/<p>/ "<p class='paragraph'>" str)))
|
||||||
|
|
||||||
(define (render targets)
|
(define (render name targets)
|
||||||
(let* ((strs (map read-contents targets))
|
(let* ((strs (map read-contents targets))
|
||||||
(args (make-hash
|
(args (make-hash
|
||||||
"poems" (map (compose treat
|
"poems" (map (compose treat
|
||||||
(curry pandoc:convert "markdown" "html"))
|
(curry pandoc:convert "markdown" "html"))
|
||||||
strs))))
|
strs))))
|
||||||
(with-output-file "index.html"
|
(with-output-file name
|
||||||
(curry write (mustache:template tpl args)))))
|
(curry write (mustache:template post-tpl args)))))
|
||||||
|
|
||||||
(let ((targets (all-poems)))
|
(define (make-index elems)
|
||||||
(render targets))
|
(let ((names (map ($ (make-hash
|
||||||
|
"name" (regex:gsub r/_/ " " %)
|
||||||
|
"url" (++ % ".html")))
|
||||||
|
elems)))
|
||||||
|
(with-output-file "index.html"
|
||||||
|
(curry write (mustache:template list-tpl (make-hash "names" names))))))
|
||||||
|
|
||||||
|
(let ((elems (all-sites)))
|
||||||
|
(map (lambda (elem)
|
||||||
|
(let ((targets (all-poems elem)))
|
||||||
|
(render (++ out-dir elem ".html") targets)))
|
||||||
|
elems)
|
||||||
|
(make-index elems))
|
||||||
|
15
list.html
Normal file
15
list.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Veit's Poems</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/poems/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="links">
|
||||||
|
{{#names}}
|
||||||
|
<a class="elem" href="./{{url}}">{{name}}</a>
|
||||||
|
{{/names}}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
23
style.css
23
style.css
@@ -70,3 +70,26 @@ p {
|
|||||||
size: auto;
|
size: auto;
|
||||||
margin: 0mm;
|
margin: 0mm;
|
||||||
}
|
}
|
||||||
|
#links {
|
||||||
|
max-width: 600px;
|
||||||
|
padding-top: 10vh;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.elem {
|
||||||
|
display: block;
|
||||||
|
width: 300px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #000;
|
||||||
|
margin: 1em;
|
||||||
|
font-size: 23px;
|
||||||
|
border-bottom: 5px solid;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.elem:nth-child(odd) {
|
||||||
|
margin-left: 2em;
|
||||||
|
}
|
||||||
|
.elem:hover {
|
||||||
|
color: #666;
|
||||||
|
border-color: #666;
|
||||||
|
padding-left: 2em;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user