Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def end_list_para(self):
if self.at_para_start:
self.rval.append([])
if self.list_stack:
tag = self.list_stack[-1][0]
if tag == 'ul':
depth = len([t for t in self.list_stack if t[0] == tag])
ul_tags = HTMLChunker.ul_tags
chunk = Chunk('%s ' % (ul_tags[depth % len(ul_tags)]),
self.cur_url())
else:
counter = self.list_stack[-1][1]
self.list_stack[-1] = (tag, counter + 1)
chunk = Chunk("%2d." % counter, self.cur_url())
self.add_chunk(chunk)
else:
self.end_para()