diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-01-09 12:16:24 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-01-09 12:16:24 -0800 |
commit | 1506e62f48af931e389b812b82b63c2f6d0d12b9 (patch) | |
tree | 261a03fde6e2cf3ff9f072769d4dbf9862b2d6ed /src/Text/Pandoc | |
parent | 729911ad74254742251669f27cc432751644d238 (diff) | |
download | pandoc-1506e62f48af931e389b812b82b63c2f6d0d12b9.tar.gz |
LaTeX writer: restore old treatment of Span.
A Span is rendered with surrounding {braces}.
This was a regression in 1.16. Closes #2624.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 025915c37..2dcbf62bf 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -810,28 +810,26 @@ isQuoted _ = False inlineToLaTeX :: Inline -- ^ Inline to convert -> State WriterState Doc inlineToLaTeX (Span (id',classes,kvs) ils) = do - let noEmph = "csl-no-emph" `elem` classes - let noStrong = "csl-no-strong" `elem` classes - let noSmallCaps = "csl-no-smallcaps" `elem` classes - let rtl = ("dir","rtl") `elem` kvs - let ltr = ("dir","ltr") `elem` kvs ref <- toLabel id' let linkAnchor = if null id' then empty else "\\protect\\hypertarget" <> braces (text ref) <> braces empty - fmap (linkAnchor <>) - ((if noEmph then inCmd "textup" else id) . - (if noStrong then inCmd "textnormal" else id) . - (if noSmallCaps then inCmd "textnormal" else id) . - (if rtl then inCmd "RL" else id) . - (if ltr then inCmd "LR" else id) . - (case lookup "lang" kvs of - Just lng -> let (l, o) = toPolyglossia $ splitBy (=='-') lng - ops = if null o then "" else brackets (text o) - in \c -> char '\\' <> "text" <> text l <> ops <> braces c - Nothing -> id) - ) `fmap` inlineListToLaTeX ils + let cmds = ["textup" | "csl-no-emph" `elem` classes] ++ + ["textnormal" | "csl-no-strong" `elem` classes || + "csl-no-smallcaps" `elem` classes] ++ + ["RL" | ("dir", "rtl") `elem` kvs] ++ + ["LR" | ("dir", "ltr") `elem` kvs] ++ + (case lookup "lang" kvs of + Just lng -> let (l, o) = toPolyglossia $ splitBy (=='-') lng + ops = if null o then "" else ("[" ++ o ++ "]") + in ["text" ++ l ++ ops] + Nothing -> []) + contents <- inlineListToLaTeX ils + return $ linkAnchor <> + if null cmds + then braces contents + else foldr inCmd contents cmds inlineToLaTeX (Emph lst) = inlineListToLaTeX lst >>= return . inCmd "emph" inlineToLaTeX (Strong lst) = |