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.
commit47f435276a62b3eddac496de6a7e365631d57197
authorJohn MacFarlane <jgm@berkeley.edu>
dateThu 24 Dec 2020, 09:56 (6 years ago)
parent9cbbf18
src/Text/Pandoc/Citeproc.hs+3−1
@@ -507,7 +507,9 @@ linkifyVariables ref =
507507 x'' = if "://" `T.isInfixOf` x'
508508 then x'
509509 else pref <> x'
510− in FancyVal (B.link x'' "" (B.str x'))
510+ in if T.null x'
511+ then x
512+ else FancyVal (B.link x'' "" (B.str x'))
511513
512514extractText :: Val Inlines -> Text
513515extractText (TextVal x) = x