LaTeX writer: Include inline code attributes with --listings
.
Closes #5420.
This commit is contained in:
parent
20503894f3
commit
d8b4e45be0
2 changed files with 18 additions and 4 deletions
|
@ -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
|
||||
|
|
6
test/command/5420.md
Normal file
6
test/command/5420.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
```
|
||||
% pandoc --listings -t latex
|
||||
`int a = 1;`{.cpp style=cpp}
|
||||
^D
|
||||
\passthrough{\lstinline[language={C++}, style=cpp]!int a = 1;!}
|
||||
```
|
Loading…
Add table
Reference in a new issue