From: Nicolas Boisselier Date: Mon, 11 Jun 2018 03:02:35 +0000 (+0100) Subject: lib/lua/nb.lua X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=65e6a5f091d7b2313f9bc308f7685da89ee98ff9;p=nb.git lib/lua/nb.lua --- diff --git a/lib/lua/nb.lua b/lib/lua/nb.lua index ade4b932..9db7fa17 100644 --- a/lib/lua/nb.lua +++ b/lib/lua/nb.lua @@ -74,14 +74,15 @@ function nb:ngx_location_tmpl(fheader,ffooter) content = self:md2html(content) elseif string.match(file,'%.html?$') then + local i = '<[^>]+>' -- Extract title from h1 - if not vars.title then vars.title = string.match(content,']*>(.*)',1) 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,']*>(.*)',1) end + if not vars.title then vars.title = string.match(content,']*>([^>]+)',1) end elseif not ngx.ctx.tmpl_content then ishtml = false - if not vars.title then vars.title = string.match(content,']*>(.*)',1) end + if not vars.title then vars.title = string.match(content,']*>([^>]+)',1) end end -- Header and footer