]> git.nbdom.net Git - nb.git/commitdiff
lib/lua/nb.lua
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 9 May 2018 02:20:20 +0000 (03:20 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 9 May 2018 02:20:20 +0000 (03:20 +0100)
lib/lua/nb.lua

index 9cc21070b099d4b8169ec6951c16e6f4281fda2e..67cc0e52a55984cb2da457c97793695bf0f2bcd6 100644 (file)
@@ -5,7 +5,7 @@ local nb = {
        dev = 1,
 } 
 
-if ngx.var.PRODUCTION then nb.dev = 0 end
+if ngx.var.PRODUCTION == 'yes' then nb.dev = 0 end
 function nb:readall(file)
        -- local f = io.open(file) or error("Could not open file: " .. file)
        local f = io.open(file)
@@ -30,6 +30,7 @@ function nb:ngx_location_md(fheader,ffooter)
        if not ffooter then ffooter = ngx.var.document_root .. "/footer.html" end
 
        local template = require "resty.template"
+       -- template.markdown = require "resty.hoedown"
        if self.dev then template.caching(false) end
 
        local file = ngx.var.document_root .. ngx.var.uri;
@@ -66,6 +67,7 @@ function nb:ngx_location_md(fheader,ffooter)
        local header = nb:readall(fheader)
        if header then template.render(header,vars) end
 
+       -- content = '{(header.html)}{*markdown[[' .. content .. ']]*}{footer.html)}'
        content = template.output(template.compile(content)(vars))
        if string.match(file,'%.md$') then
                -- Markdown