Makes a copy of the top of the style graphics state and mew *style* into it. Answer the new style. This can be used to match custom tag names (such as ... to a style with the same name.
(self, tag)
| 531 | return {} |
| 532 | |
| 533 | def getNodeStyle(self, tag): |
| 534 | """Makes a copy of the top of the style graphics state and mew *style* |
| 535 | into it. Answer the new style. This can be used to match custom tag |
| 536 | names (such as <dropcap>...</dropcap> to a style with the same name. |
| 537 | """ |
| 538 | if self.peekStyle() is None: # Not an initialized stack, use doc.rootStyle as default. |
| 539 | # Happens if calling directly, without check on e or non-existing style for a node. |
| 540 | self.pushStyle(self.getRootStyle()) |
| 541 | mergedStyle = copy.copy(self.peekStyle()) |
| 542 | # Find the best matching style for tag on order of relevance, |
| 543 | # considering the possible HTML tag parents and the history. |
| 544 | for styleName in self.getMatchingStyleNames(tag): |
| 545 | nodeStyle = self.getNamedStyle(styleName) |
| 546 | if nodeStyle: # Not None and not empty |
| 547 | for name, value in nodeStyle.items(): |
| 548 | mergedStyle[name] = value |
| 549 | break |
| 550 | return mergedStyle |
| 551 | |
| 552 | def append(self, bs): |
| 553 | """Append the string (or BabelString instance) to the last textbox in |
no test coverage detected