/ main.fnl
main.fnl
 1  (local fennel (require :fennel)) 
 2  (fn _G.pp [x] (print (fennel.view x)))
 3  
 4  (local blocks (require :block))
 5  (local inline (require :inline))
 6  (local render (require :render))
 7  
 8  (fn write-file [text]
 9    (_G.pp text)
10    (let [f (assert (io.open "./test.html" :w))]
11      (f:write text)
12      (f:close)))
13  
14  (fn render-to-html [input]
15    (let [b-blocks (-> input
16                      (blocks.lexer blocks.grammar))
17          inline-blocks (inline.inline-lexer b-blocks inline.inline-grammar)
18          (html metadata) (render.render inline-blocks render.render-grammar)]
19     ; (_G.pp b-blocks)
20     ; (_G.pp inline-blocks)
21     ; (_G.pp metadata)
22     (values html metadata)))
23  
24  {: write-file
25   : render-to-html}