Ξυ³h&/,€      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-Inferred"=γπ markup-parseWarnings covering leftovers, €s and runParserWarn ws " x"These (ParserLeftover "x") ' 'runParserWarn ws "x"This ParserUncaught,runParserWarn (ws `cut` "no whitespace") "x""This (ParserError "no whitespace") markup-parse2run a Parser, throwing away leftovers. Nothing on  or €.runParserMaybe ws "x"NothingrunParserMaybe ws " x"Just ' ' markup-parse7run a Parser, throwing away leftovers. Returns Left on  or €.runParserEither ws " x" Right ' ' markup-parse.Run parser, returning leftovers and errors as s.runParserWarn ws " "That ' 'runParserWarn ws "x"This ParserUncaughtrunParserWarn ws " x"These (ParserLeftover "x") ' ' markup-parse tokenize_ Html [i||][""]' markup-parseΣValue of an attribute. "" is equivalent to true with respect to boolean attributes.( markup-parseName of an attribute.) markup-parseA Markup token6runParser_ (many (token Html)) [i|content|]2[StartTag "foo" [],Content "content",EndTag "foo"]"runParser_ (token Xml) [i||]EmptyElemTag "foo" []*runParser_ (token Html) ""Comment " Comment "ΒrunParser_ (token Xml) [i||]-Decl "xml version=\"1.0\" encoding=\"UTF-8\"")runParser_ (token Html) ""Doctype "DOCTYPE html"8runParser_ (token Xml) ""&Doctype "DOCTYPE foo [ declarations ]"7runParser (token Html) [i||]ΟOK (StartTag "foo" [Attr "a" "a",Attr "b" "b",Attr "c" "c",Attr "check" ""]) ""6runParser (token Xml) [i||]Fail* markup-parse A start tag. 5https://developer.mozilla.org/en-US/docs/Glossary/Tag+ markup-parseΗAn empty element tag. Optional for XML and kind of not allowed in HTML., markup-parseA closing tag.- markup-parseThe content between tags.. markup-parseContents of a comment./ markup-parseContents of a declaration0 markup-parse"Contents of a doctype declaration.1 markup-parse Name of token2 markup-parse*The structure of many returning functions.:A common computation pipeline is to take advantage of the „ Monad instance eg ΐmarkup s bs = bs & (tokenize s >=> gather s) & second (Markup s)3 markup-parseώmarkup-parse generally tries to continue on parse errors, and return what has/can still be parsed, together with any warnings.4 markup-parse1A tag ending with "/>" that is not an element of O (Html only).5 markup-parseΝA tag ending with "/>" that has children. Cannot happen in the parsing phase.6 markup-parseOnly a * can have child tokens.7 markup-parseΐA CloseTag with a different name to the currently open StartTag.8 markup-parse)An EndTag with no corresponding StartTag.9 markup-parse&An EndTag with corresponding StartTag.: markup-parse!An EndTag should never appear in =; markup-parse'Empty Content, Comment, Decl or Doctype= markup-parseA … list of markup )s*markup Html "baz"¦That (Markup {standard = Html, markupTree = [Node {rootLabel = StartTag "foo" [Attr "class" "bar"], subForest = [Node {rootLabel = Content "baz", subForest = []}]}]})A markup-parse•From a parsing pov, Html & Xml (& Svg) are close enough that they share a lot of parsing logic, so that parsing and printing just need some tweaking.?The xml parsing logic is based on the XML productions found in https://www.w3.org/TR/xml/+The html parsing was based on a reading of  .https://hackage.haskell.org/package/html-parse html-parseα, but ignores the various 'x00' to 'xfffd' & eof directives that form part of the html standards.D markup-parseConvert any warnings to an †$resultError $ (tokenize Html) "
|])J markup-parse(Are the trees in the markup well-formed?K markup-parse;Check for well-formedness and rerturn warnings encountered. wellFormed $ Markup Html [Node (Comment "") [], Node (EndTag "foo") [], Node (EmptyElemTag "foo" []) [Node (Content "bar") []], Node (EmptyElemTag "foo" []) []]<[EmptyContent,EndTagInTree,LeafWithChildren,BadEmptyElemTag]L markup-parse A flatparse ) parser.+runParser (token Html) "content"&OK (StartTag "foo" []) "content"M markup-parseParse a bytestring into tokens%tokenize Html [i|content|]7That [StartTag "foo" [],Content "content",EndTag "foo"]N markup-parse tokenize but errors on warnings.O markup-parseHtml tags that self-close‡ markup-parseβnormalize an attribution list, removing duplicate AttrNames, and space concatenating class values.ˆ markup-parserender attributes‰ markup-parserender an attribute)Does not attempt to escape double quotes.P markup-parsebytestring representation of ).#detokenize Html (StartTag "foo" [])""Q markup-parseConvert = to bytestringsΔB.putStr $ markdown (Indented 4) (markup_ Html [i|
|])

