-
-
Notifications
You must be signed in to change notification settings - Fork 712
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
Find a way to easily reach the internal values of the rendered tree #434
Comments
There's no "official" and reliable way to get the boxes and their attributes. But with the current version, you can try to get what you want:
AFAIK, there's currently no easy way to automatically get what you want (for example, get the blocks corresponding to your tags using their id), but it may be possible to override some classes and functions if you really need it. |
This is the same conclusion I've come too. |
Cool! |
Unless the Box is a PageBox or a MarginBox the new attribute `element` points to the html element (xml.etree.ElementTree.Element) where the Box stems from. This enables e.g. post-processing that depends on Element attributes, like 'class' or 'id'. Caution: Elements with no subelements will test as False! Test the element's existence with `if box.element is not None:`. Related to Kozea#434, Kozea#970.
I think that 4365b19 gives a nice way to enable post-processing operations. Feel free to reopen if needed! |
I'm not sure if this is a bug or intended behavior but the height of a box is 'auto' after rendering unlike the width of the box which appears to be being calculated based on the content.
How can I get the calculated height of the element id=header from the rendered document, i.e.
doc = HTML(string=html_below).render(stylesheet=[CSS(css_below)])?
It seems like the width of the elements is calculated but the height remains set to 'auto'.
I'd like to resolve this to a unit so unfixed elements (not shown) can be positions relative to the dynamic height.
HTML
CSS
The text was updated successfully, but these errors were encountered: