From 8c07e4dbf7d5145ed6412278c4288e3c405484ed Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 28 Nov 2017 17:17:40 -0400 Subject: wip --- Utility/HtmlDetect.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Utility') diff --git a/Utility/HtmlDetect.hs b/Utility/HtmlDetect.hs index ca516e960..57a56c95f 100644 --- a/Utility/HtmlDetect.hs +++ b/Utility/HtmlDetect.hs @@ -18,11 +18,11 @@ import Data.Char -- Html fragments like "

this

" are not detected as being html, -- although some browsers may chose to render them as html. isHtml :: String -> Bool -isHtml = evaluate . canonicalizeTags . parseTags . truncate +isHtml = evaluate . canonicalizeTags . parseTags . shorten where -- We only care about the beginning of the file, -- so although tagsoup parses lazily anyway, truncate it. - truncate = take 16384 + shorten = take 16384 evaluate (TagOpen "!DOCTYPE" ((t, _):_):_) = map toLower t == "html" evaluate (TagOpen "html" _:_) = True -- Allow some leading whitespace before the tag. -- cgit v1.2.3