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.
This commit is contained in:
John MacFarlane 2020-12-24 09:56:20 -08:00
parent 9cbbf18fe1
commit 47f435276a

View file

@ -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