incd-parser/main.fnl
2024-01-17 21:07:41 -08:00

26 lines
683 B
Fennel

(local fennel (require :fennel))
(fn _G.pp [x] (print (fennel.view x)))
(local blocks (require :block))
(local inline (require :inline))
(local render (require :render))
(fn write-file [text]
(_G.pp text)
(let [f (assert (io.open "./test.html" :w))]
(f:write text)
(f:close)))
(fn render-to-html [input]
(let [b-blocks (-> input
(blocks.lexer blocks.grammar))
inline-blocks (inline.inline-lexer b-blocks inline.inline-grammar)
(html metadata) (render.render inline-blocks render.render-grammar)]
; (_G.pp b-blocks)
; (_G.pp inline-blocks)
; (_G.pp metadata)
(values html metadata)))
{: write-file
: render-to-html}