當前位置: 首頁>>代碼示例>>Python>>正文


Python nodes.admonition方法代碼示例

本文整理匯總了Python中docutils.nodes.admonition方法的典型用法代碼示例。如果您正苦於以下問題:Python nodes.admonition方法的具體用法?Python nodes.admonition怎麽用?Python nodes.admonition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在docutils.nodes的用法示例。


在下文中一共展示了nodes.admonition方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import admonition [as 別名]
def run(self):
        set_classes(self.options)
        self.assert_has_content()
        text = '\n'.join(self.content)
        admonition_node = self.node_class(text, **self.options)
        self.add_name(admonition_node)
        if self.node_class is nodes.admonition:
            title_text = self.arguments[0]
            textnodes, messages = self.state.inline_text(title_text,
                                                         self.lineno)
            title = nodes.title(title_text, '', *textnodes)
            title.source, title.line = (
                    self.state_machine.get_source_and_line(self.lineno))
            admonition_node += title
            admonition_node += messages
            if not 'classes' in self.options:
                admonition_node['classes'] += ['admonition-' +
                                               nodes.make_id(title_text)]
        self.state.nested_parse(self.content, self.content_offset,
                                admonition_node)
        return [admonition_node] 
開發者ID:skarlekar,項目名稱:faces,代碼行數:23,代碼來源:admonitions.py

示例2: visit_admonition

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import admonition [as 別名]
def visit_admonition(self, node, name=None):
        #
        # Make admonitions a simple block quote
        # with a strong heading
        #
        # Using .IP/.RE doesn't preserve indentation
        # when admonitions contain bullets, literal,
        # and/or block quotes.
        #
        if name:
            # .. admonition:: has no name
            self.body.append('.sp\n')
            name = '%s%s:%s\n' % (
                self.defs['strong'][0],
                self.language.labels.get(name, name).upper(),
                self.defs['strong'][1],
                )        
            self.body.append(name)
        self.visit_block_quote(node) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:21,代碼來源:manpage.py

示例3: visit_title

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import admonition [as 別名]
def visit_title(self, node):
        if isinstance(node.parent, nodes.topic):
            self.body.append(self.defs['topic-title'][0])
        elif isinstance(node.parent, nodes.sidebar):
            self.body.append(self.defs['sidebar-title'][0])
        elif isinstance(node.parent, nodes.admonition):
            self.body.append('.IP "')
        elif self.section_level == 0:
            self._docinfo['title'] = node.astext()
            # document title for .TH
            self._docinfo['title_upper'] = node.astext().upper()
            raise nodes.SkipNode
        elif self.section_level == 1:
            self.body.append('.SH %s\n' % self.deunicode(node.astext().upper()))
            raise nodes.SkipNode
        else:
            self.body.append('.SS ') 
開發者ID:skarlekar,項目名稱:faces,代碼行數:19,代碼來源:manpage.py

示例4: visit_admonition

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import admonition [as 別名]
def visit_admonition(self, node, name=None):
        #
        # Make admonitions a simple block quote
        # with a strong heading
        #
        # Using .IP/.RE doesn't preserve indentation
        # when admonitions contain bullets, literal,
        # and/or block quotes.
        #
        if name:
            # .. admonition:: has no name
            self.body.append('.sp\n')
            name = '%s%s:%s\n' % (
                self.defs['strong'][0],
                self.language.labels.get(name, name).upper(),
                self.defs['strong'][1],
                )
            self.body.append(name)
        self.visit_block_quote(node) 
開發者ID:QData,項目名稱:deepWordBug,代碼行數:21,代碼來源:manpage.py

示例5: apply

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import admonition [as 別名]
def apply(self):
        language = languages.get_language(self.document.settings.language_code,
                                          self.document.reporter)
        for node in self.document.traverse(nodes.Admonition):
            node_name = node.__class__.__name__
            # Set class, so that we know what node this admonition came from.
            node['classes'].append(node_name)
            if not isinstance(node, nodes.admonition):
                # Specific admonition.  Transform into a generic admonition.
                admonition = nodes.admonition(node.rawsource, *node.children,
                                              **node.attributes)
                title = nodes.title('', language.labels[node_name])
                admonition.insert(0, title)
                node.replace_self(admonition) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:16,代碼來源:writer_aux.py

示例6: depart_title

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import admonition [as 別名]
def depart_title(self, node):
        if isinstance(node.parent, nodes.admonition):
            self.body.append('"')
        self.body.append('\n') 
開發者ID:skarlekar,項目名稱:faces,代碼行數:6,代碼來源:manpage.py


注:本文中的docutils.nodes.admonition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。