Text.Pandoc.XML.Light.Types

pandoc-3.7.0.2: Conversion between markup formats

Copyright | Copyright (C) 2007 Galois Inc. 2021-2024 John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.Pandoc.XML.Light.Types

Contents

- Basic types, duplicating those from xml-light but with Text
- Conversion functions from xml-light types

Description

This code is taken from xml-light, released under the BSD3 license. It has been modified to use Text instead of String, and the fromXL* functions have been added.

Synopsis

- type Line = Integer
- data Content
  - = Elem Element
  - | Text CData
  - | CRef Text
- data Element = Element {
  - elName :: QName
  - elAttribs :: [Attr]
  - elContent :: [Content]
  - elLine :: Maybe Line
  }
- data Attr = Attr {
  - attrKey :: QName
  - attrVal :: Text
  }
- data CData = CData {
  - cdVerbatim :: CDataKind
  - cdData :: Text
  - cdLine :: Maybe Line
  }
- data CDataKind
  - = CDataText
  - | CDataVerbatim
  - | CDataRaw
- data QName = QName {
  - qName :: Text
  - qURI :: Maybe Text
  - qPrefix :: Maybe Text
  }
- class Node t where
  - node :: QName -> t -> Element
- unode :: Node t => Text -> t -> Element
- unqual :: Text -> QName
- add_attr :: Attr -> Element -> Element
- add_attrs :: [Attr] -> Element -> Element
- fromXLQName :: QName -> QName
- fromXLCData :: CData -> CData
- fromXLElement :: Element -> Element
- fromXLAttr :: Attr -> Attr
- fromXLContent :: Content -> Content

# Basic types, duplicating those from xml-light but with Text

type Line = Integer #

A line is an Integer

data Content #

XML content

Constructors

Elem Element |
Text CData |
CRef Text |

#### Instances

Instances details

Data Content # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Content -> c Content # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Content # toConstr :: Content -> Constr # dataTypeOf :: Content -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Content) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Content) # gmapT :: (forall b. Data b => b -> b) -> Content -> Content # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Content -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Content -> r # gmapQ :: (forall d. Data d => d -> u) -> Content -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Content -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Content -> m Content # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Content -> m Content # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Content -> m Content #
Show Content # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods showsPrec :: Int -> Content -> ShowS # show :: Content -> String # showList :: [Content] -> ShowS #
Eq Content # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods (==) :: Content -> Content -> Bool # (/=) :: Content -> Content -> Bool #
Ord Content # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods compare :: Content -> Content -> Ordering # (<) :: Content -> Content -> Bool # (<=) :: Content -> Content -> Bool # (>) :: Content -> Content -> Bool # (>=) :: Content -> Content -> Bool # max :: Content -> Content -> Content # min :: Content -> Content -> Content #
Node Content # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> Content -> Element #
Node [Content] # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> [Content] -> Element #
Node (Attr, Content) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, Content) -> Element #
Node ([Attr], Content) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], Content) -> Element #
Node ([Attr], [Content]) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], [Content]) -> Element #

data Element #

XML elements

Constructors

Element |
Fields elName :: QName elAttribs :: [Attr] elContent :: [Content] elLine :: Maybe Line

#### Instances

Instances details

Data Element # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Element -> c Element # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Element # toConstr :: Element -> Constr # dataTypeOf :: Element -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Element) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Element) # gmapT :: (forall b. Data b => b -> b) -> Element -> Element # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Element -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Element -> r # gmapQ :: (forall d. Data d => d -> u) -> Element -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Element -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Element -> m Element # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Element -> m Element # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Element -> m Element #
Show Element # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods showsPrec :: Int -> Element -> ShowS # show :: Element -> String # showList :: [Element] -> ShowS #
Eq Element # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods (==) :: Element -> Element -> Bool # (/=) :: Element -> Element -> Bool #
Ord Element # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods compare :: Element -> Element -> Ordering # (<) :: Element -> Element -> Bool # (<=) :: Element -> Element -> Bool # (>) :: Element -> Element -> Bool # (>=) :: Element -> Element -> Bool # max :: Element -> Element -> Element # min :: Element -> Element -> Element #
Node Element # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> Element -> Element #
Node [Element] # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> [Element] -> Element #
Node (Attr, Element) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, Element) -> Element #
Node ([Attr], Element) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], Element) -> Element #
Node ([Attr], [Element]) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], [Element]) -> Element #

