From eb8b8294923e6421a65ef01464926947cc22dfea Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 30 Nov 2023 15:22:48 -1000 Subject: [PATCH] filter cleanups --- headings.lua | 3 ++- wikilinks.lua | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/headings.lua b/headings.lua index 45def9f..75ee75e 100644 --- a/headings.lua +++ b/headings.lua @@ -1,5 +1,6 @@ --- Make all headings (except the page h1 added by page.tmpl) +-- Make all headings (except the h1 added by page.tmpl) -- clickable links to themselves, for easy bookmarking/linking. +-- site.css controls their style. function Header(el) el.content = pandoc.Link(el.content, '#' .. el.identifier) diff --git a/wikilinks.lua b/wikilinks.lua index cde68e8..ea29ce2 100644 --- a/wikilinks.lua +++ b/wikilinks.lua @@ -16,14 +16,15 @@ function Link(el) -- t = t:gsub(t, "'", "") path, frag = t:match("([^#]*)#([^#]*)") t = path - if path:len() > 0 and not ( + if not ( + path:len() == 0 or path:match('%.html$') or path:match('%.%.$') or path:match('/$') ) then t = t .. ".html" end - if string.len(frag) > 0 then + if frag:len() > 0 then frag = pandoc.text.lower(frag) t = t .. "#" .. frag end