diff options
author | Puneeth Chaganti <punchagan@gmail.com> | 2010-12-30 00:48:55 +0530 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-12-30 14:37:51 -0800 |
commit | e4dedad1c0f435cbdc854a851e2df5cbc668c7b7 (patch) | |
tree | c507cb55314893ab76a15984582b4b5c56539d09 /src/Text/Pandoc/Readers/LaTeX.hs | |
parent | f49e60a8b87ef28bcaeeeae00f6e330c6155851b (diff) | |
download | pandoc-e4dedad1c0f435cbdc854a851e2df5cbc668c7b7.tar.gz |
Added support for listings package code blocks and inline code.
Diffstat (limited to 'src/Text/Pandoc/Readers/LaTeX.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 6006aac5b..561038081 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -211,7 +211,7 @@ hrule = oneOfStrings [ "\\begin{center}\\rule{3in}{0.4pt}\\end{center}\n\n", -- codeBlock :: GenParser Char ParserState Block -codeBlock = codeBlockWith "verbatim" <|> codeBlockWith "Verbatim" <|> lhsCodeBlock +codeBlock = codeBlockWith "verbatim" <|> codeBlockWith "Verbatim" <|> codeBlockWith "lstlisting" <|> lhsCodeBlock -- Note: Verbatim is from fancyvrb. codeBlockWith :: String -> GenParser Char st Block @@ -611,7 +611,7 @@ doubleQuote :: GenParser Char st Inline doubleQuote = char '"' >> return (Str "\"") code :: GenParser Char ParserState Inline -code = code1 <|> code2 <|> lhsInlineCode +code = code1 <|> code2 <|> code3 <|> lhsInlineCode code1 :: GenParser Char st Inline code1 = try $ do @@ -626,6 +626,13 @@ code2 = try $ do result <- manyTill (noneOf "\\\n~$%^&{}") (char '}') return $ Code result +code3 :: GenParser Char st Inline +code3 = try $ do + string "\\lstinline" + marker <- anyChar + result <- manyTill anyChar (char marker) + return $ Code $ removeLeadingTrailingSpace result + lhsInlineCode :: GenParser Char ParserState Inline lhsInlineCode = try $ do failUnlessLHS |