From 65e6a5f091d7b2313f9bc308f7685da89ee98ff9 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 11 Jun 2018 04:02:35 +0100 Subject: [PATCH] lib/lua/nb.lua --- lib/lua/nb.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 -- 2.47.3