git.iko.soy/typeable/pandoc
on master help sign in
Add support for latex mintinline (#4365)
commit175da00295da72ae08e23405327f63ba08c3c3a2 authorMarc Schreiber <schrieveslaach@online.de> dateSat 18 Aug 2018, 05:57 (8 years ago) parent822a071
2 files changed+33
src/Text/Pandoc/Readers/LaTeX.hs+11 test/command/3534.md+22
src/Text/Pandoc/Readers/LaTeX.hs+11
@@ -1024,6 +1024,16 @@ dolstinline :: PandocMonad m => LP m Inlines
10241024dolstinline = do
10251025 options <- option [] keyvals
10261026 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
10271037 Tok _ Symbol t <- anySymbol
10281038 marker <- case T.uncons t of
10291039 Just (c, ts) | T.null ts -> return c
@@ -1655,6 +1665,7 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
16551665 , ("footnote", skipopts >> note <$> grouped block)
16561666 , ("verb", doverb)
16571667 , ("lstinline", dolstinline)
1668+ , ("mintinline", domintinline)
16581669 , ("Verb", doverb)
16591670 , ("url", ((unescapeURL . T.unpack . untokenize) <$> bracedUrl) >>= \url ->
16601671 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
2121[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 "."]]
2222```
2323
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+```