Process blocks of Markdown text and attach to given `etree` node. Given a list of `blocks`, each `blockprocessor` is stepped through until there are no blocks left. While an extension could potentially call this method directly, it's generally expected to be used in
(self, parent: etree.Element, blocks: list[str])
| 136 | self.parseBlocks(parent, text.split('\n\n')) |
| 137 | |
| 138 | def parseBlocks(self, parent: etree.Element, blocks: list[str]) -> None: |
| 139 | """ Process blocks of Markdown text and attach to given `etree` node. |
| 140 | |
| 141 | Given a list of `blocks`, each `blockprocessor` is stepped through |
| 142 | until there are no blocks left. While an extension could potentially |
| 143 | call this method directly, it's generally expected to be used |
| 144 | internally. |
| 145 | |
| 146 | This is a public method as an extension may need to add/alter |
| 147 | additional `BlockProcessors` which call this method to recursively |
| 148 | parse a nested block. |
| 149 | |
| 150 | Arguments: |
| 151 | parent: The parent element. |
| 152 | blocks: The blocks of text to parse. |
| 153 | |
| 154 | """ |
| 155 | while blocks: |
| 156 | for processor in self.blockprocessors: |
| 157 | if processor.test(parent, blocks[0]): |
| 158 | if processor.run(parent, blocks) is not False: |
| 159 | # run returns True or None |
| 160 | break |
no test coverage detected