diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-12-24 09:56:20 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-12-24 09:56:20 -0800 |
commit | 47f435276a62b3eddac496de6a7e365631d57197 (patch) | |
tree | c22b839b6e0e1dc07fd85c021e6d36b271ceac83 /src/Text/Pandoc | |
parent | 9cbbf18fe18d740e12f564506079f3a2cb853be6 (diff) | |
download | pandoc-47f435276a62b3eddac496de6a7e365631d57197.tar.gz |
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.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Citeproc.hs | 4 |
1 files changed, 3 insertions, 1 deletions
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 |