-
Notifications
You must be signed in to change notification settings - Fork 96
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
When iterating over a layoutList, the page iterator moves on to layoutText after iterating over each individual list item #177
Comments
Hi, thanks for raising this! Need to double-check I understand correctly here, but at first pass this is sounding like something we should fix... It seems like the current state is:
Is that matching what you're seeing @rsanaie? IMO 3/ would definitely be a bug. Agreeing on how to better handle 2/ might involve a few more edge cases... This single-level List->Text tree is the only structure I'm aware of in current layout results, but at the service API level it seems like there's nothing to prevent adding more in future or defining deep nesting or more general graphs. I'd be really surprised if the service ever started returning circular relationships, but probably wouldn't completely rule out the possibility of shared children one day. As a general rule, I've also been trying to drive as much parsing and iteration behaviour as possible directly from block ...So I'm initially thinking yes we should change the behaviour of the |
Hi @athewsey yes that's the correct behavior I'm seeing. I agree with you that #3 is a bug that needs to be fixed as the .html() is supposed to output usable data, but currently it's duplicating unnecessarily. Using a tree analogy makes sense, maybe we should have an iterator that iterates through all nodes in some specific order, and then another iterator that visits children only (and leverage recursion)? |
Hi @rsanaie We have a draft bugfix release available at v0.4.1-alpha.1 to fix the serialization bug and provide some basic ability to:
Maybe you'd be able to try it out and share thoughts? Originally I was thinking we should make |
It's working great as expected, thank you! It'd be ideal to specify which blocks should be skipped from html such as page number, header/footer) I'll create a new issue for that! |
🙇 Thanks for the feedback! The fix is now released to mainline version v0.4.1 on NPM with the merge of #178, so closing this issue & will refer to #179 for the other ask 👍 |
When I'm traversing a layout object, after visiting a layout list, the iterator then moves on to individual list items, causing duplication of nodes visited. Is this intended?
This happens in .html() function as well. I know that you can use the childBlockIds of LayoutList to mark down which nodes have been visited and skip them later, but wanted to confirm this behaviour.
Thank you, you guys are awesome!
The text was updated successfully, but these errors were encountered: