mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-21 15:05:47 +00:00
test(docx): also compare number of children
This detects if a tag gets added/removed, or moves within the hierarchy. Signed-off-by: Edwin Török <edwin@etorok.net>
This commit is contained in:
committed by
John MacFarlane
parent
806740805d
commit
2477fb50ff
@@ -45,6 +45,11 @@ compareXML (Elem goodElem) (Elem myElem) =
|
||||
(Comparison { mine = sort (elAttribs myElem)
|
||||
, good = sort (elAttribs goodElem)
|
||||
})))
|
||||
<|> (if length (elContent myElem) == length (elContent goodElem)
|
||||
then Nothing
|
||||
else Just
|
||||
(ElemChildrenDiffer
|
||||
(Comparison { mine = elContent myElem, good = elContent goodElem})))
|
||||
<|> asum (zipWith compareXML (elContent myElem) (elContent goodElem))
|
||||
compareXML (Text goodCData) (Text myCData) =
|
||||
(if cdVerbatim myCData == cdVerbatim goodCData
|
||||
@@ -60,6 +65,7 @@ compareXML g m = Just (OtherContentsDiffer (Comparison {mine = m, good = g}))
|
||||
data XMLDifference
|
||||
= ElemNamesDiffer (Comparison QName)
|
||||
| ElemAttributesDiffer (Comparison [Attr])
|
||||
| ElemChildrenDiffer (Comparison [Content])
|
||||
| CDatasDiffer (Comparison CData)
|
||||
| CRefsDiffer (Comparison String)
|
||||
| OtherContentsDiffer (Comparison Content)
|
||||
|
||||
Reference in New Issue
Block a user