Skip to content

Commit

Permalink
Merge pull request #152 from YousefEZ/strip-content
Browse files Browse the repository at this point in the history
✨ Add Strip Attribute to xml content
  • Loading branch information
YousefEZ authored Aug 19, 2023
2 parents 256b066 + ff347aa commit 8822083
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qalib/translators/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ def deserialize_message(
lambda raw_tree: list(map(self._render_embed, raw_tree)),
),
view=apply(get_element(message_tree, "view"), self._render_view, callables, events),
content=get_text(message_tree, "content"),
content=" ".join(get_text(message_tree, "content").split())
if (content := get_element(message_tree, "content"))
and self.get_attribute(content, "strip") == "true"
else get_text(message_tree, "content"),
tts=apply(get_text(message_tree, "tts"), lambda string: string.lower() == "true"),
nonce=apply(get_text(message_tree, "nonce"), int),
delete_after=apply(get_text(message_tree, "delete_after"), float),
Expand Down

0 comments on commit 8822083

Please sign in to comment.