-
Notifications
You must be signed in to change notification settings - Fork 266
Implement serializing CDATA #904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but need to check how lists will be serialized and would we able to deserialize them back.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #904 +/- ##
==========================================
+ Coverage 55.52% 58.74% +3.21%
==========================================
Files 42 42
Lines 15511 15256 -255
==========================================
+ Hits 8613 8962 +349
+ Misses 6898 6294 -604
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/se/simple_type.rs
Outdated
serialize_cdata_as!(seq_basic: vec!["foo", "bar", "baz"] => "<![CDATA[foo]]> <![CDATA[bar]]> <![CDATA[baz]]>"); | ||
serialize_cdata_as!(seq_with_markup_chars: vec!["<tag>", "&entity", "\"quoted\"", "with space"] => "<![CDATA[<tag>]]> <![CDATA[&entity]]> <![CDATA[\"quoted\"]]> <![CDATA[with space]]>"); | ||
serialize_cdata_as!(seq_with_cdata_end_split: vec!["foo]]>bar", "test"] => "<![CDATA[foo]]]]><![CDATA[>bar]]> <![CDATA[test]]>"); | ||
serialize_cdata_as!(tuple_cdata: ("first", 42, "third") => "<![CDATA[first]]> <![CDATA[42]]> <![CDATA[third]]>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better, if this serialized as one CDATA section. Probably, that is possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah agreed, need to figure out exactly how to do that nicely with serde
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright changed it so it gets serialized to one CDATA section
one thing i'm not clear on is if there are spaces inside the items, should the spaces get escaped even when it's wrapped with a CDATA
Great to see this being merged soon 👍 I gave this implementation a try. One thing that confused me was that the example implies that the |
Also, I think the following test case should be added:
As I think(?) it generates incorrect XML:
EDIT: Actually, I think it's correct, with
|
I'm a bit busy last time, but I will try to find time to review this ASAP.
It should use CDATA as well.
Yes, having |
Wouldn't it be preferable to only use CDATA if |
I think not. Imagine, if you want to store HTML in the |
Well, then you are free to mark it as I'm not saying it's a blocker, I was mostly curious why it isn't only applied to |
Closes: #353