From: Nicolas Boisselier Date: Sun, 27 May 2018 03:18:22 +0000 (+0100) Subject: lib/lua/nb.lua X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=c07c9034030e48c4a8b83c652501e5386bc1de8a;p=nb.git lib/lua/nb.lua --- diff --git a/lib/lua/nb.lua b/lib/lua/nb.lua index 5e5fc6d5..2e3ed826 100644 --- a/lib/lua/nb.lua +++ b/lib/lua/nb.lua @@ -67,16 +67,16 @@ function nb:ngx_location_tmpl(fheader,ffooter) content = self:md2html(content) -- Extract title from h1 - if not vars.title then vars.title = string.match(content,'^#[\t ]*([^\r\n]+)') end + if not vars.title then vars.title = string.match(content,'^#[\t ]*([^\r\n]+)',1) end -- Extract title from h2 - if not vars.title then vars.title = string.match(content,'##[\t ]*([^\r\n]+)') end + if not vars.title then vars.title = string.match(content,'##[\t ]*([^\r\n]+)',1) end elseif string.match(file,'%.html?$') then -- Extract title from h1 - if not vars.title then vars.title = string.match(content,']*>(.*?)') end + if not vars.title then vars.title = string.match(content,']*>(.*)',1) end -- Extract title from h2 - if not vars.title then vars.title = string.match(content,']*>(.*?)') end + if not vars.title then vars.title = string.match(content,']*>(.*)',1) end elseif not ngx.ctx.tmpl_content then ishtml = false