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:
parent
986c1f9dee
commit
7384774d83
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue