zenacy-html 2.0.5 → 2.0.6
raw patch · 5 files changed
+54/−27 lines, 5 filesdep ~mtldep ~vector
Dependency ranges changed: mtl, vector
Files
- CHANGES.md +4/−0
- src/Zenacy/HTML/Internal/DOM.hs +9/−4
- src/Zenacy/HTML/Internal/Parser.hs +32/−17
- src/Zenacy/HTML/Internal/Zip.hs +6/−3
- zenacy-html.cabal +3/−3
CHANGES.md view
@@ -1,5 +1,9 @@ # Change Log +## 2.0.6++* Relax bounds on mtl and vector+ ## 2.0.5 * Update for removal for ST MonadFail instance
src/Zenacy/HTML/Internal/DOM.hs view
@@ -345,10 +345,15 @@ -- | Sets the quirks mode for a document. domQuirksSet :: DOMQuirks -> DOM -> DOM-domQuirksSet x d = domPutNode domRoot y' d- where- y = domDocument d- y' = y { domDocumentQuirksMode = x }+domQuirksSet x d =+ case (domDocument d) of+ y@DOMDocument {} ->+ let+ y' = y { domDocumentQuirksMode = x }+ in+ domPutNode domRoot y' d+ _otherwise ->+ d -- | Gets the quirks mode for a document. domQuirksGet :: DOM -> DOMQuirks
src/Zenacy/HTML/Internal/Parser.hs view
@@ -908,9 +908,16 @@ pure $ ( any f . domMapID d- . map (\(ParserFormatElement x _) -> x)+ . mapMaybe g . takeWhile (not . formatItemIsMarker) ) a+ where+ g :: ParserFormatItem -> Maybe DOMID+ g = \case+ ParserFormatElement x _ ->+ Just x+ ParserFormatMarker ->+ Nothing -- | Determines if the active format list contains an element. activeFormatContains :: Parser s -> DOMID -> ST s Bool@@ -1072,30 +1079,38 @@ -- (2.2) Get last table in element stack. lastTable <- elementStackFind p $ \x -> elementDetailsType x == domMakeTypeHTML "table"- let Just (ElementDetails i1 x1 n1 _) = lastTemplate- Just (ElementDetails i2 x2 n2 _) = lastTable+ -- (2.3) Check for template and no table.- if | isJust lastTemplate && (isNothing lastTable || (i1 < i2)) ->+ if | Just (ElementDetails i1 _ n1 _) <- lastTemplate+ , Just (ElementDetails i2 _ _ _) <- lastTable+ , i1 < i2 -> do pure $ DOMPos (domTemplateContents n1) Nothing- -- (2.4) If no last table then use first element.- | isNothing lastTable -> do- j <- fromJust <$> lastNodeID p- pure $ DOMPos j Nothing- -- (2.5) Check last table parent node.- | domNodeParent n2 /= domNull ->- pure $ DOMPos (domNodeParent n2) $ Just x2- | otherwise -> do- -- (2.6) Previous element is above last table.- prev <- fromJust <$> elementStackSucc p x2- -- (2.7) Location is after previous element last child.- pure $ DOMPos prev Nothing++ | Just (ElementDetails _ _ n1 _) <- lastTemplate+ , Nothing <- lastTable -> do+ pure $ DOMPos (domTemplateContents n1) Nothing++ | otherwise -> case lastTable of+ Nothing -> do+ -- (2.4) If no last table then use first element.+ j <- fromJust <$> lastNodeID p+ pure $ DOMPos j Nothing+ Just (ElementDetails _ x2 n2 _) -> do+ -- (2.5) Check last table parent node.+ if | domNodeParent n2 /= domNull ->+ pure $ DOMPos (domNodeParent n2) $ Just x2+ | otherwise -> do+ -- (2.6) Previous element is above last table.+ prev <- fromJust <$> elementStackSucc p x2+ -- (2.7) Location is after previous element last child.+ pure $ DOMPos prev Nothing else pure $ DOMPos target Nothing getNode p (domPosParent adjusted) >>= \case Just DOMTemplate{..} -> -- (3) Use template contents instead. pure $ DOMPos domTemplateContents Nothing- _ ->+ _otherwise -> -- (4) Return adjusted insertion location. pure adjusted
src/Zenacy/HTML/Internal/Zip.hs view
@@ -197,9 +197,12 @@ f c $ HTMLElement n s a [] _ -> Nothing where- f [] n = Nothing- f xs n = let (h:ls) = reverse xs in Just $- HTMLZipper h ((HTMLCrumb n ls []):z)+ f xs n =+ case reverse xs of+ (h:ls) ->+ Just $ HTMLZipper h ((HTMLCrumb n ls []):z)+ [] ->+ Nothing -- | Moves the zipper to a named child element. htmlZipFind :: (HTMLNode -> Bool) -> HTMLZipper -> Maybe HTMLZipper
zenacy-html.cabal view
@@ -1,5 +1,5 @@ cabal-version: >= 1.10-version: 2.0.5+version: 2.0.6 name: zenacy-html synopsis:@@ -65,13 +65,13 @@ data-default >= 0.7.1.1 && < 0.8, dlist >= 0.8 && < 1.1, extra >= 1.4 && < 1.8,- mtl >= 2.1 && < 2.3,+ mtl >= 2.1 && < 2.4, pretty-show >= 1.6 && < 1.11, safe >= 0.3.14 && < 0.4, safe-exceptions >= 0.1.5.0 && < 0.2, text >= 1.2.2.0 && < 2.1, transformers >= 0.5.2 && < 0.7,- vector >= 0.11 && < 0.13,+ vector >= 0.11 && < 0.14, word8 >= 0.1.2 && < 0.2 ghc-options: