css-selectors-0.5.0.0: Parsing, rendering and manipulating css selectors in Haskell.
Maintainerhapytexeu+gh@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Css3.Selector.Utils

Description

A module to encode and decode css selector strings. These are used in the parser and renderer to parse and render css selector strings.

Synopsis

Identifiers

readIdentifier Source #

Arguments

:: String

The given css identifier to parse.

-> String

The result of the parsing: the content of the identifier.

Parse a given css identifier to the content of the identifier.

encodeIdentifier Source #

Arguments

:: Text

The identifier to encode.

-> Text

The encoded identifier.

Encode a given identifier to its css selector equivalent by escaping certain characters.

isValidIdentifier Source #

Arguments

:: String

The given identifier to check.

-> Bool

True if the given identifier is valid, False otherwise.

Check if the given identifier is a valid css selector identifier.

toIdentifier Source #

Arguments

:: (Text -> a)

The given function to wrap the Text identifier to an object.

-> String

The string to validate, and wrap into the given function.

-> a

The identifier object to return if the identifier is valid.

Convert the given string to a given object by first checking if it is a valid identifier, and if not raising an error. If it is a valid identifier, the string is packed, and wrapped in the given function.

Css strings

readCssString Source #

Arguments

:: String

The string that contains the string literal in the css selector.

-> String

A string that contains the content of the string literal.

Parses a css string literal to a string that ontains the content of that string literal.

encodeString Source #

Arguments

:: Char

The type of quotes that should be put around the content (should be ' or ").

-> String

The string that should be converted to a css selector string literal.

-> String

The corresponding css selector string literal.

Convert a string to a css selector string literal. This is done by putting quotes around the content, and escaping certain characters.

encodeText Source #

Arguments

:: Char

The type of quotes that should be put around the content (should be ' or ").

-> Text

The string that should be converted to a css selector string literal.

-> Text

The corresponding css selector string literal.

Convert a string to a css selector string literal. This is done by putting quotes around the content, and escaping certain characters.