]> git.nbdom.net Git - nb.git/commitdiff
lib/lua/nb.lua
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 27 May 2018 03:18:22 +0000 (04:18 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 27 May 2018 03:18:22 +0000 (04:18 +0100)
lib/lua/nb.lua

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