data Attr #

XML attributes

Constructors

Attr |
Fields attrKey :: QName attrVal :: Text

#### Instances

Instances details

Data Attr # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Attr -> c Attr # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Attr # toConstr :: Attr -> Constr # dataTypeOf :: Attr -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Attr) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr) # gmapT :: (forall b. Data b => b -> b) -> Attr -> Attr # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r # gmapQ :: (forall d. Data d => d -> u) -> Attr -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Attr -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Attr -> m Attr # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Attr -> m Attr # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Attr -> m Attr #
Show Attr # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods showsPrec :: Int -> Attr -> ShowS # show :: Attr -> String # showList :: [Attr] -> ShowS #
Eq Attr # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods (==) :: Attr -> Attr -> Bool # (/=) :: Attr -> Attr -> Bool #
Ord Attr # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods compare :: Attr -> Attr -> Ordering # (<) :: Attr -> Attr -> Bool # (<=) :: Attr -> Attr -> Bool # (>) :: Attr -> Attr -> Bool # (>=) :: Attr -> Attr -> Bool # max :: Attr -> Attr -> Attr # min :: Attr -> Attr -> Attr #
Node Attr # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> Attr -> Element #
Node [Attr] # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> [Attr] -> Element #
Node (Attr, CData) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, CData) -> Element #
Node (Attr, Content) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, Content) -> Element #
Node (Attr, Element) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, Element) -> Element #
Node (Attr, Text) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, Text) -> Element #
Node ([Attr], CData) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], CData) -> Element #
Node ([Attr], Content) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], Content) -> Element #
Node ([Attr], Element) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], Element) -> Element #
Node ([Attr], Text) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], Text) -> Element #
Node ([Attr], [CData]) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], [CData]) -> Element #
Node ([Attr], [Content]) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], [Content]) -> Element #
Node ([Attr], [Element]) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], [Element]) -> Element #

data CData #

XML CData

Constructors

CData |
Fields cdVerbatim :: CDataKind cdData :: Text cdLine :: Maybe Line

#### Instances

Instances details

Data CData # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CData -> c CData # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CData # toConstr :: CData -> Constr # dataTypeOf :: CData -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CData) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CData) # gmapT :: (forall b. Data b => b -> b) -> CData -> CData # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r # gmapQ :: (forall d. Data d => d -> u) -> CData -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CData -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CData -> m CData # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CData -> m CData # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CData -> m CData #
Show CData # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods showsPrec :: Int -> CData -> ShowS # show :: CData -> String # showList :: [CData] -> ShowS #
Eq CData # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods (==) :: CData -> CData -> Bool # (/=) :: CData -> CData -> Bool #
Ord CData # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods compare :: CData -> CData -> Ordering # (<) :: CData -> CData -> Bool # (<=) :: CData -> CData -> Bool # (>) :: CData -> CData -> Bool # (>=) :: CData -> CData -> Bool # max :: CData -> CData -> CData # min :: CData -> CData -> CData #
Node CData # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> CData -> Element #
Node [CData] # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> [CData] -> Element #
Node (Attr, CData) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, CData) -> Element #
Node ([Attr], CData) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], CData) -> Element #
Node ([Attr], [CData]) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], [CData]) -> Element #

data CDataKind #

Constructors

