From: Nicolas Boisselier Date: Tue, 8 May 2018 21:47:16 +0000 (+0100) Subject: lib/lua/nb.lua X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=cb8f3d914fe4995ba9aa460f2e729b1396a20da1;p=nb.git lib/lua/nb.lua --- diff --git a/etc/vim/source/functions.vim b/etc/vim/source/functions.vim index 8ba7f98e..010a1d07 100644 --- a/etc/vim/source/functions.vim +++ b/etc/vim/source/functions.vim @@ -106,6 +106,12 @@ func! FileInit(...) elseif (g:File['type'] == 'sh') let g:File['check'] = g:mimeCheck['bash'] + else + if (g:mimeCheck[g:File['ext']] != '') + let g:File['check'] = g:mimeCheck[g:File['ext']] + elseif (g:mimeCheck[g:File['type']] != '') + let g:File['check'] = g:mimeCheck[g:File['type']] + endif endif let $BASH_ENV = bashenv diff --git a/lib/lua/nb.lua b/lib/lua/nb.lua index e67abc09..9cc21070 100644 --- a/lib/lua/nb.lua +++ b/lib/lua/nb.lua @@ -21,6 +21,7 @@ function nb:_ngx_location_md() end function nb:ngx_location_md(fheader,ffooter) +-- See https://github.com/bungle/lua-resty-template -- location ~ \.(md|html)$ { -- default_type text/html; -- content_by_lua 'package.path = ngx.var.NB_ROOT .. "/lib/lua/?.lua;" .. package.path local nb = require("nb") nb:ngx_location_md()'; @@ -80,7 +81,7 @@ function nb:ngx_location_md(fheader,ffooter) ngx.print(content) - elseif string.match(file,'%.html$') then + else --if string.match(file,'%.html$') then -- Html -- template.render(content,vars) ngx.print(content)