From cb8f3d914fe4995ba9aa460f2e729b1396a20da1 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 8 May 2018 22:47:16 +0100 Subject: [PATCH] lib/lua/nb.lua --- etc/vim/source/functions.vim | 6 ++++++ lib/lua/nb.lua | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) 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) -- 2.47.3