@@ -50,7 +50,6 @@ import Data.Char ( isDigit )
50import Control.Monad ( liftM, guard, when, mzero )
50import Control.Monad ( liftM, guard, when, mzero )
51import Control.Applicative ( (<$>), (<$), (<*) )
51import Control.Applicative ( (<$>), (<$), (<*) )
52import Data.Monoid
52import Data.Monoid
53−import Data.Sequence (ViewL(..), ViewR(..), viewr, viewl)
55isSpace :: Char -> Bool
54isSpace :: Char -> Bool
56isSpace ' ' = True
55isSpace ' ' = True
@@ -369,9 +368,9 @@ pQ = do
369 then InSingleQuote
368 then InSingleQuote
370 else InDoubleQuote
369 else InDoubleQuote
371 let constructor = case quoteType of
370 let constructor = case quoteType of
372− SingleQuote -> B.singleQuoted
371+ SingleQuote -> B.singleQuoted
373 DoubleQuote -> B.doubleQuoted
372 DoubleQuote -> B.doubleQuoted
374− withQuoteContext innerQuoteContext $
373+ withQuoteContext innerQuoteContext $
375 pInlinesInTags "q" constructor
374 pInlinesInTags "q" constructor
377pEmph :: TagParser Inlines
376pEmph :: TagParser Inlines
@@ -406,7 +405,7 @@ pLink = try $ do
406 let url = fromAttrib "href" tag
405 let url = fromAttrib "href" tag
407 let title = fromAttrib "title" tag
406 let title = fromAttrib "title" tag
408 lab <- trimInlines . mconcat <$> manyTill inline (pCloses "a")
407 lab <- trimInlines . mconcat <$> manyTill inline (pCloses "a")
409− return $ B.link (escapeURI url) title lab
408+ return $ B.link (escapeURI url) title lab
411pImage :: TagParser Inlines
410pImage :: TagParser Inlines
412pImage = do
411pImage = do
@@ -439,15 +438,7 @@ pRawHtmlInline = do
440pInlinesInTags :: String -> (Inlines -> Inlines)
439pInlinesInTags :: String -> (Inlines -> Inlines)
441 -> TagParser Inlines
440 -> TagParser Inlines
442−pInlinesInTags tagtype f = do
441+pInlinesInTags tagtype f = extractSpaces f <$> pInTags tagtype inline
443− contents <- B.unMany <$> pInTags tagtype inline
444− let left = case viewl contents of
445− (Space :< _) -> B.space
447− let right = case viewr contents of
448− (_ :> Space) -> B.space
450− return (left <> f (trimInlines . B.Many $ contents) <> right)
452pInTags :: (Monoid a) => String -> TagParser a
443pInTags :: (Monoid a) => String -> TagParser a
453 -> TagParser a
444 -> TagParser a