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


Python nodes.line_block方法代碼示例

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


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

示例1: run

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import line_block [as 別名]
def run(self):
        self.assert_has_content()
        block = nodes.line_block(classes=self.options.get('class', []))
        self.add_name(block)
        node_list = [block]
        for line_text in self.content:
            text_nodes, messages = self.state.inline_text(
                line_text.strip(), self.lineno + self.content_offset)
            line = nodes.line(line_text, '', *text_nodes)
            if line_text.strip():
                line.indent = len(line_text) - len(line_text.lstrip())
            block += line
            node_list.extend(messages)
            self.content_offset += 1
        self.state.nest_line_block_lines(block)
        return node_list 
開發者ID:skarlekar,項目名稱:faces,代碼行數:18,代碼來源:body.py

示例2: line_block

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import line_block [as 別名]
def line_block(self, match, context, next_state):
        """First line of a line block."""
        block = nodes.line_block()
        self.parent += block
        lineno = self.state_machine.abs_line_number()
        line, messages, blank_finish = self.line_block_line(match, lineno)
        block += line
        self.parent += messages
        if not blank_finish:
            offset = self.state_machine.line_offset + 1   # next line
            new_line_offset, blank_finish = self.nested_list_parse(
                  self.state_machine.input_lines[offset:],
                  input_offset=self.state_machine.abs_line_offset() + 1,
                  node=block, initial_state='LineBlock',
                  blank_finish=0)
            self.goto_line(new_line_offset)
        if not blank_finish:
            self.parent += self.reporter.warning(
                'Line block ends without a blank line.',
                line=lineno+1)
        if len(block):
            if block[0].indent is None:
                block[0].indent = 0
            self.nest_line_block_lines(block)
        return [], next_state, [] 
開發者ID:skarlekar,項目名稱:faces,代碼行數:27,代碼來源:states.py

示例3: nest_line_block_segment

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import line_block [as 別名]
def nest_line_block_segment(self, block):
        indents = [item.indent for item in block]
        least = min(indents)
        new_items = []
        new_block = nodes.line_block()
        for item in block:
            if item.indent > least:
                new_block.append(item)
            else:
                if len(new_block):
                    self.nest_line_block_segment(new_block)
                    new_items.append(new_block)
                    new_block = nodes.line_block()
                new_items.append(item)
        if len(new_block):
            self.nest_line_block_segment(new_block)
            new_items.append(new_block)
        block[:] = new_items 
開發者ID:skarlekar,項目名稱:faces,代碼行數:20,代碼來源:states.py

示例4: get_section

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import line_block [as 別名]
def get_section(self, section):
        try:
            lines = self.layout['layout'][section]
        except KeyError:
            # Return nothing, if not specific configuration is given for layout section
            return []

        # Needed for PDF/Latex output, where empty line_blocks raise exceptions during build
        if len(lines) == 0:
            return []

        lines_container = nodes.line_block(classes=['needs_{}'.format(section)])

        for line in lines:
            # line_block_node = nodes.line_block()
            line_node = nodes.line()

            line_parsed = self._parse(line)
            line_ready = self._func_replace(line_parsed)
            line_node += line_ready
            lines_container.append(line_node)

        return lines_container 
開發者ID:useblocks,項目名稱:sphinxcontrib-needs,代碼行數:25,代碼來源:layout.py


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