From 7384774d83c4773d2a19073b464e415f8c2859c9 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sun, 26 Nov 2006 07:08:46 +0000 Subject: Refactored LaTeX reader for clarity (added isArg function). git-svn-id: https://pandoc.googlecode.com/svn/trunk@138 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/LaTeX.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index bd91c5014..ab87b89f0 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -51,6 +51,10 @@ bracketedText openB closeB = try (do -- | Returns an option or argument of a LaTeX command optOrArg = choice [ (bracketedText '{' '}'), (bracketedText '[' ']') ] +-- | True if the string begins with '{' +isArg ('{':rest) = True +isArg other = False + -- | Returns list of options and arguments of a LaTeX command commandArgs = many optOrArg @@ -549,7 +553,7 @@ link = try (do image = try (do ("includegraphics", _, args) <- command - let args' = filter (\arg -> (take 1 arg) /= "[") args + let args' = filter isArg args -- filter out options let src = if null args' then Src "" "" else -- cgit v1.2.3