git.iko.soy/typeable/pandoc
on master help sign in
Refactored LaTeX reader for clarity (added isArg function).

git-svn-id: https://pandoc.googlecode.com/svn/trunk@138 788f1e2b-df1e-0410-8736-df70ead52e1b

commit7384774d83c4773d2a19073b464e415f8c2859c9 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSun 26 Nov 2006, 07:08 (20 years ago) parent986c1f9
1 file changed+5−1
src/Text/Pandoc/Readers/LaTeX.hs+5−1
src/Text/Pandoc/Readers/LaTeX.hs+5−1
@@ -51,6 +51,10 @@ bracketedText openB closeB = try (do
5151-- | Returns an option or argument of a LaTeX command
5252optOrArg = choice [ (bracketedText '{' '}'), (bracketedText '[' ']') ]
5353
54+-- | True if the string begins with '{'
55+isArg ('{':rest) = True
56+isArg other = False
57+
5458-- | Returns list of options and arguments of a LaTeX command
5559commandArgs = many optOrArg
5660
@@ -549,7 +553,7 @@ link = try (do
549553
550554image = try (do
551555 ("includegraphics", _, args) <- command
552− let args' = filter (\arg -> (take 1 arg) /= "[") args
556+ let args' = filter isArg args -- filter out options
553557 let src = if null args' then
554558 Src "" ""
555559 else