@@ -59,6 +59,8 @@ module Text.Pandoc.Shared (
59 uniqueIdent,
59 uniqueIdent,
60 isHeaderBlock,
60 isHeaderBlock,
61 headerShift,
61 headerShift,
62+ -- * TagSoup HTML handling
62 -- * File handling
64 -- * File handling
63 inDirectory,
65 inDirectory,
64 findDataFile,
66 findDataFile,
@@ -89,6 +91,8 @@ import Text.Pandoc.Pretty (charWidth)
89import System.Locale (defaultTimeLocale)
91import System.Locale (defaultTimeLocale)
90import Data.Time
92import Data.Time
91import System.IO (stderr)
93import System.IO (stderr)
94+import Text.HTML.TagSoup (renderTagsOptions, RenderOptions(..), Tag(..),
94-- List processing
98-- List processing
@@ -448,6 +452,22 @@ headerShift n = bottomUp shift
448 shift (Header level inner) = Header (level + n) inner
452 shift (Header level inner) = Header (level + n) inner
449 shift x = x
453 shift x = x
456+-- TagSoup HTML handling
459+-- | Render HTML tags.
460+renderTags' :: [Tag String] -> String
461+renderTags' = renderTagsOptions
462+ renderOptions{ optMinimize = \x ->
463+ let y = map toLower x
464+ in y == "hr" || y == "br" ||
465+ y == "img" || y == "meta" ||
468+ let y = map toLower x
469+ in y == "script" || y == "style" }
452-- File handling
472-- File handling
@@ -501,3 +521,5 @@ safeRead s = case reads s of
502 | all isSpace x -> return d
522 | all isSpace x -> return d
503 _ -> fail $ "Could not read `" ++ s ++ "'"
523 _ -> fail $ "Could not read `" ++ s ++ "'"