def visit_list_item(self, node):
"""
:param docutils.nodes.list_item node:
"""
# 0: name
# 1: ' -- '
# 2: description
content = node[0] # paragraph node
# normalize the header name so that words are upper-cased
normalized = ' '.join('-'.join(elm.title() for elm in word.split('-'))
for word in content[0].astext().split())
if len(content) > 2:
first_para = content[2].astext()
words = first_para.split()
words[0] = words[0].title()
paragraphs = [' '.join(words)]
paragraphs.extend(t.astext().replace('\n', ' ').strip()
for t in content[3:])
description = ' '.join(paragraphs)
else:
description = ''
self.headers[normalized] = description
评论列表
文章目录