How to use the docutils.nodes.entry function in docutils

To help you get started, we’ve selected a few docutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / os-api-ref / os_api_ref / __init__.py View on Github external
def add_col(self, value):
        entry = nodes.entry()
        result = ViewList(value.split('\n'))
        self.state.nested_parse(result, 0, entry)
        return entry
github pinax / pinax / site-packages / docutils-0.4 / docutils / parsers / rst / directives / tables.py View on Github external
def build_table_from_list(table_data, col_widths, header_rows, stub_columns):
    table = nodes.table()
    tgroup = nodes.tgroup(cols=len(col_widths))
    table += tgroup
    for col_width in col_widths:
        colspec = nodes.colspec(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
github openstack / senlin / api-ref / ext / rest_parameters.py View on Github external
def get_rows(self, table_data):
        rows = []
        groups = []
        trow = nodes.row()
        entry = nodes.entry()
        para = nodes.paragraph(text=unicode(table_data))
        entry += para
        trow += entry
        rows.append(trow)
        return rows, groups
github openstack / designate / doc / ext / support_matrix.py View on Github external
blank.append(nodes.strong(text="Backend"))
        header.append(blank)

        blank = nodes.entry()
        blank.append(nodes.strong(text="Status"))
        header.append(blank)

        blank = nodes.entry()
        blank.append(nodes.strong(text="Type"))
        header.append(blank)

        blank = nodes.entry()
        blank.append(nodes.strong(text="In Tree"))
        header.append(blank)

        blank = nodes.entry()
        blank.append(nodes.strong(text="Notes"))
        header.append(blank)

        summaryhead.append(header)

        grades = matrix.grades
        impls = list(six.iterkeys(matrix.backends))
        impls.sort()
        for grade in grades:
            for backend in impls:
                if matrix.backends[backend].status == grade.key:
                    item = nodes.row()
                    namecol = nodes.entry()
                    namecol.append(
                        nodes.paragraph(text=matrix.backends[backend].title))
                    item.append(namecol)
github reviewboard / reviewboard / docs / manual / _ext / webapidocs.py View on Github external
def append_row(tbody, cells):
    row = nodes.row()
    tbody += row

    for cell in cells:
        entry = nodes.entry()
        row += entry

        if isinstance(cell, basestring):
            node = nodes.paragraph(text=cell)
        else:
            node = cell

        entry += node
github Jenyay / outwiker / plugins / diagrammer / diagrammer / libs / blockdiag / utils / rst / directives.py View on Github external
# generate table-header
        thead = nodes.thead()
        row = nodes.row()
        for header in headers:
            entry = nodes.entry()
            entry += nodes.paragraph(text=header)
            row += entry
        thead += row
        tgroup += thead

        # generate table-body
        tbody = nodes.tbody()
        for desc in descriptions:
            row = nodes.row()
            for attr in desc:
                entry = nodes.entry()
                if not isinstance(attr, string_types):
                    attr = str(attr)
                self.state.nested_parse(ViewList([attr], source=attr),
                                        0, entry)
                row += entry
            tbody += row
        tgroup += tbody

        return table
github openstack / nova / doc / ext / support_matrix.py View on Github external
summarygroup = nodes.tgroup(cols=cols)
        summarybody = nodes.tbody()
        summaryhead = nodes.thead()

        for i in range(cols):
            summarygroup.append(nodes.colspec(colwidth=1))
        summarygroup.append(summaryhead)
        summarygroup.append(summarybody)
        summary.append(summarygroup)
        content.append(summarytitle)
        content.append(summary)

        # This sets up all the column headers - two fixed
        # columns for feature name & status
        header = nodes.row()
        blank = nodes.entry()
        blank.append(nodes.emphasis(text="Feature"))
        header.append(blank)
        blank = nodes.entry()
        blank.append(nodes.emphasis(text="Status"))
        header.append(blank)
        summaryhead.append(header)

        # then one column for each hypervisor driver
        impls = list(matrix.targets.keys())
        impls.sort()
        for key in impls:
            target = matrix.targets[key]
            implcol = nodes.entry()
            header.append(implcol)
            implcol.append(nodes.strong(text=target.title))
github Khan / internal-webserver / reviewboard_src / docs / manual / _ext / webapidocs.py View on Github external
def append_row(tbody, cells):
    row = nodes.row()
    tbody += row

    for cell in cells:
        entry = nodes.entry()
        row += entry

        if isinstance(cell, basestring):
            node = nodes.paragraph(text=cell)
        else:
            node = cell

        entry += node
github pygame / pygame / docs / reST / ext / boilerplate.py View on Github external
def build_toc(descinfo, env):
    """Return a desc table of contents node tree"""

    separator = EMDASH
    child_ids = descinfo['children']
    if not child_ids:
        return None
    max_fullname_len = 0
    max_summary_len = 0
    rows = []
    for fullname, refid, summary in ichild_ids(child_ids, env):
        max_fullname_len = max(max_fullname_len, len(fullname))
        max_summary_len = max(max_summary_len, len(summary))
        reference_node = toc_ref(fullname, refid)
        ref_entry_node = entry('', paragraph('', '', reference_node))
        sep_entry_node = entry('', paragraph('', separator))
        sum_entry_node = entry('', paragraph('', summary))
        row_node = row('', ref_entry_node, sep_entry_node, sum_entry_node)
        rows.append(row_node)
    col0_len = max_fullname_len + 2   # add error margin
    col1_len = len(separator)         # no padding
    col2_len = max_summary_len + 10   # add error margin
    tbody_node = tbody('', *rows)
    col0_colspec_node = colspec(colwidth=col0_len)
    col1_colspec_node = colspec(colwidth=col1_len)
    col2_colspec_node = colspec(colwidth=col2_len)
    tgroup_node = tgroup('',
                         col0_colspec_node,
                         col1_colspec_node,
                         col2_colspec_node,
                         tbody_node,
                         cols=3)
github lsils / mockturtle / docs / conf.py View on Github external
# header
        colname = self.options.get('column', "Function")
        tgroup += nodes.thead('', nodes.row('', *[nodes.entry('', nodes.line(text = c)) for c in [colname, "Description"]]))

        # rows
        tbody = nodes.tbody()
        for target in self.content:
            for elem in doc.findall("./compounddef/sectiondef/memberdef/[name='%s']" % target):
                ref = nodes.reference('', target, internal = True)
                ref['refuri'] = '#{}'.format( elem.attrib["id"] )

                reft = nodes.paragraph()
                reft.extend([ref])

                func = nodes.entry('', reft)
                desc = nodes.entry('', nodes.line(text = elem.findtext("./briefdescription/para")))

                tbody += nodes.row('', func, desc)

        tgroup += tbody
        table += tgroup
        return [table]