CDataText | Ordinary character data; pretty printer escapes &, < etc.
CDataVerbatim | Unescaped character data; pretty printer embeds it in <![CDATA[..
CDataRaw | As-is character data; pretty printer passes it along without any escaping or CDATA wrap-up.

#### Instances

Instances details

Data CDataKind # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CDataKind -> c CDataKind # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CDataKind # toConstr :: CDataKind -> Constr # dataTypeOf :: CDataKind -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CDataKind) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CDataKind) # gmapT :: (forall b. Data b => b -> b) -> CDataKind -> CDataKind # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CDataKind -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CDataKind -> r # gmapQ :: (forall d. Data d => d -> u) -> CDataKind -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CDataKind -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind #
Show CDataKind # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods showsPrec :: Int -> CDataKind -> ShowS # show :: CDataKind -> String # showList :: [CDataKind] -> ShowS #
Eq CDataKind # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods (==) :: CDataKind -> CDataKind -> Bool # (/=) :: CDataKind -> CDataKind -> Bool #
Ord CDataKind # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods compare :: CDataKind -> CDataKind -> Ordering # (<) :: CDataKind -> CDataKind -> Bool # (<=) :: CDataKind -> CDataKind -> Bool # (>) :: CDataKind -> CDataKind -> Bool # (>=) :: CDataKind -> CDataKind -> Bool # max :: CDataKind -> CDataKind -> CDataKind # min :: CDataKind -> CDataKind -> CDataKind #

data QName #

XML qualified names

Constructors

QName |
Fields qName :: Text qURI :: Maybe Text qPrefix :: Maybe Text

#### Instances

Instances details

Data QName # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> QName -> c QName # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c QName # toConstr :: QName -> Constr # dataTypeOf :: QName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c QName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QName) # gmapT :: (forall b. Data b => b -> b) -> QName -> QName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r # gmapQ :: (forall d. Data d => d -> u) -> QName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> QName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> QName -> m QName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> QName -> m QName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> QName -> m QName #
Show QName # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods showsPrec :: Int -> QName -> ShowS # show :: QName -> String # showList :: [QName] -> ShowS #
Eq QName # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods (==) :: QName -> QName -> Bool # (/=) :: QName -> QName -> Bool #
Ord QName # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods compare :: QName -> QName -> Ordering # (<) :: QName -> QName -> Bool # (<=) :: QName -> QName -> Bool # (>) :: QName -> QName -> Bool # (>=) :: QName -> QName -> Bool # max :: QName -> QName -> QName # min :: QName -> QName -> QName #

class Node t where #

Methods

node :: QName -> t -> Element #

#### Instances

Instances details

Node Attr # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> Attr -> Element #
Node CData # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> CData -> Element #
Node Content # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> Content -> Element #
Node Element # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> Element -> Element #
Node Text # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> Text -> Element #
Node () # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> () -> Element #
Node [Attr] # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> [Attr] -> Element #
Node [CData] # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> [CData] -> Element #
Node [Content] # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> [Content] -> Element #
Node [Element] # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> [Element] -> Element #
Node (Attr, CData) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, CData) -> Element #
Node (Attr, Content) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, Content) -> Element #
Node (Attr, Element) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, Element) -> Element #
Node (Attr, Text) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> (Attr, Text) -> Element #
Node ([Attr], CData) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], CData) -> Element #
Node ([Attr], Content) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], Content) -> Element #
Node ([Attr], Element) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], Element) -> Element #
Node ([Attr], Text) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], Text) -> Element #
Node ([Attr], [CData]) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], [CData]) -> Element #
Node ([Attr], [Content]) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], [Content]) -> Element #
Node ([Attr], [Element]) # |
Instance details Defined in Text.Pandoc.XML.Light.Types Methods node :: QName -> ([Attr], [Element]) -> Element #

unode :: Node t => Text -> t -> Element #

Create node with unqualified name

unqual :: Text -> QName #

add_attr :: Attr -> Element -> Element #

Add an attribute to an element.

add_attrs :: [Attr] -> Element -> Element #

Add some attributes to an element.

# Conversion functions from xml-light types

fromXLQName :: QName -> QName #

fromXLCData :: CData -> CData #

fromXLElement :: Element -> Element #

fromXLAttr :: Attr -> Attr #

fromXLContent :: Content -> Content #