git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: idiomatic rewriting for clarity.
1cadba1John MacFarlane
src/Text/Pandoc/Readers/HTML.hs+4−5
@@ -442,13 +442,12 @@ pInlinesInTags :: String -> (Inlines -> Inlines)
442pInlinesInTags tagtype f = do
442pInlinesInTags tagtype f = do
443 contents <- B.unMany <$> pInTags tagtype inline
443 contents <- B.unMany <$> pInTags tagtype inline
444 let left = case viewl contents of
444 let left = case viewl contents of
445− EmptyL -> mempty
445+ (Space :< _) -> B.space
446− (a :< _) -> padSpace a
446+ _ -> mempty
447 let right = case viewr contents of
447 let right = case viewr contents of
448− EmptyR -> mempty
448+ (_ :> Space) -> B.space
449− (_ :> a) -> padSpace a
449+ _ -> mempty
450 return (left <> f (trimInlines . B.Many $ contents) <> right)
450 return (left <> f (trimInlines . B.Many $ contents) <> right)
451− where padSpace a = if a == Space then B.space else mempty
452
451
453pInTags :: (Monoid a) => String -> TagParser a
452pInTags :: (Monoid a) => String -> TagParser a
454 -> TagParser a
453 -> TagParser a