(self, parent, blocks)
| 127 | ) |
| 128 | |
| 129 | def run(self, parent, blocks): |
| 130 | block = blocks.pop(0) |
| 131 | level, sibling = self.get_level(parent, block) |
| 132 | block = self.looseDetab(block, level) |
| 133 | |
| 134 | self.parser.state.set('detabbed') |
| 135 | if parent.tag in self.ITEM_TYPES: |
| 136 | # The parent is already a li. Just parse the child block. |
| 137 | self.parser.parseBlocks(parent, [block]) |
| 138 | elif sibling.tag in self.ITEM_TYPES: |
| 139 | # The sibling is a li. Use it as parent. |
| 140 | self.parser.parseBlocks(sibling, [block]) |
| 141 | elif len(sibling) and sibling[-1].tag in self.ITEM_TYPES: |
| 142 | # The parent is a list (``ol`` or ``ul``) which has children. |
| 143 | # Assume the last child li is the parent of this block. |
| 144 | if sibling[-1].text: |
| 145 | # If the parent li has text, that text needs to be moved to a p |
| 146 | block = '%s\n\n%s' % (sibling[-1].text, block) |
| 147 | sibling[-1].text = '' |
| 148 | self.parser.parseChunk(sibling[-1], block) |
| 149 | else: |
| 150 | self.create_item(sibling, block) |
| 151 | self.parser.state.reset() |
| 152 | |
| 153 | def create_item(self, parent, block): |
| 154 | """ Create a new li and parse the block with it as the parent. """ |
nothing calls this directly
no test coverage detected