当前位置: 首页>>代码示例>>Python>>正文


Python nodes.entry方法代码示例

本文整理汇总了Python中docutils.nodes.entry方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.entry方法的具体用法?Python nodes.entry怎么用?Python nodes.entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在docutils.nodes的用法示例。


在下文中一共展示了nodes.entry方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: process

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def process(self, doctree):
        for node in doctree.traverse(cfgconfig):
            config = node.config
            context = node.context
            options = self.domain.config_options[config]

            if self.builder.config.cfg_options_summary is None:
                new_content = []
            elif len(options) == 0:
                new_content = [nodes.Text("[No options defined for this config]")]
            elif self.builder.config.cfg_options_summary == "table":
                new_content = self.create_summary_table(config, context, options)
            elif self.builder.config.cfg_options_summary == "list":
                new_content = [self.create_option_reference(o, config, context) for o in options]
                if len(new_content) > 1:
                    listnode = nodes.bullet_list()
                    for entry in new_content:
                        listnode += nodes.list_item('', entry)
                    new_content = [listnode]
            else:
                raise ValueError("unknown value for config option `cfg_options_summary`.")
            node.replace_self(new_content) 
开发者ID:tenpy,项目名称:tenpy,代码行数:24,代码来源:sphinx_cfg_options.py

示例2: build_table_row

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def build_table_row(self, rowdata, tableline):
        row = nodes.row()
        for cell in rowdata:
            if cell is None:
                continue
            morerows, morecols, offset, cellblock = cell
            attributes = {}
            if morerows:
                attributes['morerows'] = morerows
            if morecols:
                attributes['morecols'] = morecols
            entry = nodes.entry(**attributes)
            row += entry
            if ''.join(cellblock):
                self.nested_parse(cellblock, input_offset=tableline+offset,
                                  node=entry)
        return row 
开发者ID:skarlekar,项目名称:faces,代码行数:19,代码来源:states.py

示例3: prepare_table_header

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def prepare_table_header(titles, widths):
    """Build docutil empty table """
    ncols = len(titles)
    assert len(widths) == ncols

    tgroup = nodes.tgroup(cols=ncols)
    for width in widths:
        tgroup += nodes.colspec(colwidth=width)
    header = nodes.row()
    for title in titles:
        header += nodes.entry("", nodes.paragraph(text=title))
    tgroup += nodes.thead("", header)

    tbody = nodes.tbody()
    tgroup += tbody

    return nodes.table("", tgroup), tbody 
开发者ID:altair-viz,项目名称:altair,代码行数:19,代码来源:schematable.py

示例4: _create_row

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def _create_row(self, *column_texts):
        row = nodes.row('')
        source, line = self.state_machine.get_source_and_line()
        for text_line in column_texts:
            node = nodes.paragraph('')
            vl = ViewList()
            for text in text_line.split('\n'):
                vl.append(text, '%s:%d' % (source, line))
            with switch_source_input(self.state, vl):
                self.state.nested_parse(vl, 0, node)
                try:
                    if isinstance(node[0], nodes.paragraph) and len(node.children) == 1:
                        node = node[0]
                except IndexError:
                    pass
                row.append(nodes.entry('', node))
        return row 
开发者ID:gardener,项目名称:cc-utils,代码行数:19,代码来源:sphinxutil.py

示例5: models_table

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def models_table(self, species):
        table = nodes.table()
        tgroup = nodes.tgroup(cols=2)
        for _ in range(2):
            colspec = nodes.colspec(colwidth=1)
            tgroup.append(colspec)
        table += tgroup

        thead = nodes.thead()
        tgroup += thead
        row = nodes.row()
        entry = nodes.entry()
        entry += nodes.paragraph(text="ID")
        row += entry
        entry = nodes.entry()
        entry += nodes.paragraph(text="Description")
        row += entry

        thead.append(row)

        rows = []
        for model in species.demographic_models:
            row = nodes.row()
            rows.append(row)

            mid = self.get_demographic_model_id(species, model)
            entry = nodes.entry()
            para = nodes.paragraph()
            entry += para
            para += nodes.reference(internal=True, refid=mid, text=model.id)
            row += entry

            entry = nodes.entry()
            entry += nodes.paragraph(text=model.description)
            row += entry

        tbody = nodes.tbody()
        tbody.extend(rows)
        tgroup += tbody

        return table 
开发者ID:popsim-consortium,项目名称:stdpopsim,代码行数:43,代码来源:speciescatalog.py

示例6: create_summary_table

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def create_summary_table(self, config, context, options):
        default_column = self.builder.config.cfg_options_default_in_summary_table
        table_spec = addnodes.tabular_col_spec()
        table = nodes.table("", classes=["longtable"])
        if default_column:
            table_spec['spec'] = r'\X{1}{4}\X{1}{4}\X{2}{4}'
            group = nodes.tgroup('', cols=3)
            group.append(nodes.colspec('', colwidth=20))
            group.append(nodes.colspec('', colwidth=20))
            group.append(nodes.colspec('', colwidth=60))
        else:
            table_spec['spec'] = r'\X{1}{4}\X{2}{4}'
            group = nodes.tgroup('', cols=2)
            group.append(nodes.colspec('', colwidth=25))
            group.append(nodes.colspec('', colwidth=75))
        table.append(group)
        if self.builder.config.cfg_options_table_add_header:
            header = nodes.thead('')
            group.append(header)
            row = nodes.row()
            row += nodes.entry("", nodes.Text("option"))
            if default_column:
                row += nodes.entry("", nodes.Text("default"))
            row += nodes.entry("", nodes.Text("summary"))
            header.append(row)
        body = nodes.tbody('')
        group.append(body)
        for opt in options:
            body += self.create_option_reference_table_row(opt, config, context)
        return [table_spec, table] 
