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


Python nodes.block_quote方法代碼示例

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


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

示例1: block_quote

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import block_quote [as 別名]
def block_quote(self, indented, line_offset):
        elements = []
        while indented:
            (blockquote_lines,
             attribution_lines,
             attribution_offset,
             indented,
             new_line_offset) = self.split_attribution(indented, line_offset)
            blockquote = nodes.block_quote()
            self.nested_parse(blockquote_lines, line_offset, blockquote)
            elements.append(blockquote)
            if attribution_lines:
                attribution, messages = self.parse_attribution(
                    attribution_lines, attribution_offset)
                blockquote += attribution
                elements += messages
            line_offset = new_line_offset
            while indented and not indented[0]:
                indented = indented[1:]
                line_offset += 1
        return elements

    # U+2014 is an em-dash: 
開發者ID:skarlekar,項目名稱:faces,代碼行數:25,代碼來源:states.py

示例2: option_marker

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import block_quote [as 別名]
def option_marker(self, match, context, next_state):
        """Option list item."""
        optionlist = nodes.option_list()
        (optionlist.source, optionlist.line) = self.state_machine.get_source_and_line()
        try:
            listitem, blank_finish = self.option_list_item(match)
        except MarkupError, error:
            # This shouldn't happen; pattern won't match.
            msg = self.reporter.error(u'Invalid option list marker: %s' %
                                      error)
            self.parent += msg
            indented, indent, line_offset, blank_finish = \
                  self.state_machine.get_first_known_indented(match.end())
            elements = self.block_quote(indented, line_offset)
            self.parent += elements
            if not blank_finish:
                self.parent += self.unindent_warning('Option list')
            return [], next_state, [] 
開發者ID:skarlekar,項目名稱:faces,代碼行數:20,代碼來源:states.py

示例3: run

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import block_quote [as 別名]
def run(self):
        self.assert_has_content()
        elements = self.state.block_quote(self.content, self.content_offset)
        for element in elements:
            if isinstance(element, nodes.block_quote):
                element['classes'] += self.classes
        return elements 
開發者ID:skarlekar,項目名稱:faces,代碼行數:9,代碼來源:body.py

示例4: indent

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import block_quote [as 別名]
def indent(self, match, context, next_state):
        """Block quote."""
        indented, indent, line_offset, blank_finish = \
              self.state_machine.get_indented()
        elements = self.block_quote(indented, line_offset)
        self.parent += elements
        if not blank_finish:
            self.parent += self.unindent_warning('Block quote')
        return context, next_state, [] 
開發者ID:skarlekar,項目名稱:faces,代碼行數:11,代碼來源:states.py

示例5: option_marker

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import block_quote [as 別名]
def option_marker(self, match, context, next_state):
        """Option list item."""
        optionlist = nodes.option_list()
        (optionlist.source, optionlist.line) = self.state_machine.get_source_and_line()
        try:
            listitem, blank_finish = self.option_list_item(match)
        except MarkupError as error:
            # This shouldn't happen; pattern won't match.
            msg = self.reporter.error('Invalid option list marker: %s' %
                                      error)
            self.parent += msg
            indented, indent, line_offset, blank_finish = \
                  self.state_machine.get_first_known_indented(match.end())
            elements = self.block_quote(indented, line_offset)
            self.parent += elements
            if not blank_finish:
                self.parent += self.unindent_warning('Option list')
            return [], next_state, []
        self.parent += optionlist
        optionlist += listitem
        offset = self.state_machine.line_offset + 1   # next line
        newline_offset, blank_finish = self.nested_list_parse(
              self.state_machine.input_lines[offset:],
              input_offset=self.state_machine.abs_line_offset() + 1,
              node=optionlist, initial_state='OptionList',
              blank_finish=blank_finish)
        self.goto_line(newline_offset)
        if not blank_finish:
            self.parent += self.unindent_warning('Option list')
        return [], next_state, [] 
開發者ID:skarlekar,項目名稱:faces,代碼行數:32,代碼來源:states.py

示例6: apply

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import block_quote [as 別名]
def apply(self):
        bqs = list(self.document.traverse(d_nodes.block_quote))
        if bqs:
            raise shared.EdgeSphinxExtensionError(
                f'blockquote found: {bqs[0].asdom().toxml()!r}')

        trs = list(self.document.traverse(d_nodes.title_reference))
        if trs:
            raise shared.EdgeSphinxExtensionError(
                f'title reference (single backticks quote) found: '
                f'{trs[0].asdom().toxml()!r}; perhaps you wanted to use '
                f'double backticks?') 
開發者ID:edgedb,項目名稱:edgedb,代碼行數:14,代碼來源:__init__.py


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