MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / get_items

Method get_items

markdown/blockprocessors.py:305–323  ·  view source on GitHub ↗

Break a block into list items.

(self, block)

Source from the content-addressed store, hash-verified

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
326class UListProcessor(OListProcessor):

Callers 1

runMethod · 0.95

Calls 3

splitMethod · 0.45
matchMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected