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


Python nodes.subtitle方法代碼示例

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


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

示例1: run

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import subtitle [as 別名]
def run(self):
        if not (self.state_machine.match_titles
                or isinstance(self.state_machine.node, nodes.sidebar)):
            raise self.error('The "%s" directive may not be used within '
                             'topics or body elements.' % self.name)
        self.assert_has_content()
        title_text = self.arguments[0]
        textnodes, messages = self.state.inline_text(title_text, self.lineno)
        titles = [nodes.title(title_text, '', *textnodes)]
        # Sidebar uses this code.
        if 'subtitle' in self.options:
            textnodes, more_messages = self.state.inline_text(
                self.options['subtitle'], self.lineno)
            titles.append(nodes.subtitle(self.options['subtitle'], '',
                                         *textnodes))
            messages.extend(more_messages)
        text = '\n'.join(self.content)
        node = self.node_class(text, *(titles + messages))
        node['classes'] += self.options.get('class', [])
        self.add_name(node)
        if text:
            self.state.nested_parse(self.content, self.content_offset, node)
        return [node] 
開發者ID:skarlekar,項目名稱:faces,代碼行數:25,代碼來源:body.py

示例2: _build_backend_detail

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import subtitle [as 別名]
def _build_backend_detail(self, matrix, content):

        detailstitle = nodes.subtitle(text="Backend Details")
        content.append(detailstitle)
        content.append(nodes.paragraph())

        for key in six.iterkeys(matrix.backends):
            content.append(
                nodes.subtitle(text=matrix.backends[key].title))
            content.append(
                self._build_backend_detail_table(
                    matrix.backends[key],
                    matrix))

            content.append(nodes.paragraph())

        return content 
開發者ID:openstack,項目名稱:designate,代碼行數:19,代碼來源:support_matrix.py

示例3: apply

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import subtitle [as 別名]
def apply(self):
        if getattr(self.document.settings, 'doctitle_xform', 1):
            # promote_(sub)title defined in TitlePromoter base class.
            if self.promote_title(self.document):
                # If a title has been promoted, also try to promote a
                # subtitle.
                self.promote_subtitle(self.document)
        # Set document['title'].
        self.set_metadata() 
開發者ID:skarlekar,項目名稱:faces,代碼行數:11,代碼來源:frontmatter.py

示例4: depart_subtitle

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import subtitle [as 別名]
def depart_subtitle(self, node):
        self.body.append('</p>\n')
        if self.in_document_title:
            self.subtitle = self.body[self.in_document_title:-1]
            self.in_document_title = 0
            self.body_pre_docinfo.extend(self.body)
            self.html_subtitle.extend(self.body)
            del self.body[:] 
開發者ID:skarlekar,項目名稱:faces,代碼行數:10,代碼來源:_html_base.py

示例5: visit_title

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import subtitle [as 別名]
def visit_title(self, node):
        """Only 6 section levels are supported by HTML."""
        check_id = 0  # TODO: is this a bool (False) or a counter?
        close_tag = '</p>\n'
        if isinstance(node.parent, nodes.topic):
            self.body.append(
                  self.starttag(node, 'p', '', CLASS='topic-title first'))
        elif isinstance(node.parent, nodes.sidebar):
            self.body.append(
                  self.starttag(node, 'p', '', CLASS='sidebar-title'))
        elif isinstance(node.parent, nodes.Admonition):
            self.body.append(
                  self.starttag(node, 'p', '', CLASS='admonition-title'))
        elif isinstance(node.parent, nodes.table):
            self.body.append(
                  self.starttag(node, 'caption', ''))
            close_tag = '</caption>\n'
        elif isinstance(node.parent, nodes.document):
            self.body.append(self.starttag(node, 'h1', '', CLASS='title'))
            close_tag = '</h1>\n'
            self.in_document_title = len(self.body)
        else:
            assert isinstance(node.parent, nodes.section)
            h_level = self.section_level + self.initial_header_level - 1
            atts = {}
            if (len(node.parent) >= 2 and
                isinstance(node.parent[1], nodes.subtitle)):
                atts['CLASS'] = 'with-subtitle'
            self.body.append(
                  self.starttag(node, 'h%s' % h_level, '', **atts))
            atts = {}
            if node.hasattr('refid'):
                atts['class'] = 'toc-backref'
                atts['href'] = '#' + node['refid']
            if atts:
                self.body.append(self.starttag({}, 'a', '', **atts))
                close_tag = '</a></h%s>\n' % (h_level)
            else:
                close_tag = '</h%s>\n' % (h_level)
        self.context.append(close_tag) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:42,代碼來源:_html_base.py

示例6: visit_subtitle

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import subtitle [as 別名]
def visit_subtitle(self, node):
        if isinstance(node.parent, nodes.sidebar):
            classes = 'sidebar-subtitle'
        elif isinstance(node.parent, nodes.document):
            classes = 'subtitle'
            self.in_document_title = len(self.body)
        elif isinstance(node.parent, nodes.section):
            classes = 'section-subtitle'
        self.body.append(self.starttag(node, 'p', '', CLASS=classes)) 
開發者ID:MattTunny,項目名稱:AWS-Transit-Gateway-Demo-MultiAccount,代碼行數:11,代碼來源:_html_base.py


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