@@ -135,8 +135,8 @@ processCitations (Pandoc meta bs) = do
135 Just ls | ls > 1 -> (("line-spacing",T.pack $ show ls):)
135 Just ls | ls > 1 -> (("line-spacing",T.pack $ show ls):)
136 _ -> id) $ []
136 _ -> id) $ []
137 let bibs = mconcat $ map (\(ident, out) ->
137 let bibs = mconcat $ map (\(ident, out) ->
138− B.divWith ("ref-" <> ident,["csl-entry"],[]) . B.para $
138+ B.divWith ("ref-" <> ident,["csl-entry"],[]) . B.para .
139− walk (convertQuotes locale) out)
139+ walk (convertQuotes locale) . insertSpace $ out)
140 (resultBibliography result)
140 (resultBibliography result)
141 let moveNotes = maybe True truish $
141 let moveNotes = maybe True truish $
142 lookupMeta "notes-after-punctuation" meta
142 lookupMeta "notes-after-punctuation" meta
@@ -155,6 +155,20 @@ processCitations (Pandoc meta bs) = do
156 return $ Pandoc meta'' $ insertRefs refkvs classes meta'' (B.toList bibs) bs'
156 return $ Pandoc meta'' $ insertRefs refkvs classes meta'' (B.toList bibs) bs'
158+-- If we have a span.csl-left-margin followed by span.csl-right-inline,
159+-- we insert a space. This ensures that they will be separated by a space,
160+-- even in formats that don't have special handling for the display spans.
161+insertSpace :: Inlines -> Inlines
163+ case Seq.viewl (unMany ils) of
164+ (Span ("",["csl-left-margin"],[]) xs) Seq.:< rest ->
165+ case Seq.lookup 0 rest of
166+ Just (Span ("",["csl-right-inline"],[]) _) ->
168+ Span ("",["csl-left-margin"],[]) (xs ++ [Space]) Seq.<| rest
158getRefsFromBib :: PandocMonad m
172getRefsFromBib :: PandocMonad m
159 => Locale -> (Text -> Bool) -> Text -> m [Reference Inlines]
173 => Locale -> (Text -> Bool) -> Text -> m [Reference Inlines]
160getRefsFromBib locale idpred t = do
174getRefsFromBib locale idpred t = do