@@ -63,7 +63,7 @@ import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
6363import Text.HTML.TagSoup (parseTags, innerText, fromAttrib, Tag(..))
6464import Text.HTML.TagSoup.Match
6565import Data.List ( intercalate )
66−import Data.Char ( digitToInt, isUpper)
66+import Data.Char ( digitToInt, isUpper )
6767import Control.Monad ( guard, liftM, when )
6868import Text.Pandoc.Compat.Monoid ((<>))
6969import Text.Printf
@@ -540,8 +540,8 @@ image = try $ do
540540 let attr = case lookup "style" kvs of
541541 Just stls -> (ident, cls, pickStylesToKVs ["width", "height"] stls)
542542 Nothing -> (ident, cls, kvs)
543− src <- manyTill anyChar' (lookAhead $ oneOf "!(")
544− alt <- option "" (try $ (char '(' >> manyTill anyChar' (char ')')))
543+ src <- many1 (noneOf " \t\n\r!(")
544+ alt <- option "" $ try $ char '(' *> manyTill anyChar (char ')')
545545 char '!'
546546 return $ B.imageWith attr src alt (B.str alt)
547547
@@ -639,10 +639,7 @@ simpleInline :: Parser [Char] ParserState t -- ^ surrounding parser
639639 -> (Inlines -> Inlines) -- ^ Inline constructor
640640 -> Parser [Char] ParserState Inlines -- ^ content parser (to be used repeatedly)
641641simpleInline border construct = try $ do
642− st <- getState
643− pos <- getPosition
644− let afterString = stateLastStrPos st == Just pos
645− guard $ not afterString
642+ notAfterString
646643 border *> notFollowedBy (oneOf " \t\n\r")
647644 attr <- attributes
648645 body <- trimInlines . mconcat <$>