diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2006-11-26 07:08:46 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2006-11-26 07:08:46 +0000 |
commit | 7384774d83c4773d2a19073b464e415f8c2859c9 (patch) | |
tree | fea064908ec853d4e3ab55683963ad1982c05dc1 | |
parent | 986c1f9deec5acf01fbb594db00b2ec174296c77 (diff) | |
download | pandoc-7384774d83c4773d2a19073b464e415f8c2859c9.tar.gz |
Refactored LaTeX reader for clarity (added isArg function).
git-svn-id: https://pandoc.googlecode.com/svn/trunk@138 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 6 |
1 files changed, 5 insertions, 1 deletions
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 |