Skip to main content

Module pformat

Module pformat 

Source
Expand description

Pseudo-XML emitter, byte-identical to docutils document.pformat().

Rules (probed against docutils 0.22.4, see the wave-1 probe notes):

  • Element line: 4-space indent per depth, <kind attrs>, no closing tags.
  • Attributes: the five list attributes (backrefs/classes/dupnames/ids/ names, empty ones suppressed) merge with scalar attributes into ONE alphabetically-sorted sequence. Scalars always print.
  • NO XML escaping anywhere. List-attribute items go through docutils serial_escape (\ -> \\, then -> \ ) and join with a space.
  • Text nodes: each line of the text on its own line at child indent.
  • Every emitted line ends with \n.

Functionsยง

pformat