From 277f756c0265cba147295dc5ea7726bce21fe006 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Fri, 24 Apr 2020 20:31:34 +1200 Subject: [PATCH] Release new Haskell Stylist & XML Conduit Stylist! XML Conduit Stylist changed to abstract away Haskell Stylist's breaking datastructure changes. --- src/Data/CSS/Preprocessor/Assets.hs | 2 +- src/Data/CSS/Preprocessor/Text.hs | 2 +- stylist.cabal | 2 +- xml-conduit-stylist/src/Data/HTML2CSS.hs | 13 +++++++------ xml-conduit-stylist/xml-conduit-stylist.cabal | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Data/CSS/Preprocessor/Assets.hs b/src/Data/CSS/Preprocessor/Assets.hs index 70bd69c..098cdf6 100644 --- a/src/Data/CSS/Preprocessor/Assets.hs +++ b/src/Data/CSS/Preprocessor/Assets.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -- | Utilities for rewriting URLs referenced via CSS properties. -module Data.CSS.Preprocessor.Assets(StyleAssets(..), URIRewriter) where +module Data.CSS.Preprocessor.Assets(StyleAssets(..), URIRewriter(..)) where -- TODO Unit test! import Data.Text as Txt diff --git a/src/Data/CSS/Preprocessor/Text.hs b/src/Data/CSS/Preprocessor/Text.hs index 493e8a4..6796204 100644 --- a/src/Data/CSS/Preprocessor/Text.hs +++ b/src/Data/CSS/Preprocessor/Text.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -- | Lowers certain CSS properties to plain text. -module Data.CSS.Preprocessor.Text(TextStyle, resolve, StyleTree(..)) where +module Data.CSS.Preprocessor.Text(TextStyle, resolve) where import Data.CSS.Syntax.Tokens (Token(..), NumericValue(..)) import Data.CSS.Style (PropertyParser(..)) diff --git a/stylist.cabal b/stylist.cabal index 6ac2109..e8773f3 100644 --- a/stylist.cabal +++ b/stylist.cabal @@ -10,7 +10,7 @@ name: stylist -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 1.2.0.0 +version: 2.0.0.0 -- A short (one-line) description of the package. synopsis: Apply CSS styles to a document tree. diff --git a/xml-conduit-stylist/src/Data/HTML2CSS.hs b/xml-conduit-stylist/src/Data/HTML2CSS.hs index ecd4283..f7fddac 100644 --- a/xml-conduit-stylist/src/Data/HTML2CSS.hs +++ b/xml-conduit-stylist/src/Data/HTML2CSS.hs @@ -141,20 +141,21 @@ traversePsuedo rules psuedo parentStyle builder | otherwise = [] -- | Converts a xml-conduit Element to a stylist Element. -elToStylish (XML.Element (XML.Name name _ _) attrs _) parent previous = +elToStylish (XML.Element (XML.Name name ns _) attrs _) parent previous = ElementNode { name = name, + namespace = fromMaybe "" ns, attributes = L.sort [ - Attribute (XML.nameLocalName name) (Txt.unpack value) - | (name, value) <- M.toList attrs + Attribute name (fromMaybe "" ns) (Txt.unpack value) + | (XML.Name name ns _, value) <- M.toList attrs ], parent = parent, previous = previous } addPsuedoclasses el psuedoclasses - | (Attribute "" value : attrs) <- attributes el = el { - attributes = Attribute "" (psuedoclasses ++ value) : attrs + | (Attribute "" "" value : attrs) <- attributes el = el { + attributes = Attribute "" "" (psuedoclasses ++ value) : attrs } | otherwise = el { - attributes = Attribute "" psuedoclasses : attributes el + attributes = Attribute "" "" psuedoclasses : attributes el } diff --git a/xml-conduit-stylist/xml-conduit-stylist.cabal b/xml-conduit-stylist/xml-conduit-stylist.cabal index ada263d..35ac147 100644 --- a/xml-conduit-stylist/xml-conduit-stylist.cabal +++ b/xml-conduit-stylist/xml-conduit-stylist.cabal @@ -10,7 +10,7 @@ name: xml-conduit-stylist -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 1.1.0.0 +version: 1.2.0.0 -- A short (one-line) description of the package. synopsis: Bridge between xml-conduit/html-conduit and stylist @@ -61,7 +61,7 @@ library -- Other library packages from which modules are imported. build-depends: base >=4.9 && <4.10, - stylist >=1.2.0 && <2, css-syntax, unordered-containers, + stylist >=2 && <3, css-syntax, unordered-containers, xml-conduit >=1.8 && < 1.9, text, containers, network-uri -- 2.30.2