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


Python roles._roles方法代码示例

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


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

示例1: run

# 需要导入模块: from docutils.parsers.rst import roles [as 别名]
# 或者: from docutils.parsers.rst.roles import _roles [as 别名]
def run(self):
        if not self.arguments:
            if '' in roles._roles:
                # restore the "default" default role
                del roles._roles['']
            return []
        role_name = self.arguments[0]
        role, messages = roles.role(role_name, self.state_machine.language,
                                    self.lineno, self.state.reporter)
        if role is None:
            error = self.state.reporter.error(
                'Unknown interpreted text role "%s".' % role_name,
                nodes.literal_block(self.block_text, self.block_text),
                line=self.lineno)
            return messages + [error]
        roles._roles[''] = role
        # @@@ should this be local to the document, not the parser?
        return messages 
开发者ID:skarlekar,项目名称:faces,代码行数:20,代码来源:misc.py

示例2: run

# 需要导入模块: from docutils.parsers.rst import roles [as 别名]
# 或者: from docutils.parsers.rst.roles import _roles [as 别名]
def run(self):
        if not self.arguments:
            if '' in roles._roles:
                # restore the "default" default role
                del roles._roles['']
            return []
        role_name = self.arguments[0]
        role, messages = roles.role(role_name, self.state_machine.language,
                                    self.lineno, self.state.reporter)
        if role is None:
            error = self.state.reporter.error(
                'Unknown interpreted text role "%s".' % role_name,
                nodes.literal_block(self.block_text, self.block_text),
                line=self.lineno)
            return messages + [error]
        roles._roles[''] = role
        return messages 
开发者ID:aws-samples,项目名称:aws-builders-fair-projects,代码行数:19,代码来源:misc.py

示例3: setUp

# 需要导入模块: from docutils.parsers.rst import roles [as 别名]
# 或者: from docutils.parsers.rst.roles import _roles [as 别名]
def setUp(self):
        # Avoid "WARNING: while setting up extension
        # sphinxcontrib.programoutput: directive u'program-output' is
        # already registered, it will be overridden".
        # This may only be needed for Sphinx 1.
        self.directives = directives._directives.copy()
        # Likewise for 'eq'
        self.roles = roles._roles.copy()

        # Avoid "node class 'toctree' is already registered, its visitors will be overridden"
        # By default this class has *no* `visit_` methods
        for node in self.duplicate_nodes_to_remove:
            if hasattr(nodes.GenericNodeVisitor, 'visit_' + node):
                delattr(nodes.GenericNodeVisitor, 'visit_' + node) 
开发者ID:NextThought,项目名称:sphinxcontrib-programoutput,代码行数:16,代码来源:__init__.py

示例4: tearDown

# 需要导入模块: from docutils.parsers.rst import roles [as 别名]
# 或者: from docutils.parsers.rst.roles import _roles [as 别名]
def tearDown(self):
        directives._directives = self.directives
        roles._roles = self.roles 
开发者ID:NextThought,项目名称:sphinxcontrib-programoutput,代码行数:5,代码来源:__init__.py


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