Copyright | Copyright (C) 2021-2023 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 |
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.
Synopsis
- module Text.Pandoc.XML.Light.Types
- module Text.Pandoc.XML.Light.Proc
- module Text.Pandoc.XML.Light.Output
- 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]
Documentation
module Text.Pandoc.XML.Light.Types
module Text.Pandoc.XML.Light.Proc
module Text.Pandoc.XML.Light.Output