R markup-parseδGather together token trees from a token list, placing child elements in nodes and removing EndTags.baz
"ύThat [Node {rootLabel = StartTag "foo" [Attr "class" "bar"], subForest = [Node {rootLabel = Content "baz", subForest = []}]}]S markup-parsegather but errors on warnings.T markup-parse4Convert a markup into a token list, adding end tags.7degather =<< markup Html "baz"ΕThat [StartTag "foo" [Attr "class" "bar"],Content "baz",EndTag "foo"]U markup-parsedegather but errors on warningŠ markup-parse0name string according to xml production rule [5]‹ markup-parse+XML declaration as per production rule [23]V markup-parsexml production [24]W markup-parsexml production [26]Œ markup-parse/Doctype declaration as per production rule [28]X markup-parseXml production [32]Y markup-parse Xml yes/noZ markup-parsexml production [80][ markup-parsexml production [81] markup-parseΟopen xml tag as per xml production rule [40] self-closing xml tag as per [44]Ž markup-parseclosing tag as per [42] markup-parseParse a single ).\ markup-parse6Parse a tag name. Each standard is slightly different. markup-parse Parse an %] markup-parseParse attributions<"#$%&'()/.*+,-0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]<=>?@ABCGH"#$QIKJ3456789:;<2DEF1\O('%&])/.*+,-0MNLPRSTUVZXW[Y Safe-Inferred,~ markup-parse7compare a markup file with a round-trip transformation. markup-parse‘% with unchanged sections filtered out patch [1, 2, 3, 5] [0, 1, 2, 4, 6]"Just [+0, -3, +4, -5, +6]"~~’      !"#$%&'())*+,-./0123456789:;<=>?@@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„‚ƒ…‚ƒ†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œž+markup-parse-0.0.0.1-GA2U8ZeIh6M2mqhHjin8VtMarkupParse.FlatParse MarkupParseMarkupParse.Patch ParserWarningParserLeftover ParserErrorParserUncaughtrunParserMayberunParserEither runParserWarn runParser_ws_ isWhitespacewswsssqdqnotaisa byteStringOf' wrappedSq wrappedDqwrappedQwrappedQNoGuardeqsep bracketed bracketedSBwrappedintdoublesigned$fEqParserWarning$fShowParserWarning$fOrdParserWarning$fGenericParserWarning$fNFDataParserWarning RenderStyleCompactIndentedAttr AttrValueAttrNameTokenStartTag EmptyElemTagEndTagContentCommentDeclDoctypeTagNameResult MarkupWarningBadEmptyElemTagSelfCloserWithChildrenLeafWithChildren TagMismatchUnmatchedEndTag UnclosedTag EndTagInTree EmptyContent MarkupParserMarkupstandard markupTreeStandardHtmlXml resultError resultEither resultMaybemarkupmarkup_ normalize isWellFormed wellFormedtokentokenize tokenize_ selfClosers detokenizemarkdowngathergather_degather degather_xmlVersionInfo xmlVersionNum xmlStandalonexmlYesNoxmlEncodingDecl xmlEncNamenameattrs$fToExprStandard $fToExprAttr $fNFDataAttr $fToExprToken $fNFDataToken$fToExprMarkup$fEqRenderStyle$fShowRenderStyle$fGenericRenderStyle $fShowMarkup $fEqMarkup $fOrdMarkup$fGenericMarkup$fNFDataMarkup $fShowToken $fOrdToken $fEqToken$fGenericToken $fGenericAttr $fShowAttr$fEqAttr $fOrdAttr$fEqMarkupWarning$fShowMarkupWarning$fOrdMarkupWarning$fGenericMarkupWarning$fNFDataMarkupWarning $fEqStandard$fShowStandard $fOrdStandard$fGenericStandard$fNFDataStandard goldenPatchpatch(flatparse-0.5.0.1-5UrmBxIjfc61M7qOmrutv5FlatParse.BasicErrFail byteStringOfdigitthese-1.2-UBdGAEuHN58xE7uqj4k9i Data.TheseThesecontainers-0.6.5.1 Data.TreeTreebaseGHC.Errerror normAttrs renderAttrs renderAttrnameXmldeclXml doctypeXml startTagsXml endTagXml tokenHtmlattr(tree-diff-0.3.0.1-9kp7yyxP4SYFOymatbapJJData.TreeDiff.Classediff