@@ -553,9 +553,7 @@ blockToLaTeX (Div (identifier,classes,kvs) bs) = do
553553 Just s -> braces (literal s))
554554 $$ inner
555555 $+$ "\\end{CSLReferences}"
556− else if "csl-entry" `elem` classes
557− then vcat <$> mapM cslEntryToLaTeX bs
558− else blockListToLaTeX bs
556+ else blockListToLaTeX bs
559557 modify $ \st -> st{ stIncremental = oldIncremental }
560558 linkAnchor' <- hypertarget True identifier empty
561559 -- see #2704 for the motivation for adding \leavevmode:
@@ -1180,23 +1178,6 @@ isQuoted :: Inline -> Bool
11801178isQuoted (Quoted _ _) = True
11811179isQuoted _ = False
11821180
1183−cslEntryToLaTeX :: PandocMonad m
1184− => Block
1185− -> LW m (Doc Text)
1186−cslEntryToLaTeX (Para xs) =
1187− mconcat <$> mapM go xs
1188− where
1189− go (Span ("",["csl-block"],[]) ils) =
1190− (cr <>) . inCmd "CSLBlock" <$> inlineListToLaTeX ils
1191− go (Span ("",["csl-left-margin"],[]) ils) =
1192− inCmd "CSLLeftMargin" <$> inlineListToLaTeX ils
1193− go (Span ("",["csl-right-inline"],[]) ils) =
1194− (cr <>) . inCmd "CSLRightInline" <$> inlineListToLaTeX ils
1195− go (Span ("",["csl-indent"],[]) ils) =
1196− (cr <>) . inCmd "CSLIndent" <$> inlineListToLaTeX ils
1197− go il = inlineToLaTeX il
1198−cslEntryToLaTeX x = blockToLaTeX x
1199−
12001181-- | Convert inline element to LaTeX
12011182inlineToLaTeX :: PandocMonad m
12021183 => Inline -- ^ Inline to convert
@@ -1204,23 +1185,38 @@ inlineToLaTeX :: PandocMonad m
12041185inlineToLaTeX (Span (id',classes,kvs) ils) = do
12051186 linkAnchor <- hypertarget False id' empty
12061187 lang <- toLang $ lookup "lang" kvs
1207− let cmds = ["textup" | "csl-no-emph" `elem` classes] ++
1208− ["textnormal" | "csl-no-strong" `elem` classes ||
1209− "csl-no-smallcaps" `elem` classes] ++
1210− ["RL" | ("dir", "rtl") `elem` kvs] ++
1211− ["LR" | ("dir", "ltr") `elem` kvs] ++
1212− (case lang of
1213− Just lng -> let (l, o) = toPolyglossia lng
1214− ops = if T.null o then "" else "[" <> o <> "]"
1215− in ["text" <> l <> ops]
1216− Nothing -> [])
1188+ let classToCmd "csl-no-emph" = Just "textup"
1189+ classToCmd "csl-no-strong" = Just "textnormal"
1190+ classToCmd "csl-no-smallcaps" = Just "textnormal"
1191+ classToCmd "csl-block" = Just "CSLBlock"
1192+ classToCmd "csl-left-margin" = Just "CSLLeftMargin"
1193+ classToCmd "csl-right-inline" = Just "CSLRightInline"
1194+ classToCmd "csl-indent" = Just "CSLIndent"
1195+ classToCmd _ = Nothing
1196+ kvToCmd ("dir","rtl") = Just "RL"
1197+ kvToCmd ("dir","ltr") = Just "LR"
1198+ kvToCmd _ = Nothing
1199+ langCmds =
1200+ case lang of
1201+ Just lng -> let (l, o) = toPolyglossia lng
1202+ ops = if T.null o then "" else "[" <> o <> "]"
1203+ in ["text" <> l <> ops]
1204+ Nothing -> []
1205+ let cmds = mapMaybe classToCmd classes ++ mapMaybe kvToCmd kvs ++ langCmds
12171206 contents <- inlineListToLaTeX ils
1218− return $ (if T.null id'
1219− then empty
1220− else "\\protect" <> linkAnchor) <>
1221− (if null cmds
1222− then braces contents
1223− else foldr inCmd contents cmds)
1207+ return $
1208+ (case classes of
1209+ ["csl-block"] -> (cr <>)
1210+ ["csl-left-margin"] -> (cr <>)
1211+ ["csl-right-inline"] -> (cr <>)
1212+ ["csl-indent"] -> (cr <>)
1213+ _ -> id) $
1214+ (if T.null id'
1215+ then empty
1216+ else "\\protect" <> linkAnchor) <>
1217+ (if null cmds
1218+ then braces contents
1219+ else foldr inCmd contents cmds)
12241220inlineToLaTeX (Emph lst) = inCmd "emph" <$> inlineListToLaTeX lst
12251221inlineToLaTeX (Underline lst) = inCmd "underline" <$> inlineListToLaTeX lst
12261222inlineToLaTeX (Strong lst) = inCmd "textbf" <$> inlineListToLaTeX lst