diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-15 17:30:37 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-15 17:30:37 +0000 |
commit | 1a4489ef30ed44965f98cf05114d38325f418a25 (patch) | |
tree | a8ba26104d64dadd2391feb5f979be70dad137d7 /src/Text/Pandoc/Readers | |
parent | ec0e6e99410a9a6a9bca146fc77c2bba16256ac1 (diff) | |
download | pandoc-1a4489ef30ed44965f98cf05114d38325f418a25.tar.gz |
LaTeX reader: parse \texttt{} as code, as long as there's
nothing fancy inside.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@846 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Readers')
-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 4b91b528c..84bda1942 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -47,7 +47,7 @@ readLaTeX :: ParserState -- ^ Parser state, including options for parser readLaTeX = readWith parseLaTeX -- characters with special meaning -specialChars = "\\$%&^&_~#{}\n \t|<>'\"-" +specialChars = "\\$%^&_~#{}\n \t|<>'\"-" -- -- utility functions @@ -507,12 +507,19 @@ lt = try (string "\\textless") >> return (Str "<") gt = try (string "\\textgreater") >> return (Str ">") -code = try $ do +code = code1 <|> code2 + +code1 = try $ do string "\\verb" marker <- anyChar result <- manyTill anyChar (char marker) return $ Code $ removeLeadingTrailingSpace result +code2 = try $ do + string "\\texttt{" + result <- manyTill (noneOf "\\\n~$%^&{}") (char '}') + return $ Code result + emph = try $ oneOfStrings [ "\\emph{", "\\textit{" ] >> manyTill inline (char '}') >>= return . Emph |