Refactored LaTeX reader for clarity (added isArg function).

git-svn-id: https://pandoc.googlecode.com/svn/trunk@138 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2006-11-26 07:08:46 +00:00
parent 986c1f9dee
commit 7384774d83

View file

@ -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