git.iko.soy/typeable/pandoc
on master help sign in
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

commit1a4489ef30ed44965f98cf05114d38325f418a25 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateWed 15 Aug 2007, 17:30 (19 years ago) parentec0e6e9
1 file changed+9−2
src/Text/Pandoc/Readers/LaTeX.hs+9−2
src/Text/Pandoc/Readers/LaTeX.hs+9−2
@@ -47,7 +47,7 @@ readLaTeX :: ParserState -- ^ Parser state, including options for parser
4747readLaTeX = readWith parseLaTeX
4848
4949-- characters with special meaning
50−specialChars = "\\$%&^&_~#{}\n \t|<>'\"-"
50+specialChars = "\\$%^&_~#{}\n \t|<>'\"-"
5151
5252--
5353-- utility functions
@@ -507,12 +507,19 @@ lt = try (string "\\textless") >> return (Str "<")
507507
508508gt = try (string "\\textgreater") >> return (Str ">")
509509
510−code = try $ do
510+code = code1 <|> code2
511+
512+code1 = try $ do
511513 string "\\verb"
512514 marker <- anyChar
513515 result <- manyTill anyChar (char marker)
514516 return $ Code $ removeLeadingTrailingSpace result
515517
518+code2 = try $ do
519+ string "\\texttt{"
520+ result <- manyTill (noneOf "\\\n~$%^&{}") (char '}')
521+ return $ Code result
522+
516523emph = try $ oneOfStrings [ "\\emph{", "\\textit{" ] >>
517524 manyTill inline (char '}') >>= return . Emph
518525