]> git.nbdom.net Git - nb.git/commitdiff
lib/lua/nb.lua
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 8 May 2018 21:47:16 +0000 (22:47 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 8 May 2018 21:47:16 +0000 (22:47 +0100)
etc/vim/source/functions.vim
lib/lua/nb.lua

index 8ba7f98e16c1efbbe729a5b355fb0c5cf2d4cd0f..010a1d071481c76406774f4ba6d42d8d2e5f46ba 100644 (file)
@@ -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
index e67abc096075466b6c947641d6b2cf7ecc9ad388..9cc21070b099d4b8169ec6951c16e6f4281fda2e 100644 (file)
@@ -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)