-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | ml-light
--   
--   Pandoc is a Haskell library for converting from one markup format to
--   another. The formats it can handle include
--   
--   <ul>
--   <li>light markup formats (many variants of Markdown, reStructuredText,
--   AsciiDoc, Org-mode, Muse, Textile, txt2tags, djot)</li>
--   <li>HTML formats (HTML 4 and 5)</li>
--   <li>Ebook formats (EPUB v2 and v3, FB2)</li>
--   <li>Documentation formats (GNU TexInfo, Haddock, Vimdoc)</li>
--   <li>Roff formats (man, ms)</li>
--   <li>TeX formats (LaTeX, ConTeXt)</li>
--   <li>Typst</li>
--   <li>XML formats (DocBook 4 and 5, JATS, TEI Simple, OpenDocument)</li>
--   <li>Outline formats (OPML)</li>
--   <li>Bibliography formats (BibTeX, BibLaTeX, CSL JSON, CSL YAML,
--   RIS)</li>
--   <li>Word processor formats (Docx, RTF, ODT)</li>
--   <li>Interactive notebook formats (Jupyter notebook ipynb)</li>
--   <li>Page layout formats (InDesign ICML)</li>
--   <li>Wiki markup formats (MediaWiki, DokuWiki, TikiWiki, TWiki,
--   Vimwiki, XWiki, ZimWiki, Jira wiki, Creole)</li>
--   <li>Slide show formats (LaTeX Beamer, PowerPoint, Slidy, reveal.js,
--   Slideous, S5, DZSlides)</li>
--   <li>Data formats (CSV and TSV tables)</li>
--   <li>PDF (via external programs such as pdflatex or wkhtmltopdf)</li>
--   </ul>
--   
--   Pandoc can convert mathematical content in documents between TeX,
--   MathML, Word equations, roff eqn, typst, and plain text. It includes a
--   powerful system for automatic citations and bibliographies, and it can
--   be customized extensively using templates, filters, and custom readers
--   and writers written in Lua.
--   
--   For the pandoc command-line program, see the <tt>pandoc-cli</tt>
--   package.
@package pandoc:xml-light
@version 3.8.3


-- | 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.
module Text.Pandoc.XML.Light.Types

-- | A line is an Integer
type Line = Integer

-- | XML content
data Content
Elem :: Element -> Content
Text :: CData -> Content
CRef :: Text -> Content

-- | XML elements
data Element
Element :: QName -> [Attr] -> [Content] -> Maybe Line -> Element
[elName] :: Element -> QName
[elAttribs] :: Element -> [Attr]
[elContent] :: Element -> [Content]
[elLine] :: Element -> Maybe Line

-- | XML attributes
data Attr
Attr :: QName -> Text -> Attr
[attrKey] :: Attr -> QName
[attrVal] :: Attr -> Text

-- | XML CData
data CData
CData :: CDataKind -> Text -> Maybe Line -> CData
[cdVerbatim] :: CData -> CDataKind
[cdData] :: CData -> Text
[cdLine] :: CData -> Maybe Line
data CDataKind

-- | Ordinary character data; pretty printer escapes &amp;, &lt; etc.
CDataText :: CDataKind

