當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。