Break a block into list items.
(self, block)
| 303 | self.parser.state.reset() |
| 304 | |
| 305 | def get_items(self, block): |
| 306 | """ Break a block into list items. """ |
| 307 | items = [] |
| 308 | for line in block.split('\n'): |
| 309 | m = self.CHILD_RE.match(line) |
| 310 | if m: |
| 311 | # This is a new item. Append |
| 312 | items.append(m.group(3)) |
| 313 | elif self.INDENT_RE.match(line): |
| 314 | # This is an indented (possibly nested) item. |
| 315 | if items[-1].startswith(' '*markdown.TAB_LENGTH): |
| 316 | # Previous item was indented. Append to that item. |
| 317 | items[-1] = '%s\n%s' % (items[-1], line) |
| 318 | else: |
| 319 | items.append(line) |
| 320 | else: |
| 321 | # This is another line of previous item. Append to that item. |
| 322 | items[-1] = '%s\n%s' % (items[-1], line) |
| 323 | return items |
| 324 | |
| 325 | |
| 326 | class UListProcessor(OListProcessor): |