mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-25 09:47:06 +00:00
This adds a reader and writer for an XML format equivalent to `native` and `json`. XML schemas for validation can be found in `tools/pandoc-xml.*`. The format is documented in `doc/xml.md`. API changes: - Add module Text.Pandoc.Readers.XML, exporting `readXML`. - Add module Text.Pandoc.Writers.XML, exporting `writeXML`. A new unexported module Text.Pandoc.XMLFormat is also added.
28 lines
893 B
Haskell
28 lines
893 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
{- |
|
|
-- Module : Tests.XML
|
|
-- Copyright : Copyright (C) 2025- Massimiliano Farinella and John MacFarlane
|
|
-- License : GNU GPL, version 2 or above
|
|
--
|
|
-- Maintainer : Massimiliano Farinella <massifrg@gmail.com>
|
|
-- Stability : WIP
|
|
-- Portability : portable
|
|
Runs a roundtrip conversion of an AST trough the XML format:
|
|
- first from AST to XML (XML Writer),
|
|
- then back to AST (XML Reader),
|
|
- and checks that the two ASTs are the same
|
|
-}
|
|
module Tests.XML (tests) where
|
|
|
|
import Control.Monad ((>=>))
|
|
import Test.Tasty (TestTree)
|
|
import Test.Tasty.QuickCheck
|
|
import Tests.Helpers
|
|
import Text.Pandoc
|
|
import Text.Pandoc.Arbitrary ()
|
|
|
|
p_xml_roundtrip :: Pandoc -> Bool
|
|
p_xml_roundtrip d = d == purely (writeXML def {writerTemplate = Just mempty} >=> readXML def) d
|
|
|
|
tests :: [TestTree]
|
|
tests = [testProperty "p_xml_roundtrip" p_xml_roundtrip] |