htmlgen/readme.md

39 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

2024-08-26 21:40:45 -07:00
# htmlgen
2024-08-26 21:47:28 -07:00
tool for generating html from lisp code.<br>
used for natalieee.net.<br>
built around https://gist.github.com/markasoftware/ab357f1b967b3f656d026e33fec3bc0e<br>
2024-08-26 21:40:45 -07:00
## useage
2024-08-26 21:47:28 -07:00
templates/: used for templates<br>
src/: documents in lisp <br>
out/: where html will be written<br>
2024-08-26 21:40:45 -07:00
to compile, run `{clisp,sbcl} gen.lisp`
## example
templates/page.lisp for natalieee.net
```lisp
(load "./templates/header.lsp")
(load "./templates/footer.lsp")
(defun page (title html)
`(html (:lang "en")
(head ()
(meta (:http-equiv "content-type" :content "text/html; charset=utf-8"))
(meta (:name "viewport" :content "width=device-width, initial-scale=1"))
(link (:rel "stylesheet" :href "/style.css"))
(title () ,title))
(body ()
,(header)
(main ()
,html)
,(footer))))
```
example page:
```lisp
; this would have a path of src/example.lisp or similar
(defun html ()
(page "example" '(h1 () "example")))
```