aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Citeproc.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs
index 732c60f29..528be6cd7 100644
--- a/src/Text/Pandoc/Citeproc.hs
+++ b/src/Text/Pandoc/Citeproc.hs
@@ -164,7 +164,9 @@ processCitations (Pandoc meta bs) = do
walk (fixQuotes . mvPunct moveNotes locale) $ walk deNote $
evalState (walkM insertResolvedCitations $ Pandoc meta' bs)
$ cits
- return $ Pandoc meta'' $ insertRefs refkvs classes meta'' (B.toList bibs) bs'
+ return $ Pandoc meta''
+ $ insertRefs refkvs classes meta''
+ (walk fixLinks $ B.toList bibs) bs'
-- If we have a span.csl-left-margin followed by span.csl-right-inline,
-- we insert a space. This ensures that they will be separated by a space,
@@ -376,6 +378,15 @@ mvPunct moveNotes locale (Cite cs ils : Str "." : ys)
mvPunct moveNotes locale (x:xs) = x : mvPunct moveNotes locale xs
mvPunct _ _ [] = []
+-- move https://doi.org etc. prefix inside link text (#6723):
+fixLinks :: [Inline] -> [Inline]
+fixLinks (Str t : Link attr [Str u1] (u2,tit) : xs)
+ | t <> u1 == u2
+ = Link attr [Str (t <> u1)] (u2,tit) : fixLinks xs
+fixLinks (x:xs) = x : fixLinks xs
+fixLinks [] = []
+
+
endWithPunct :: Bool -> [Inline] -> Bool
endWithPunct _ [] = False
endWithPunct onlyFinal xs@(_:_) =