diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-11-28 17:17:40 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-11-28 17:17:40 -0400 |
commit | 8c07e4dbf7d5145ed6412278c4288e3c405484ed (patch) | |
tree | 7effa3381806d82284e0a2491ef6c60699aa90d5 /Utility | |
parent | 24371d8597bd9acfb8251f3cb829355f4b4f5241 (diff) |
wip
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/HtmlDetect.hs | 4 |
1 files changed, 2 insertions, 2 deletions
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 "<p>this</p>" 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. |