diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-06-07 10:03:10 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-06-07 10:03:10 -0700 |
commit | d8b4e45be0b22aa5939add501339b64252d802ea (patch) | |
tree | df33e3150601061a3e19d2ae02784a05678478fc /src/Text/Pandoc | |
parent | 20503894f39a1426c8623f604b98e88e93a16235 (diff) | |
download | pandoc-d8b4e45be0b22aa5939add501339b64252d802ea.tar.gz |
LaTeX writer: Include inline code attributes with `--listings`.
Closes #5420.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 16 |
1 files changed, 12 insertions, 4 deletions
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 |