-- | Unescaped character data; pretty printer embeds it in &lt;![CDATA[..
CDataVerbatim :: CDataKind

-- | As-is character data; pretty printer passes it along without any
--   escaping or CDATA wrap-up.
CDataRaw :: CDataKind

-- | XML qualified names
data QName
QName :: Text -> Maybe Text -> Maybe Text -> QName
[qName] :: QName -> Text
[qURI] :: QName -> Maybe Text
[qPrefix] :: QName -> Maybe Text
class Node t
node :: Node t => QName -> t -> Element

-- | Create node with unqualified name
unode :: Node t => Text -> t -> Element
unqual :: Text -> QName

-- | Add an attribute to an element.
add_attr :: Attr -> Element -> Element

-- | Add some attributes to an element.
add_attrs :: [Attr] -> Element -> Element
fromXLQName :: QName -> QName
fromXLCData :: CData -> CData
fromXLElement :: Element -> Element
fromXLAttr :: Attr -> Attr
fromXLContent :: Content -> Content
instance GHC.Internal.Data.Data.Data Text.Pandoc.XML.Light.Types.Attr
instance GHC.Internal.Data.Data.Data Text.Pandoc.XML.Light.Types.CData
instance GHC.Internal.Data.Data.Data Text.Pandoc.XML.Light.Types.CDataKind
instance GHC.Internal.Data.Data.Data Text.Pandoc.XML.Light.Types.Content
instance GHC.Internal.Data.Data.Data Text.Pandoc.XML.Light.Types.Element
instance GHC.Internal.Data.Data.Data Text.Pandoc.XML.Light.Types.QName
instance GHC.Classes.Eq Text.Pandoc.XML.Light.Types.Attr
instance GHC.Classes.Eq Text.Pandoc.XML.Light.Types.CData
instance GHC.Classes.Eq Text.Pandoc.XML.Light.Types.CDataKind
instance GHC.Classes.Eq Text.Pandoc.XML.Light.Types.Content
instance GHC.Classes.Eq Text.Pandoc.XML.Light.Types.Element
instance GHC.Classes.Eq Text.Pandoc.XML.Light.Types.QName
instance Text.Pandoc.XML.Light.Types.Node Text.Pandoc.XML.Light.Types.Attr
instance Text.Pandoc.XML.Light.Types.Node Text.Pandoc.XML.Light.Types.CData
instance Text.Pandoc.XML.Light.Types.Node Text.Pandoc.XML.Light.Types.Content
instance Text.Pandoc.XML.Light.Types.Node Text.Pandoc.XML.Light.Types.Element
instance Text.Pandoc.XML.Light.Types.Node [Text.Pandoc.XML.Light.Types.Attr]
instance Text.Pandoc.XML.Light.Types.Node [Text.Pandoc.XML.Light.Types.Content]
instance Text.Pandoc.XML.Light.Types.Node [Text.Pandoc.XML.Light.Types.Element]
instance Text.Pandoc.XML.Light.Types.Node [Text.Pandoc.XML.Light.Types.CData]
instance Text.Pandoc.XML.Light.Types.Node Data.Text.Internal.Text
instance Text.Pandoc.XML.Light.Types.Node ([Text.Pandoc.XML.Light.Types.Attr], [Text.Pandoc.XML.Light.Types.Content])
instance Text.Pandoc.XML.Light.Types.Node ([Text.Pandoc.XML.Light.Types.Attr], Text.Pandoc.XML.Light.Types.Content)
instance Text.Pandoc.XML.Light.Types.Node (Text.Pandoc.XML.Light.Types.Attr, Text.Pandoc.XML.Light.Types.Content)
instance Text.Pandoc.XML.Light.Types.Node ([Text.Pandoc.XML.Light.Types.Attr], [Text.Pandoc.XML.Light.Types.Element])
instance Text.Pandoc.XML.Light.Types.Node ([Text.Pandoc.XML.Light.Types.Attr], Text.Pandoc.XML.Light.Types.Element)
instance Text.Pandoc.XML.Light.Types.Node (Text.Pandoc.XML.Light.Types.Attr, Text.Pandoc.XML.Light.Types.Element)
instance Text.Pandoc.XML.Light.Types.Node ([Text.Pandoc.XML.Light.Types.Attr], [Text.Pandoc.XML.Light.Types.CData])
instance Text.Pandoc.XML.Light.Types.Node ([Text.Pandoc.XML.Light.Types.Attr], Text.Pandoc.XML.Light.Types.CData)
instance Text.Pandoc.XML.Light.Types.Node (Text.Pandoc.XML.Light.Types.Attr, Text.Pandoc.XML.Light.Types.CData)
instance Text.Pandoc.XML.Light.Types.Node ([Text.Pandoc.XML.Light.Types.Attr], Data.Text.Internal.Text)
instance Text.Pandoc.XML.Light.Types.Node (Text.Pandoc.XML.Light.Types.Attr, Data.Text.Internal.Text)
instance Text.Pandoc.XML.Light.Types.Node ()
instance GHC.Classes.Ord Text.Pandoc.XML.Light.Types.Attr
instance GHC.Classes.Ord Text.Pandoc.XML.Light.Types.CData
instance GHC.Classes.Ord Text.Pandoc.XML.Light.Types.CDataKind
instance GHC.Classes.Ord Text.Pandoc.XML.Light.Types.Content
instance GHC.Classes.Ord Text.Pandoc.XML.Light.Types.Element
instance GHC.Classes.Ord Text.Pandoc.XML.Light.Types.QName
instance GHC.Internal.Show.Show Text.Pandoc.XML.Light.Types.Attr
instance GHC.Internal.Show.Show Text.Pandoc.XML.Light.Types.CData
instance GHC.Internal.Show.Show Text.Pandoc.XML.Light.Types.CDataKind
instance GHC.Internal.Show.Show Text.Pandoc.XML.Light.Types.Content
instance GHC.Internal.Show.Show Text.Pandoc.XML.Light.Types.Element
instance GHC.Internal.Show.Show Text.Pandoc.XML.Light.Types.QName


-- | This code is taken from xml-light, released under the BSD3 license.
module Text.Pandoc.XML.Light.Proc

-- | Get the text value of an XML element. This function ignores non-text
--   elements, and concatenates all text elements.
strContent :: Element -> Text

-- | Select only the elements from a list of XML content.
onlyElems :: [Content] -> [Element]

-- | Select only the elements from a parent.
elChildren :: Element -> [Element]

-- | Select only the text from a list of XML content.
onlyText :: [Content] -> [CData]

-- | Find all immediate children with the given name.
findChildren :: QName -> Element -> [Element]

-- | Filter all immediate children wrt a given predicate.
filterChildren :: (Element -> Bool) -> Element -> [Element]

-- | Filter all immediate children wrt a given predicate over their names.
filterChildrenName :: (QName -> Bool) -> Element -> [Element]

-- | Find an immediate child with the given name.
findChild :: QName -> Element -> Maybe Element

-- | Find an immediate child with the given name.
filterChild :: (Element -> Bool) -> Element -> Maybe Element

-- | Find an immediate child with name matching a predicate.
filterChildName :: (QName -> Bool) -> Element -> Maybe Element

-- | Find the left-most occurrence of an element matching given name.
findElement :: QName -> Element -> Maybe Element

-- | Filter the left-most occurrence of an element wrt. given predicate.
filterElement :: (Element -> Bool) -> Element -> Maybe Element

-- | Filter the left-most occurrence of an element wrt. given predicate.
filterElementName :: (QName -> Bool) -> Element -> Maybe Element

-- | Find all non-nested occurrences of an element. (i.e., once we have
--   found an element, we do not search for more occurrences among the
--   element's children).
findElements :: QName -> Element -> [Element]

-- | Find all non-nested occurrences of an element wrt. given predicate.
--   (i.e., once we have found an element, we do not search for more
--   occurrences among the element's children).
filterElements :: (Element -> Bool) -> Element -> [Element]

-- | Find all non-nested occurrences of an element wrt a predicate over
--   element names. (i.e., once we have found an element, we do not search
--   for more occurrences among the element's children).
filterElementsName :: (QName -> Bool) -> Element -> [Element]

-- | Lookup the value of an attribute.
findAttr :: QName -> Element -> Maybe Text

-- | Lookup attribute name from list.
lookupAttr :: QName -> [Attr] -> Maybe Text

-- | Lookup the first attribute whose name satisfies the given predicate.
lookupAttrBy :: (QName -> Bool) -> [Attr] -> Maybe Text

-- | Lookup the value of the first attribute whose name satisfies the given
--   predicate.
findAttrBy :: (QName -> Bool) -> Element -> Maybe Text


-- | This code is based on code from xml-light, released under the BSD3
--   license. We use a text Builder instead of ShowS.
module Text.Pandoc.XML.Light.Output

-- | Pretty printing renders XML documents faithfully, with the exception
--   that whitespace may be added/removed in non-verbatim character data.
ppTopElement :: Element -> Text

-- | Pretty printing elements
ppElement :: Element -> Text

-- | Pretty printing content
ppContent :: Content -> Text

-- | Pretty printing elements
ppcElement :: ConfigPP -> Element -> Text

-- | Pretty printing content
ppcContent :: ConfigPP -> Content -> Text

-- | Adds the <a>?xml?</a> header.
showTopElement :: Element -> Text
showElement :: Element -> Text
showContent :: Content -> Text

-- | The predicate specifies for which empty tags we should use XML's
--   abbreviated notation <a>/</a>. This is useful if we are working with
--   some XML-ish standards (such as certain versions of HTML) where some
--   empty tags should always be displayed in the <a>TAG</a><a>/TAG</a>
--   form.
useShortEmptyTags :: (QName -> Bool) -> ConfigPP -> ConfigPP

-- | Default pretty orinting configuration. * Always use abbreviate empty
--   tags.
defaultConfigPP :: ConfigPP
data ConfigPP
ConfigPP :: (QName -> Bool) -> Bool -> ConfigPP
[shortEmptyTag] :: ConfigPP -> QName -> Bool
[prettify] :: ConfigPP -> Bool


-- | xml-light, which we used in pandoc's the XML-based readers, has some
--   limitations: in particular, it produces nodes with String instead of
--   Text, and the parser falls over on processing instructions (see
--   #7091).
--   
--   This module exports much of the API of xml-light, but using Text
--   instead of String. In addition, the xml-light parsers are replaced by
--   xml-conduit's well-tested parser. (The xml-conduit types are mapped to
--   types isomorphic to xml-light's, to avoid the need for massive code
--   modifications elsewhere.) Bridge functions to map xml-light types to
--   this module's types are also provided (since libraries like texmath
--   still use xml-light).
--   
--   Another advantage of the xml-conduit parser is that it gives us
--   detailed information on xml parse errors.
--   
--   In the future we may want to move to using xml-conduit or another xml
--   library in the code base, but this change gives us better performance
--   and accuracy without much change in the code that used xml-light.
module Text.Pandoc.XML.Light
parseXMLElement :: Text -> Either Text Element
parseXMLContents :: Text -> Either Text [Content]
parseXMLElementWithEntities :: Map Text Text -> Text -> Either Text Element
parseXMLContentsWithEntities :: Map Text Text -> Text -> Either Text [Content]
