From 47f435276a62b3eddac496de6a7e365631d57197 Mon Sep 17 00:00:00 2001 From: John MacFarlane <jgm@berkeley.edu> Date: Thu, 24 Dec 2020 09:56:20 -0800 Subject: [PATCH] Citeproc: fix handling of empty URL variables (`DOI`, etc.). The `linkifyVariables` function was changing these to links which then got treated as non-empty by citeproc, leading to wrong results (e.g. ignoring nonempty URL when empty DOI is present). Addresses part 2 of jgm/citeproc#41. --- src/Text/Pandoc/Citeproc.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs index ca1ab9f96..e87ddcbcd 100644 --- a/src/Text/Pandoc/Citeproc.hs +++ b/src/Text/Pandoc/Citeproc.hs @@ -507,7 +507,9 @@ linkifyVariables ref = x'' = if "://" `T.isInfixOf` x' then x' else pref <> x' - in FancyVal (B.link x'' "" (B.str x')) + in if T.null x' + then x + else FancyVal (B.link x'' "" (B.str x')) extractText :: Val Inlines -> Text extractText (TextVal x) = x