From 20309691c38eff32b16c0cb734ecc350caaba220 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 7 Nov 2019 12:18:53 -0800 Subject: Fix list fields in Opt so they aren't reversed. Previously optIncludeInHeader, etc. were in reverse order. This has been changed to promote #5881. Note also that the `sourcefile` variable used to be sometimes a string, sometimes a list (when there was more than one). Now it is always a list. --- src/Text/Pandoc/Writers/HTML.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Writers') diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 783aaa8fd..3971b7740 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -223,8 +223,12 @@ writeHtmlString' st opts d = do case getField "pagetitle" context of Just (s :: Text) | not (T.null s) -> return context _ -> do - let fallback = maybe "Untitled" (takeBaseName . T.unpack) $ - lookupContext "sourcefile" (writerVariables opts) + let fallback = + case lookupContext "sourcefile" + (writerVariables opts) of + Nothing -> "Untitled" + Just [] -> "Untitled" + Just (x:_) -> takeBaseName $ T.unpack x report $ NoTitleElement fallback return $ resetField "pagetitle" (T.pack fallback) context return $ render Nothing $ renderTemplate tpl -- cgit v1.2.3