Skip to content

Commit

Permalink
Fix added spaces in XWikiPageProperties format XML output
Browse files Browse the repository at this point in the history
  * Ensure to clean up node after performing operation on the XML
  * Fix existing tests

See: WeblateOrg/weblate#11896
  • Loading branch information
surli committed Jun 19, 2024
1 parent 3a5d460 commit da711ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/translate/storage/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ class TestXWikiPageProperties(test_monolingual.TestMonolingualStore):
<language>%(language)s</language>
<title/>
<content>%(content)s</content>
</xwikidoc>"""
</xwikidoc>"""
)

def getcontent(self, content, language="en"):
Expand Down Expand Up @@ -1152,7 +1152,7 @@ def test_cleaning_attributes(self):
<content># Users Section
test_me=Je peux coder !
</content>
</xwikidoc>"""
</xwikidoc>"""
)
assert (
generatedcontent.getvalue().decode(propfile.encoding) == expected_xml + "\n"
Expand Down
2 changes: 2 additions & 0 deletions translate/storage/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,8 @@ def serialize(self, out):
# if we are editing the source file we should not modify it.
if not self.is_source_file():
self.set_xwiki_xml_attributes(newroot)
# We only want a single line break before the closing node.
newroot.find("content").tail = '\n'
self.write_xwiki_xml(newroot, out)


Expand Down

0 comments on commit da711ca

Please sign in to comment.