Prevent page.layout.{html(), str(), text} from duplicating the content of LAYOUT_TEXT items also referenced as children of LAYOUT_LISTs: Since a PAGE block's children includes all the layout items their interrelations.
Add some basic accessor methods for traversing nested layout item relationships, and support toggling recursive vs non-recursive in page.layout.{iterItems(), listItems()}
Deprecate ambiguous page.layout.nItems in favour of .nItemsTotal (the old behaviour counting everything) and .nItemsDirect (counting only top-level layout items)
Add iter/listRelatedItemsByRelType() accessors for directly iterating related items, rather than user code always having to resolve block IDs to parsed items. These new methods have filtering & logging/error params which I hope we can standardise more across TRP.js in future releases (but not a patch release, as some breaking changes wrt handling of invalid Textract JSONs would likely be unavoidable - current behaviour is inconsistent between sub-modules)
Testing:
New unit tests created to catch the bug behaviour and cover the new additions.
Working version published at NPM v0.4.1-alpha.1 for testing: Please share feedback!
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available: #177
Description of changes:
page.layout.{html(), str(), text}
from duplicating the content ofLAYOUT_TEXT
items also referenced as children ofLAYOUT_LIST
s: Since aPAGE
block's children includes all the layout items their interrelations.page.layout.{iterItems(), listItems()}
page.layout.nItems
in favour of.nItemsTotal
(the old behaviour counting everything) and.nItemsDirect
(counting only top-level layout items)iter/listRelatedItemsByRelType()
accessors for directly iterating related items, rather than user code always having to resolve block IDs to parsed items. These new methods have filtering & logging/error params which I hope we can standardise more across TRP.js in future releases (but not a patch release, as some breaking changes wrt handling of invalid Textract JSONs would likely be unavoidable - current behaviour is inconsistent between sub-modules)Testing:
New unit tests created to catch the bug behaviour and cover the new additions.
Working version published at NPM v0.4.1-alpha.1 for testing: Please share feedback!
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.