In case we are looking for a plain css value, cascading from the main ancestor styles of self, then follow the parent links until document or root, if self does not contain the requested value. >>> from pagebot.toolbox.units import em >>> from pagebot.document import
(self, name, default=None)
| 1512 | # until style value is defined. |
| 1513 | |
| 1514 | def css(self, name, default=None): |
| 1515 | """In case we are looking for a plain css value, cascading from the |
| 1516 | main ancestor styles of self, then follow the parent links until |
| 1517 | document or root, if self does not contain the requested value. |
| 1518 | |
| 1519 | >>> from pagebot.toolbox.units import em |
| 1520 | >>> from pagebot.document import Document |
| 1521 | >>> doc = Document() |
| 1522 | >>> page = doc[1] |
| 1523 | >>> e = Element(fontSize=pt(24), parent=page) |
| 1524 | >>> e.css('fontSize') # Find local style value |
| 1525 | 24pt |
| 1526 | >>> e.css('leading') # Find value in root style. Default is absolute unit. Can be changed to em. |
| 1527 | 1.4em |
| 1528 | >>> e = Element(fontSize=pt(24), leading=em(1.4)) |
| 1529 | >>> e.css('leading'), round(e.css('leading').pt) # Show unit and rendered compared to |
| 1530 | (1.4em, 17) |
| 1531 | """ |
| 1532 | if name in self.style and self.style[name] is not None: |
| 1533 | return self.style[name] |
| 1534 | if self.parent is not None: |
| 1535 | return self.parent.css(name, default) |
| 1536 | return default |
| 1537 | |
| 1538 | def checkStyleArgs(self, d): |
| 1539 | """Fix style values where necessary. |
no outgoing calls
no test coverage detected