开发者ID:tenpy,项目名称:tenpy,代码行数:32,代码来源:sphinx_cfg_options.py

示例7: create_option_reference_table_row

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def create_option_reference_table_row(self, option, config, context):
        row = nodes.row("")
        par = self.create_option_reference(option, config, context)
        row += nodes.entry("", par)
        if self.builder.config.cfg_options_default_in_summary_table:
            par = nodes.paragraph()
            if option.default:
                par += nodes.literal(option.default, option.default)
            row += nodes.entry("", par)
        par = nodes.paragraph()
        par += nodes.Text(option.summary)
        if option.summarycropped:
            par += self.make_refnode(option.docname, option.anchor, nodes.Text(" [...]"))
        row += nodes.entry("", par)
        return row 
开发者ID:tenpy,项目名称:tenpy,代码行数:17,代码来源:sphinx_cfg_options.py

示例8: clear_doc

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def clear_doc(self, docname):
        self.data['config'] = [entry for entry in self.data['config'] if entry.docname != docname]
        for config_name, entries_list in self.data['config2options'].items():
            filered_entries = [entry for entry in entries_list if entry.docname != docname]
            self.data['config2options'][config_name] = filered_entries 
开发者ID:tenpy,项目名称:tenpy,代码行数:7,代码来源:sphinx_cfg_options.py

示例9: build_table_from_list

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def build_table_from_list(self, table_data, widths, col_widths, header_rows,
                              stub_columns):
        table = nodes.table()
        if widths:
            table['classes'] += ['colwidths-%s' % widths]
        tgroup = nodes.tgroup(cols=len(col_widths))
        table += tgroup
        for col_width in col_widths:
            colspec = nodes.colspec()
            if col_width is not None:
                colspec.attributes['colwidth'] = col_width
            if stub_columns:
                colspec.attributes['stub'] = 1
                stub_columns -= 1
            tgroup += colspec
        rows = []
        for row in table_data:
            row_node = nodes.row()
            for cell in row:
                entry = nodes.entry()
                entry += cell
                row_node += entry
            rows.append(row_node)
        if header_rows:
            thead = nodes.thead()
            thead.extend(rows[:header_rows])
            tgroup += thead
        tbody = nodes.tbody()
        tbody.extend(rows[header_rows:])
        tgroup += tbody
        return table 
开发者ID:skarlekar,项目名称:faces,代码行数:33,代码来源:tables.py

示例10: depart_paragraph

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def depart_paragraph(self, node):
        self.body.append('</p>')
        if not (isinstance(node.parent, (nodes.list_item, nodes.entry)) and
                (len(node.parent) == 1)):
            self.body.append('\n') 
开发者ID:skarlekar,项目名称:faces,代码行数:7,代码来源:_html_base.py

示例11: build_table_from_list

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def build_table_from_list(self, table_data, col_widths, header_rows, stub_columns):
        table = nodes.table()
        if self.widths == 'auto':
            table['classes'] += ['colwidths-auto']
        elif self.widths: # "grid" or list of integers
            table['classes'] += ['colwidths-given']
        tgroup = nodes.tgroup(cols=len(col_widths))
        table += tgroup
        for col_width in col_widths:
            colspec = nodes.colspec()
            if col_width is not None:
                colspec.attributes['colwidth'] = col_width
            if stub_columns:
                colspec.attributes['stub'] = 1
                stub_columns -= 1
            tgroup += colspec
        rows = []
        for row in table_data:
            row_node = nodes.row()
            for cell in row:
                entry = nodes.entry()
                entry += cell
                row_node += entry
            rows.append(row_node)
        if header_rows:
            thead = nodes.thead()
            thead.extend(rows[:header_rows])
            tgroup += thead
        tbody = nodes.tbody()
        tbody.extend(rows[header_rows:])
        tgroup += tbody
        return table 
开发者ID:QData,项目名称:deepWordBug,代码行数:34,代码来源:tables.py

示例12: build_row

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import entry [as 别名]
def build_row(item):
    """Return nodes.row with property description"""

    prop, propschema, required = item
    row = nodes.row()

    # Property

    row += nodes.entry("", nodes.paragraph(text=prop), classes=["vl-prop"])

    # Type
    str_type = type_description(propschema)
    par_type = nodes.paragraph()

    is_text = True
    for part in reClassDef.split(str_type):
        if part:
            if is_text:
                add_text(par_type, part)
            else:
                add_class_def(par_type, part)
        is_text = not is_text

    # row += nodes.entry('')
    row += nodes.entry("", par_type)  # , classes=["vl-type-def"]

    # Description
    md_parser = CommonMarkParser()
    # str_descr = "***Required.*** " if required else ""
    str_descr = ""
    str_descr += propschema.get("description", " ")
    doc_descr = utils.new_document("schema_description")
    md_parser.parse(str_descr, doc_descr)

    # row += nodes.entry('', *doc_descr.children, classes="vl-decsr")
    row += nodes.entry("", *doc_descr.children, classes=["vl-decsr"])

    return row 
开发者ID:altair-viz,项目名称:altair,代码行数:40,代码来源:schematable.py


注:本文中的docutils.nodes.entry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。