@@ -523,9 +523,6 @@ blockToLaTeX (CodeBlock (identifier,classes,keyvalAttr) str) = do
523523 else [ "label=" ++ ref ])
524524
525525 else []
526− mbBraced x = if not (all isAlphaNum x)
527− then "{" <> x <> "}"
528− else x
529526 printParams
530527 | null params = empty
531528 | otherwise = brackets $ hcat (intersperse ", "
@@ -937,12 +934,15 @@ inlineToLaTeX (Code (_,classes,_) str) = do
937934 -> highlightCode
938935 | otherwise -> rawCode
939936 where listingsCode = do
937+ let listingsopt = case getListingsLanguage classes of
938+ Just l -> "[language=" ++ mbBraced l ++ "]"
939+ Nothing -> ""
940940 inNote <- gets stInNote
941941 when inNote $ modify $ \s -> s{ stVerbInNote = True }
942942 let chr = case "!\"&'()*,-./:;?@_" \\ str of
943943 (c:_) -> c
944944 [] -> '!'
945− return $ text $ "\\lstinline" ++ [chr] ++ str ++ [chr]
945+ return $ text $ "\\lstinline" ++ listingsopt ++ [chr] ++ str ++ [chr]
946946 highlightCode = do
947947 case highlight formatLaTeXInline ("",classes,[]) str of
948948 Nothing -> rawCode
@@ -1167,6 +1167,11 @@ getListingsLanguage :: [String] -> Maybe String
11671167getListingsLanguage [] = Nothing
11681168getListingsLanguage (x:xs) = toListingsLanguage x <|> getListingsLanguage xs
11691169
1170+mbBraced :: String -> String
1171+mbBraced x = if not (all isAlphaNum x)
1172+ then "{" <> x <> "}"
1173+ else x
1174+
11701175-- Extract a key from divs and spans
11711176extract :: String -> Block -> [String]
11721177extract key (Div attr _) = lookKey key attr