packages feed

onama 0.2.1.1 → 0.2.2.0

raw patch · 2 files changed

+33/−3 lines, 2 files

Files

Text/HTML/Onama.hs view
@@ -243,6 +243,35 @@   TagText text _ -> Just text   _other         -> Nothing +-- | Certain HTML elements are self closing. In addition, they can show+--   up /without/ their closing slash. For these, we just want to go over+--   their opening tag.+--   These elements are void, according to the W3C spec:+--   <https://www.w3.org/TR/2012/WD-html-markup-20121025/syntax.html#syntax-elements>+--+--   * area+--   * base+--   * br+--   * col+--   * command+--   * embed+--   * hr+--   * img+--   * input+--   * keygen+--   * link+--   * meta+--   * param+--   * source+--   * track+--   * wbr+voidElement :: (Monad m, StringLike str, Show str) => P.ParsecT [Tag str] u m (Tag str)+voidElement = choice $ fmap tagOpen_ [ "area", "base", "br", "col", "command"+                                     , "embed", "hr", "img", "input", "keygen"+                                     , "link", "meta", "param", "source", "track"+                                     , "wbr"+                                     ]+ balancedTags_ :: (Monad m, StringLike str, Show str)               => TagOpenSelector               -> P.ParsecT [Tag str] u m (S.Seq (Tag str))@@ -259,8 +288,9 @@   matchingClose <- tagClose_ closeS   return $ mconcat innerTags |> matchingClose     where closeS = TagCloseSelector $ toString name-          notMatchingClose =   ( (balancedTags_ anyOpenTag)-                             <|> S.singleton <$> (notParse (tagClose_ closeS) >> tag)+          notMatchingClose =   ( S.singleton <$> (notParse (tagClose_ closeS) >> tag)+                             <|> S.singleton <$> voidElement+                             <|> (balancedTags_ anyOpenTag)                                )  balancedTags :: (Monad m, StringLike str, Show str)
onama.cabal view
@@ -10,7 +10,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.2.1.1+version:             0.2.2.0  synopsis: HTML-parsing primitives for Parsec.