diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-28 05:45:27 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-28 05:45:27 +0000 |
commit | d3404581d4acba1d41831bad3db3b8a1271c2ee2 (patch) | |
tree | b64f8e21db25d780ef4ac2eb7139fd12f24fb419 | |
parent | 17873d46392bbb5e458c2dd54b7ceca5596e926e (diff) | |
download | pandoc-d3404581d4acba1d41831bad3db3b8a1271c2ee2.tar.gz |
Changes in LaTeX reader to accommodate Pandoc's own use of
examplep.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@818 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 91462caca..fe46d2e4f 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -185,7 +185,9 @@ hrule = try (do -- code blocks -- -codeBlock = try (do +codeBlock = codeBlock1 <|> codeBlock2 + +codeBlock1 = try (do string "\\begin{verbatim}" -- don't use begin function because it -- gobbles whitespace option "" blanklines -- we want to gobble blank lines, but not @@ -194,6 +196,13 @@ codeBlock = try (do spaces return (CodeBlock (stripTrailingNewlines contents))) +codeBlock2 = try (do + string "\\begin{Verbatim}" -- used by fancyverb package + option "" blanklines + contents <- manyTill anyChar (try (string "\\end{Verbatim}")) + spaces + return (CodeBlock (stripTrailingNewlines contents))) + -- -- block quotes -- @@ -518,13 +527,25 @@ gt = try (do string "\\textgreater" return (Str ">")) -code = try (do +code = code1 <|> code2 + +code1 = try (do string "\\verb" marker <- anyChar result <- manyTill anyChar (char marker) let result' = removeLeadingTrailingSpace result return (Code result')) +-- examplep package uses \Q{} with backslash-escaped symbols +code2 = try (do + string "\\Q{" + result <- manyTill (alphaNum <|> + try (do{char '\\'; oneOf "XSVB"; return ' '}) <|> + try (do{string "\\n"; return '\n'}) <|> + try (do{char '\\'; anyChar})) (char '}') + let result' = removeLeadingTrailingSpace result + return (Code result')) + emph = try (do oneOfStrings [ "\\emph{", "\\textit{" ] result <- manyTill inline (char '}') |