diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-11-07 12:18:53 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-11-07 12:18:53 -0800 |
commit | 20309691c38eff32b16c0cb734ecc350caaba220 (patch) | |
tree | cf351ce00db97acc5e21e74a09da40e2120e0f4f /src/Text/Pandoc/Writers/HTML.hs | |
parent | 9c7f75afb5d4e50ac915213eba0470c2d0ad304d (diff) | |
download | pandoc-20309691c38eff32b16c0cb734ecc350caaba220.tar.gz |
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.
Diffstat (limited to 'src/Text/Pandoc/Writers/HTML.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 8 |
1 files changed, 6 insertions, 2 deletions
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 |