git.iko.soy/typeable/pandoc
on master help sign in
lstinline with braces can be used (verb cannot be used with braces) (#3535)
5fe734dschrieveslaach
src/Text/Pandoc/Readers/LaTeX.hs+8−1
@@ -601,7 +601,7 @@ inlineCommands = M.fromList $
601 , ("thanks", note <$> grouped block)
601 , ("thanks", note <$> grouped block)
602 , ("footnote", note <$> grouped block)
602 , ("footnote", note <$> grouped block)
603 , ("verb", doverb)
603 , ("verb", doverb)
604− , ("lstinline", skipopts *> doverb)
604+ , ("lstinline", dolstinline)
605 , ("Verb", doverb)
605 , ("Verb", doverb)
606 , ("url", (unescapeURL <$> braced) >>= \url ->
606 , ("url", (unescapeURL <$> braced) >>= \url ->
607 pure (link url "" (str url)))
607 pure (link url "" (str url)))
@@ -716,6 +716,13 @@ doverb = do
716 marker <- anyChar
716 marker <- anyChar
717 code <$> manyTill (satisfy (/='\n')) (char marker)
717 code <$> manyTill (satisfy (/='\n')) (char marker)
718
718
719+dolstinline :: PandocMonad m => LP m Inlines
720+dolstinline = do
721+ options <- option [] keyvals
722+ let classes = maybeToList $ lookup "language" options >>= fromListingsLanguage
723+ marker <- char '{' <|> anyChar
724+ codeWith ("",classes,[]) <$> manyTill (satisfy (/='\n')) (char '}' <|> char marker)
725+
719doLHSverb :: PandocMonad m => LP m Inlines
726doLHSverb :: PandocMonad m => LP m Inlines
720doLHSverb = codeWith ("",["haskell"],[]) <$> manyTill (satisfy (/='\n')) (char '|')
727doLHSverb = codeWith ("",["haskell"],[]) <$> manyTill (satisfy (/='\n')) (char '|')
721
728
test/command/3534.mdnew file+23
@@ -0,0 +1,23 @@
1+```
2+% pandoc -f latex -t html
3+I want to explain the interface of \lstinline[language=Java]{public class MyClass}.
4+^D
5+<p>I want to explain the interface of <code class="sourceCode java"><span class="kw">public</span> <span class="kw">class</span> MyClass</code>.</p>
6+
7+```
8+
9+```
10+% pandoc -f latex -t html
11+I want to explain the interface of \lstinline{public class MyClass}.
12+^D
13+<p>I want to explain the interface of <code>public class MyClass</code>.</p>
14+
15+```
16+
17+```
18+% pandoc -f latex -t native
19+I want to explain the interface of \lstinline[language=Java]{public class MyClass}.
20+^D
21+[Para [Str "I",Space,Str "want",Space,Str "to",Space,Str "explain",Space,Str "the",Space,Str "interface",Space,Str "of",Space,Code ("",["java"],[]) "public class MyClass",Str "."]]
22+```
23+