当前位置: 首页>>代码示例>>Python>>正文


Python nodes.authors方法代码示例

本文整理汇总了Python中docutils.nodes.authors方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.authors方法的具体用法?Python nodes.authors怎么用?Python nodes.authors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在docutils.nodes的用法示例。


在下文中一共展示了nodes.authors方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: extract_authors

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def extract_authors(self, field, name, docinfo):
        try:
            if len(field[1]) == 1:
                if isinstance(field[1][0], nodes.paragraph):
                    authors = self.authors_from_one_paragraph(field)
                elif isinstance(field[1][0], nodes.bullet_list):
                    authors = self.authors_from_bullet_list(field)
                else:
                    raise TransformError
            else:
                authors = self.authors_from_paragraphs(field)
            authornodes = [nodes.author('', '', *author)
                           for author in authors if author]
            if len(authornodes) >= 1:
                docinfo.append(nodes.authors('', *authornodes))
            else:
                raise TransformError
        except TransformError:
            field[-1] += self.document.reporter.warning(
                  'Bibliographic field "%s" incompatible with extraction: '
                  'it must contain either a single paragraph (with authors '
                  'separated by one of "%s"), multiple paragraphs (one per '
                  'author), or a bullet list with one paragraph (one author) '
                  'per item.'
                  % (name, ''.join(self.language.author_separators)),
                  base_node=field)
            raise 
开发者ID:skarlekar,项目名称:faces,代码行数:29,代码来源:frontmatter.py

示例2: authors_from_one_paragraph

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def authors_from_one_paragraph(self, field):
        text = field[1][0].astext().strip()
        if not text:
            raise TransformError
        for authorsep in self.language.author_separators:
            authornames = text.split(authorsep)
            if len(authornames) > 1:
                break
        authornames = [author.strip() for author in authornames]
        authors = [[nodes.Text(author)] for author in authornames if author]
        return authors 
开发者ID:skarlekar,项目名称:faces,代码行数:13,代码来源:frontmatter.py

示例3: authors_from_bullet_list

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def authors_from_bullet_list(self, field):
        authors = []
        for item in field[1][0]:
            if len(item) != 1 or not isinstance(item[0], nodes.paragraph):
                raise TransformError
            authors.append(item[0].children)
        if not authors:
            raise TransformError
        return authors 
开发者ID:skarlekar,项目名称:faces,代码行数:11,代码来源:frontmatter.py

示例4: authors_from_paragraphs

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def authors_from_paragraphs(self, field):
        for item in field[1]:
            if not isinstance(item, nodes.paragraph):
                raise TransformError
        authors = [item.children for item in field[1]]
        return authors 
开发者ID:skarlekar,项目名称:faces,代码行数:8,代码来源:frontmatter.py

示例5: visit_author

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def visit_author(self, node):
        if isinstance(node.parent, nodes.authors):
            if self.author_in_authors:
                self.body.append('\n<br />')
        else:
            self.visit_docinfo_item(node, 'author') 
开发者ID:skarlekar,项目名称:faces,代码行数:8,代码来源:__init__.py

示例6: depart_author

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def depart_author(self, node):
        if isinstance(node.parent, nodes.authors):
            self.author_in_authors = True
        else:
            self.depart_docinfo_item() 
开发者ID:skarlekar,项目名称:faces,代码行数:7,代码来源:__init__.py

示例7: visit_authors

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def visit_authors(self, node):
        self.visit_docinfo_item(node, 'authors')
        self.author_in_authors = False  # initialize 
开发者ID:skarlekar,项目名称:faces,代码行数:5,代码来源:__init__.py

示例8: visit_author

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def visit_author(self, node):
        if isinstance(node.parent, nodes.authors):
            el = self.append_p('blockindent')
        else:
            el = self.generate_labeled_block(node, 'author')
        self.set_current_element(el) 
开发者ID:skarlekar,项目名称:faces,代码行数:8,代码来源:__init__.py

示例9: visit_authors

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def visit_authors(self, node):
        label = '%s:' % (self.language.labels['authors'], )
        el = self.append_p('textbody')
        el1 = SubElement(el, 'text:span',
            attrib={'text:style-name': self.rststyle('strong')})
        el1.text = label 
开发者ID:skarlekar,项目名称:faces,代码行数:8,代码来源:__init__.py

示例10: depart_author

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def depart_author(self, node):
        self.body.append('</p>')
        if isinstance(node.parent, nodes.authors):
            self.body.append('\n')
        else:
            self.depart_docinfo_item() 
开发者ID:skarlekar,项目名称:faces,代码行数:8,代码来源:_html_base.py

示例11: visit_authors

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import authors [as 别名]
def visit_authors(self, node):
        self.visit_docinfo_item(node, 'authors') 
开发者ID:skarlekar,项目名称:faces,代码行数:4,代码来源:_html_base.py


注:本文中的docutils.nodes.authors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。