html5-entity-0.2.0.3: A library for looking up and validating HTML5 entities.

Safe HaskellSafe-Inferred
LanguageHaskell98

Text.Html.Entity

Contents

Synopsis

Entity lookup

entityCodePoints :: Text -> Maybe [Int] Source

Given an entity looks up unicode code points that represent it.

>>> entityCodePoints "μ"
Just [966]
>>> entityCodePoints "&nano;"
Nothing

entityChars :: Text -> Maybe Text Source

Given an entity returns it's textual representation (if any).

>>> entityChars "μ"
Just "μ"
>>> entityChars "&nano;"
Nothing

Entity validation

isValidEntity :: Text -> Bool Source

Check if entity is valid (if such entity exists).

>>> isValidEntity "μ"
True
>>> isValidEntity "&nano;"
False

Entity lookup by name

entityNameCodePoints :: Text -> Maybe [Int] Source

Given a name of entity looks up code points that represent it.

>>> entityNameCodePoints "mu"
Just [966]
>>> entityNameCodePoints "nano"
Nothing

entityNameChars :: Text -> Maybe Text Source

Given a name of entity returns it's textual representation (if any).

>>> entityNameChars "mu"
Just "μ"
>>> entityNameChars "nano"
Nothing

Entity name validation

isValidEntityName :: Text -> Bool Source

Check if entity name is valid (if corresponding entity exists).

>>> isValidEntityName "mu"
True
>>> isValidEntityName "nano"
False