From d8b4e45be0b22aa5939add501339b64252d802ea Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 7 Jun 2019 10:03:10 -0700 Subject: LaTeX writer: Include inline code attributes with `--listings`. Closes #5420. --- src/Text/Pandoc/Writers/LaTeX.hs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index e0cdd2054..467ef304a 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -1148,14 +1148,22 @@ inlineToLaTeX (Cite cits lst) = do Biblatex -> citationsToBiblatex cits _ -> inlineListToLaTeX lst -inlineToLaTeX (Code (_,classes,_) str) = do +inlineToLaTeX (Code (_,classes,kvs) str) = do opts <- gets stOptions inHeading <- gets stInHeading inItem <- gets stInItem let listingsCode = do - let listingsopt = case getListingsLanguage classes of - Just l -> "[language=" ++ mbBraced l ++ "]" - Nothing -> "" + let listingsopts = (case getListingsLanguage classes of + Just l -> (("language", mbBraced l):) + Nothing -> id) $ + [(k,v) | (k,v) <- kvs + , k `notElem` ["exports","tangle","results"]] + let listingsopt = if null listingsopts + then "" + else "[" ++ + intercalate ", " + (map (\(k,v) -> k ++ "=" ++ v) + listingsopts) ++ "]" inNote <- gets stInNote when inNote $ modify $ \s -> s{ stVerbInNote = True } let chr = case "!\"'()*,-./:;?@" \\ str of -- cgit v1.2.3