mirror of
https://github.com/larksuite/cli.git
synced 2026-09-14 18:42:53 +08:00
7f9c6d9bfb
Reland of #1987 (reverted in #2013 over the BSD attribution gap of github.com/beevik/etree) with the formatter rebuilt on the Go standard library only — no third-party dependency. encoding/xml serves purely as a tokenizer; the output is assembled exclusively from verbatim byte slices of the server content plus indentation inserted between structural elements. Nothing is parsed-and-reserialized, so CDATA sections, whitespace character references in any spelling, entity lexical forms, attribute quoting, and in-tag whitespace survive byte-for-byte — the character-reference masking machinery of the etree implementation is no longer needed. Behavior is unchanged from the reverted PR: --raw stdout and --output files are reindented (never inside the schema's mixed-content text-bearing elements), the default JSON envelope carries the server's XML verbatim without parsing, and formatting failures fall back to the original content with a stderr warning and pretty_printed: false in --output file metadata. All contract tests carry over unweakened; a differential probe against the etree implementation over 53 inputs was byte-identical except six cases where the new formatter preserves the original bytes more faithfully (each pinned in tests).