@@ -78,9 +78,8 @@ parseBody :: TagParser [Block]
7878parseBody = liftM concat $ manyTill block eof
7979
8080block :: TagParser [Block]
81−block = optional pLocation >>
82− choice [
83− pPara
81+block = choice
82+ [ pPara
8483 , pHeader
8584 , pBlockQuote
8685 , pCodeBlock
@@ -235,9 +234,8 @@ pCodeBlock = try $ do
235234 return [CodeBlock attribs result]
236235
237236inline :: TagParser [Inline]
238−inline = choice [
239− pLocation
240− , pTagText
237+inline = choice
238+ [ pTagText
241239 , pEmph
242240 , pStrong
243241 , pSuperscript
@@ -250,17 +248,19 @@ inline = choice [
250248 , pRawHtmlInline
251249 ]
252250
253−pLocation :: TagParser [a]
251+pLocation :: TagParser ()
254252pLocation = do
255− (TagPosition r c) <- pSatisfy isTagPosition
253+ (TagPosition r c) <- pSat isTagPosition
256254 setPosition $ newPos "input" r c
257− return []
258255
259−pSatisfy :: (Tag String -> Bool) -> TagParser (Tag String)
260−pSatisfy f = do
256+pSat :: (Tag String -> Bool) -> TagParser (Tag String)
257+pSat f = do
261258 pos <- getPosition
262259 token show (const pos) (\x -> if f x then Just x else Nothing)
263260
261+pSatisfy :: (Tag String -> Bool) -> TagParser (Tag String)
262+pSatisfy f = try $ optional pLocation >> pSat f
263+
264264pAnyTag :: TagParser (Tag String)
265265pAnyTag = pSatisfy (const True)
266266
@@ -268,7 +268,7 @@ pSelfClosing :: (String -> Bool) -> ([Attribute String] -> Bool)
268268 -> TagParser (Tag String)
269269pSelfClosing f g = do
270270 open <- pSatisfy (tagOpen f g)
271− optional $ try $ pLocation >> pSatisfy (tagClose f)
271+ optional $ pSatisfy (tagClose f)
272272 return open
273273
274274pEmph :: TagParser [Inline]
@@ -342,7 +342,6 @@ pInTags tagtype parser = try $ do
342342
343343pCloses :: String -> TagParser ()
344344pCloses tagtype = try $ do
345− optional pLocation
346345 t <- lookAhead $ pSatisfy $ \tag -> isTagClose tag || isTagOpen tag
347346 case t of
348347 (TagClose t') | t' == tagtype -> pAnyTag >> return ()
@@ -360,6 +359,11 @@ pTagText = try $ do
360359 Left _ -> fail $ "Could not parse `" ++ str ++ "'"
361360 Right result -> return result
362361
362+pBlank :: TagParser ()
363+pBlank = try $ do
364+ (TagText str) <- pSatisfy isTagText
365+ guard $ all isSpace str
366+
363367pTagContents :: GenParser Char ParserState Inline
364368pTagContents = pStr <|> pSpace <|> smartPunctuation pTagContents <|> pSymbol
365369