@@ -553,9 +553,7 @@ blockToLaTeX (Div (identifier,classes,kvs) bs) = do
553 Just s -> braces (literal s))
553 Just s -> braces (literal s))
555 $+$ "\\end{CSLReferences}"
555 $+$ "\\end{CSLReferences}"
556− else if "csl-entry" `elem` classes
557− then vcat <$> mapM cslEntryToLaTeX bs
558− else blockListToLaTeX bs
556+ else blockListToLaTeX bs
559 modify $ \st -> st{ stIncremental = oldIncremental }
557 modify $ \st -> st{ stIncremental = oldIncremental }
560 linkAnchor' <- hypertarget True identifier empty
558 linkAnchor' <- hypertarget True identifier empty
561 -- see #2704 for the motivation for adding \leavevmode:
559 -- see #2704 for the motivation for adding \leavevmode:
@@ -1180,23 +1178,6 @@ isQuoted :: Inline -> Bool
1180isQuoted (Quoted _ _) = True
1178isQuoted (Quoted _ _) = True
1181isQuoted _ = False
1179isQuoted _ = False
1183−cslEntryToLaTeX :: PandocMonad m
1186−cslEntryToLaTeX (Para xs) =
1187− mconcat <$> mapM go xs
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
1200-- | Convert inline element to LaTeX
1181-- | Convert inline element to LaTeX
1201inlineToLaTeX :: PandocMonad m
1182inlineToLaTeX :: PandocMonad m
1202 => Inline -- ^ Inline to convert
1183 => Inline -- ^ Inline to convert
@@ -1204,23 +1185,38 @@ inlineToLaTeX :: PandocMonad m
1204inlineToLaTeX (Span (id',classes,kvs) ils) = do
1185inlineToLaTeX (Span (id',classes,kvs) ils) = do
1205 linkAnchor <- hypertarget False id' empty
1186 linkAnchor <- hypertarget False id' empty
1206 lang <- toLang $ lookup "lang" kvs
1187 lang <- toLang $ lookup "lang" kvs
1207− let cmds = ["textup" | "csl-no-emph" `elem` classes] ++
1188+ let classToCmd "csl-no-emph" = Just "textup"
1208− ["textnormal" | "csl-no-strong" `elem` classes ||
1189+ classToCmd "csl-no-strong" = Just "textnormal"
1209− "csl-no-smallcaps" `elem` classes] ++
1190+ classToCmd "csl-no-smallcaps" = Just "textnormal"
1210− ["RL" | ("dir", "rtl") `elem` kvs] ++
1191+ classToCmd "csl-block" = Just "CSLBlock"
1211− ["LR" | ("dir", "ltr") `elem` kvs] ++
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
1212− (case lang of
1200+ case lang of
1213− Just lng -> let (l, o) = toPolyglossia lng
1201+ Just lng -> let (l, o) = toPolyglossia lng
1214− ops = if T.null o then "" else "[" <> o <> "]"
1202+ ops = if T.null o then "" else "[" <> o <> "]"
1215− in ["text" <> l <> ops]
1203+ in ["text" <> l <> ops]
1216− Nothing -> [])
1204+ Nothing -> []
1205+ let cmds = mapMaybe classToCmd classes ++ mapMaybe kvToCmd kvs ++ langCmds
1217 contents <- inlineListToLaTeX ils
1206 contents <- inlineListToLaTeX ils
1209+ ["csl-block"] -> (cr <>)
1210+ ["csl-left-margin"] -> (cr <>)
1211+ ["csl-right-inline"] -> (cr <>)
1212+ ["csl-indent"] -> (cr <>)
1218− return $ (if T.null id'
1214+ (if T.null id'
1219− then empty
1215+ then empty
1220− else "\\protect" <> linkAnchor) <>
1216+ else "\\protect" <> linkAnchor) <>
1221− (if null cmds
1217+ (if null cmds
1222− then braces contents
1218+ then braces contents
1223− else foldr inCmd contents cmds)
1219+ else foldr inCmd contents cmds)
1224inlineToLaTeX (Emph lst) = inCmd "emph" <$> inlineListToLaTeX lst
1220inlineToLaTeX (Emph lst) = inCmd "emph" <$> inlineListToLaTeX lst
1225inlineToLaTeX (Underline lst) = inCmd "underline" <$> inlineListToLaTeX lst
1221inlineToLaTeX (Underline lst) = inCmd "underline" <$> inlineListToLaTeX lst
1226inlineToLaTeX (Strong lst) = inCmd "textbf" <$> inlineListToLaTeX lst
1222inlineToLaTeX (Strong lst) = inCmd "textbf" <$> inlineListToLaTeX lst