git.iko.soy/typeable/pandoc
on master help sign in
Add support for latex mintinline (#4365)
175da00Marc Schreiber
src/Text/Pandoc/Readers/LaTeX.hs+11
@@ -1024,6 +1024,16 @@ dolstinline :: PandocMonad m => LP m Inlines
1024dolstinline = do
1024dolstinline = do
1025 options <- option [] keyvals
1025 options <- option [] keyvals
1026 let classes = maybeToList $ lookup "language" options >>= fromListingsLanguage
1026 let classes = maybeToList $ lookup "language" options >>= fromListingsLanguage
1027+ doinlinecode classes
1028+
1029+domintinline :: PandocMonad m => LP m Inlines
1030+domintinline = do
1031+ skipopts
1032+ cls <- toksToString <$> braced
1033+ doinlinecode [cls]
1034+
1035+doinlinecode :: PandocMonad m => [String] -> LP m Inlines
1036+doinlinecode classes = do
1027 Tok _ Symbol t <- anySymbol
1037 Tok _ Symbol t <- anySymbol
1028 marker <- case T.uncons t of
1038 marker <- case T.uncons t of
1029 Just (c, ts) | T.null ts -> return c
1039 Just (c, ts) | T.null ts -> return c
@@ -1655,6 +1665,7 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
1655 , ("footnote", skipopts >> note <$> grouped block)
1665 , ("footnote", skipopts >> note <$> grouped block)
1656 , ("verb", doverb)
1666 , ("verb", doverb)
1657 , ("lstinline", dolstinline)
1667 , ("lstinline", dolstinline)
1668+ , ("mintinline", domintinline)
1658 , ("Verb", doverb)
1669 , ("Verb", doverb)
1659 , ("url", ((unescapeURL . T.unpack . untokenize) <$> bracedUrl) >>= \url ->
1670 , ("url", ((unescapeURL . T.unpack . untokenize) <$> bracedUrl) >>= \url ->
1660 pure (link url "" (str url)))
1671 pure (link url "" (str url)))
test/command/3534.md+22
@@ -21,3 +21,25 @@ I want to explain the interface of \lstinline[language=Java]{public class MyClas
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 "."]]
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```
22```
23
23
24+```
25+% pandoc -f latex -t html
26+I want to explain the interface of \mintinline{java}{public class MyClass}.
27+^D
28+<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>
29+
30+```
31+
32+```
33+% pandoc -f latex -t html
34+I want to explain the interface of \mintinline{java}|public class MyClass|.
35+^D
36+<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>
37+
38+```
39+
40+```
41+% pandoc -f latex -t native
42+I want to explain the interface of \mintinline[linenos]{java}{public class MyClass}.
43+^D
44+[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 "."]]
45+```