diff --git a/docs/measurement.md b/docs/measurement.md index d485f44..1ce48d8 100644 --- a/docs/measurement.md +++ b/docs/measurement.md @@ -120,7 +120,7 @@ A **value** is one of these, in the reference IDML: |---|---|---| | Element presence | Element with `Self`; the first child without `Self` of each tag, if it has attributes (counted as `Parent/Child`); in a child without attributes, its children with attributes (`Parent/Child/Grandchild`); each preference element | The output has an element with the same tag and `Self` (of the parent, for children) | | Attribute | Attribute other than `Self` | The output's attribute is equal, with numbers compared to 6 significant digits | -| `` child | Child of `Properties` (`P.Name`) | Equal text and attributes; a structured child (`PathGeometry`, lists) is compared as a whole | +| `` child | Child of `Properties` (`P.Name`) | Equal text and attributes; a structured child (`PathGeometry`, lists) is compared as a whole. Text that is only a line feed and tabs counts as empty: InDesign writes some empty elements open and closed on two lines (`XMLImportPreference/Properties/TransformParameters`) | | Story text | Story | The text, with paragraph breaks, is identical | | Text range | Start of a paragraph and character style range, at any depth inside wrappers, in the story's text or in a footnote, table cell or note (below) | The output has a range starting at the same offset of the same text flow | | Text range attribute | Attribute or `Properties` child of the range | Equal | diff --git a/tools/compare.py b/tools/compare.py index 4fbc1cd..ab822d8 100644 --- a/tools/compare.py +++ b/tools/compare.py @@ -399,6 +399,10 @@ def props(el): a["P." + c.tag] = canon(c) elif len(c) == 0: text = c.text or "" + # A line feed and tabs alone are the indentation of an + # element written open and closed (docs/measurement.md). + if re.fullmatch(r"\n\t*", text): + text = "" extra = sorted((k, v) for k, v in c.attrib.items() if k != "type") if extra: text = " ".join(f"{k}={v}" for k, v in extra)