taggy-0.2.1: Efficient and simple HTML/XML parsing library

Copyright(c) 2014 Alp Mestanogullari
LicenseBSD3
Maintaineralpmestan@gmail.com
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Text.Taggy.Types

Contents

Description

Core types of taggy.

Synopsis

Tag type

data Tag Source #

A Tag can be one of the following types of tags:

  • an opening tag that has a name, a list of attributes, and whether it is a self-closing tag or not
  • a closing tag with the name of the tag
  • some raw Text
  • an HTML comment tag
  • a script.../script tag
  • a style.../style tag

The latter two are useful to be considered separately in the parser and also lets you collect these bits quite easily.

Instances

Eq Tag Source # 

Methods

(==) :: Tag -> Tag -> Bool #

(/=) :: Tag -> Tag -> Bool #

Show Tag Source # 

Methods

showsPrec :: Int -> Tag -> ShowS #

show :: Tag -> String #

showList :: [Tag] -> ShowS #

tname :: Tag -> Text Source #

Name of a Tag.

tname (TagClose "a") == "a"

isTagOpen :: Tag -> Bool Source #

Is this Tag an opening tag?

isTagClose :: Tag -> Bool Source #

Is this Tag a closing tag?

isTagText :: Tag -> Bool Source #

Is this Tag just some flat text?

isTagComment :: Tag -> Bool Source #

Is this Tag an HTML comment tag?

isTagScript :: Tag -> Bool Source #

Is this Tag a script.../script tag?

isTagStyle :: Tag -> Bool Source #

Is this Tag a style.../style tag?

tagsNamed :: Text -> [Tag] -> [Tag] Source #

Get all the (opening) tags with the given name

Attributes

data Attribute Source #

An attribute is just an attribute name and an attribute value.

Constructors

Attribute !Text !Text 

attrs :: Tag -> [Attribute] Source #

Get the attributes of a Tag.

attrKey :: Attribute -> Text Source #

Get the name of an Attribute.

attrValue :: Attribute -> Text Source #

Get the value of an Attribute.

A small difference list implementation

data L a Source #

appL :: L a -> L a -> L a Source #

insertL :: a -> L a -> L a Source #

singletonL :: a -> L a Source #

toListL :: L a -> [a] Source #