Skip to content
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

Fix XML rendering #385

Merged
merged 4 commits into from
Oct 5, 2022
Merged

Fix XML rendering #385

merged 4 commits into from
Oct 5, 2022

Conversation

ybasket
Copy link
Collaborator

@ybasket ybasket commented Oct 4, 2022

Fix buggy Show instance for XmlEvent and provide a pipe to render events with collapsed empty tags.

@ybasket ybasket requested a review from satabin October 4, 2022 08:28
@satabin satabin added bug Something isn't working xml labels Oct 4, 2022
def render[F[_]](collapseEmpty: Boolean = true): Pipe[F, XmlEvent, String] =
_.zipWithPrevious.map {
case (_, st: XmlEvent.StartTag) => st.render(collapseEmpty)
case (Some(XmlEvent.StartTag(_, _, true)), XmlEvent.EndTag(_)) if collapseEmpty => ""
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@satabin Just confirming: It is correct that we emit an EndTag after a StartTag with isEmpty=true, right?

So <doc/> would lead to Lis(StartTag("doc", Nil, true), EndTag("doc")).

@satabin satabin added this to the 1.6.0 milestone Oct 4, 2022
@ybasket ybasket changed the base branch from main to series/1.5.x October 5, 2022 10:37
@ybasket ybasket force-pushed the fix/xml-rendering branch from 3dd4d2c to 10d2f56 Compare October 5, 2022 10:47
@ybasket ybasket merged commit 4b329fd into series/1.5.x Oct 5, 2022
@ybasket ybasket deleted the fix/xml-rendering branch October 5, 2022 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working xml
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants