git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: restore old treatment of Span.

A Span is rendered with surrounding {braces}. This was a regression in 1.16. Closes #2624.

commit1506e62f48af931e389b812b82b63c2f6d0d12b9 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 9 Jan 2016, 12:16 (11 years ago) parent729911a
2 files changed+16−18
src/Text/Pandoc/Writers/LaTeX.hs+15−17 tests/writers-lang-and-dir.latex+1−1
src/Text/Pandoc/Writers/LaTeX.hs+15−17
@@ -810,28 +810,26 @@ isQuoted _ = False
810810inlineToLaTeX :: Inline -- ^ Inline to convert
811811 -> State WriterState Doc
812812inlineToLaTeX (Span (id',classes,kvs) ils) = do
813− let noEmph = "csl-no-emph" `elem` classes
814− let noStrong = "csl-no-strong" `elem` classes
815− let noSmallCaps = "csl-no-smallcaps" `elem` classes
816− let rtl = ("dir","rtl") `elem` kvs
817− let ltr = ("dir","ltr") `elem` kvs
818813 ref <- toLabel id'
819814 let linkAnchor = if null id'
820815 then empty
821816 else "\\protect\\hypertarget" <> braces (text ref) <>
822817 braces empty
823− fmap (linkAnchor <>)
824− ((if noEmph then inCmd "textup" else id) .
825− (if noStrong then inCmd "textnormal" else id) .
826− (if noSmallCaps then inCmd "textnormal" else id) .
827− (if rtl then inCmd "RL" else id) .
828− (if ltr then inCmd "LR" else id) .
829− (case lookup "lang" kvs of
830− Just lng -> let (l, o) = toPolyglossia $ splitBy (=='-') lng
831− ops = if null o then "" else brackets (text o)
832− in \c -> char '\\' <> "text" <> text l <> ops <> braces c
833− Nothing -> id)
834− ) `fmap` inlineListToLaTeX ils
818+ let cmds = ["textup" | "csl-no-emph" `elem` classes] ++
819+ ["textnormal" | "csl-no-strong" `elem` classes ||
820+ "csl-no-smallcaps" `elem` classes] ++
821+ ["RL" | ("dir", "rtl") `elem` kvs] ++
822+ ["LR" | ("dir", "ltr") `elem` kvs] ++
823+ (case lookup "lang" kvs of
824+ Just lng -> let (l, o) = toPolyglossia $ splitBy (=='-') lng
825+ ops = if null o then "" else ("[" ++ o ++ "]")
826+ in ["text" ++ l ++ ops]
827+ Nothing -> [])
828+ contents <- inlineListToLaTeX ils
829+ return $ linkAnchor <>
830+ if null cmds
831+ then braces contents
832+ else foldr inCmd contents cmds
835833inlineToLaTeX (Emph lst) =
836834 inlineListToLaTeX lst >>= return . inCmd "emph"
837835inlineToLaTeX (Strong lst) =
tests/writers-lang-and-dir.latex+1−1
@@ -89,7 +89,7 @@ div contents
8989
9090and more text.
9191
92−Next paragraph with a span and a word-thatincludesaspanright?
92+Next paragraph with a {span} and a word-thatincludesa{span}right?
9393
9494\section{Directionality}\label{directionality}
9595