yattag icon indicating copy to clipboard operation
yattag copied to clipboard

bad indentation with cdata

Open ne555 opened this issue 2 years ago • 0 comments

from yattag import Doc, indent


doc, tag, text = Doc().tagtext()
with tag('div'):
    with tag('item'):
        doc.cdata('6*9')
    with tag('item'):
        doc.cdata('42')

result = indent(
    doc.getvalue(),
    indentation = ' '*2,
)
print(result)

produces the output

<div>
  <item>
    <![CDATA[6*9]]></item><item><![CDATA[42]]>
  </item>
</div>

expected

<div>
  <item><![CDATA[6*9]]></item>
  <item><![CDATA[42]]></item>
</div>

ne555 avatar Aug 08 '22 15:08 ne555