summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authormpickering <matthewtpickering@gmail.com>2014-06-16 20:45:54 +0100
committermpickering <matthewtpickering@gmail.com>2014-06-16 20:45:54 +0100
commit7807564d4493af1462d61138c63d8ec365abc792 (patch)
tree32d6fd40e806bc5b6e5647ae0ad1cabac01e666f /src/Text/Pandoc/Readers
parent4b6e279e3acf01ace9831a9e98d76af92befe60f (diff)
Moved extractSpaces to Shared.hs
Generalised and move the extractSpaces function from `HTML.hs` to `Shared.hs` so that the docx reader can also use it.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 905e55b22..9cdc5a567 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -50,7 +50,6 @@ import Data.Char ( isDigit )
import Control.Monad ( liftM, guard, when, mzero )
import Control.Applicative ( (<$>), (<$), (<*) )
import Data.Monoid
-import Data.Sequence (ViewL(..), ViewR(..), viewr, viewl)
isSpace :: Char -> Bool
isSpace ' ' = True
@@ -369,9 +368,9 @@ pQ = do
then InSingleQuote
else InDoubleQuote
let constructor = case quoteType of
- SingleQuote -> B.singleQuoted
+ SingleQuote -> B.singleQuoted
DoubleQuote -> B.doubleQuoted
- withQuoteContext innerQuoteContext $
+ withQuoteContext innerQuoteContext $
pInlinesInTags "q" constructor
pEmph :: TagParser Inlines
@@ -406,7 +405,7 @@ pLink = try $ do
let url = fromAttrib "href" tag
let title = fromAttrib "title" tag
lab <- trimInlines . mconcat <$> manyTill inline (pCloses "a")
- return $ B.link (escapeURI url) title lab
+ return $ B.link (escapeURI url) title lab
pImage :: TagParser Inlines
pImage = do
@@ -439,15 +438,7 @@ pRawHtmlInline = do
pInlinesInTags :: String -> (Inlines -> Inlines)
-> TagParser Inlines
-pInlinesInTags tagtype f = do
- contents <- B.unMany <$> pInTags tagtype inline
- let left = case viewl contents of
- (Space :< _) -> B.space
- _ -> mempty
- let right = case viewr contents of
- (_ :> Space) -> B.space
- _ -> mempty
- return (left <> f (trimInlines . B.Many $ contents) <> right)
+pInlinesInTags tagtype f = extractSpaces f <$> pInTags tagtype inline
pInTags :: (Monoid a) => String -> TagParser a
-> TagParser a