Skip to content

Commit

Permalink
fixes #949L pretty format the header block xml comment
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhrisca committed Nov 10, 2023
1 parent fb01f7a commit a725385
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/asammdf/blocks/v4_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from traceback import format_exc
from typing import Any, TYPE_CHECKING
import xml.etree.ElementTree as ET
from xml.dom import minidom

import dateutil.tz

Expand Down Expand Up @@ -5596,12 +5597,16 @@ def common_properties_to_xml(root, common_properties):

common_properties_to_xml(common, self._common_properties)

return (
comment_xml = (
ET.tostring(root, encoding="utf8", method="xml")
.replace(b"<?xml version='1.0' encoding='utf8'?>\n", b"")
.decode("utf-8")
)

comment_xml = minidom.parseString(comment_xml).toprettyxml(indent=" ")

return "\n".join(comment_xml.splitlines()[1:])

@comment.setter
def comment(self, string):
self._common_properties.clear()
Expand Down

0 comments on commit a725385

Please sign in to comment.