~alcinnz/haskell-stylist

277f756c0265cba147295dc5ea7726bce21fe006 — Adrian Cochrane 4 years ago 15b2412
Release new Haskell Stylist & XML Conduit Stylist!

XML Conduit Stylist changed to abstract away Haskell Stylist's breaking datastructure changes.
M src/Data/CSS/Preprocessor/Assets.hs => src/Data/CSS/Preprocessor/Assets.hs +1 -1
@@ 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

M src/Data/CSS/Preprocessor/Text.hs => src/Data/CSS/Preprocessor/Text.hs +1 -1
@@ 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(..))

M stylist.cabal => stylist.cabal +1 -1
@@ 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.

M xml-conduit-stylist/src/Data/HTML2CSS.hs => xml-conduit-stylist/src/Data/HTML2CSS.hs +7 -6
@@ 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
        }

M xml-conduit-stylist/xml-conduit-stylist.cabal => xml-conduit-stylist/xml-conduit-stylist.cabal +2 -2
@@ 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