]> git.nbdom.net Git - nb.git/commitdiff
lib/lua/nb.lua
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Jun 2018 03:02:35 +0000 (04:02 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Jun 2018 03:02:35 +0000 (04:02 +0100)
lib/lua/nb.lua

index ade4b932c7783847ad819b74007d5aa523a559ff..9db7fa17187e924e56d1c577ba3e6ba23130c5f5 100644 (file)
@@ -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,'<h1[^>]*>(.*)</h1>',1) end
+               if not vars.title then vars.title = string.match(content,'<h1[^>]*>([^>]+)',1) end
                -- Extract title from h2
-               if not vars.title then vars.title = string.match(content,'<h2[^>]*>(.*)</h2>',1) end
+               if not vars.title then vars.title = string.match(content,'<h2[^>]*>([^>]+)',1) end
 
        elseif not ngx.ctx.tmpl_content then
                ishtml = false
-               if not vars.title then vars.title = string.match(content,'<title[^>]*>(.*)</title>',1) end
+               if not vars.title then vars.title = string.match(content,'<title[^>]*>([^>]+)</title>',1) end
        end
 
        -- Header and footer