Text.Pandoc.XML

pandoc-3.7.0.2: Conversion between markup formats

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

Text.Pandoc.XML

Description

Functions for escaping and formatting XML.

Synopsis

- escapeCharForXML :: Char -> Text
- escapeStringForXML :: Text -> Text
- escapeNCName :: Text -> Text
- inTags :: (HasChars a, IsString a) => Bool -> Text -> [(Text, Text)] -> Doc a -> Doc a
- selfClosingTag :: (HasChars a, IsString a) => Text -> [(Text, Text)] -> Doc a
- inTagsSimple :: (HasChars a, IsString a) => Text -> Doc a -> Doc a
- inTagsIndented :: (HasChars a, IsString a) => Text -> Doc a -> Doc a
- toEntities :: Text -> Text
- toHtml5Entities :: Text -> Text
- fromEntities :: Text -> Text
- lookupEntity :: Text -> Maybe Text
- html4Attributes :: Set Text
- html5Attributes :: Set Text
- rdfaAttributes :: Set Text

# Documentation

escapeCharForXML :: Char -> Text #

Escape one character as needed for XML.

escapeStringForXML :: Text -> Text #

Escape string as needed for XML. Entity references are not preserved.

escapeNCName :: Text -> Text #

Converts a string into an NCName, i.e., an XML name without colons. Disallowed characters are escaped using `ux%x`, where `%x` is the hexadecimal unicode identifier of the escaped character.

inTags :: (HasChars a, IsString a) => Bool -> Text -> [(Text, Text)] -> Doc a -> Doc a #

Put the supplied contents between start and end tags of tagType, with specified attributes and (if specified) indentation.

selfClosingTag :: (HasChars a, IsString a) => Text -> [(Text, Text)] -> Doc a #

Return a self-closing tag of tagType with specified attributes

inTagsSimple :: (HasChars a, IsString a) => Text -> Doc a -> Doc a #

Put the supplied contents between start and end tags of tagType.

inTagsIndented :: (HasChars a, IsString a) => Text -> Doc a -> Doc a #

Put the supplied contents in indented block btw start and end tags.

toEntities :: Text -> Text #

Escape all non-ascii characters using numerical entities.

toHtml5Entities :: Text -> Text #

Escape all non-ascii characters using HTML5 entities, falling back to numerical entities.

fromEntities :: Text -> Text #

Unescapes XML entities

lookupEntity :: Text -> Maybe Text #

Lookup an entity, using `lookupNumericEntity` if it starts with `#` and `lookupNamedEntity` otherwise

html4Attributes :: Set Text #

html5Attributes :: Set Text #

rdfaAttributes :: Set Text #