writer.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:sphinx-swagger 作者: dave-shawley 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号