Lines Matching +full:child +full:- +full:nodes
2 # -*- coding: utf-8; mode: python -*-
6 flat-table
9 Implementation of the ``flat-table`` reST-directive.
14 The ``flat-table`` (:py:class:`FlatTable`) is a double-stage list similar to
15 the ``list-table`` with some additional features:
17 * *column-span*: with the role ``cspan`` a cell can be extended through
20 * *row-span*: with the role ``rspan`` a cell can be extended through
24 right side of that table-row. With Option ``:fill-cells:`` this behavior
30 * header-rows: [int] count of header rows
31 * stub-columns: [int] count of stub columns
33 * fill-cells: instead of autospann missing cells, insert missing cells
45 from docutils import nodes
60 app.add_directive("flat-table", FlatTable)
94 class rowSpan(nodes.General, nodes.Element): pass # pylint: disable=C0103,C0321
95 class colSpan(nodes.General, nodes.Element): pass # pylint: disable=C0103,C0321
102 u"""FlatTable (``flat-table``) directive"""
107 , 'header-rows': directives.nonnegative_int
108 , 'stub-columns': directives.nonnegative_int
110 , 'fill-cells' : directives.flag }
117 nodes.literal_block(self.block_text, self.block_text),
122 node = nodes.Element() # anonymous container for parsing
128 # SDK.CONSOLE() # print --> tableNode.asdom().toprettyxml()
138 u"""Builds a table from a double-stage list"""
153 stub_columns = self.directive.options.get('stub-columns', 0)
154 header_rows = self.directive.options.get('header-rows', 0)
156 table = nodes.table()
157 tgroup = nodes.tgroup(cols=len(colwidths))
162 colspec = nodes.colspec(colwidth=colwidth)
164 # absence of rowspan (observed by the html builder, the docutils-xml
166 # no table directive (except *this* flat-table) which allows to
167 # define coexistent of rowspan and stubs (there was no use-case
168 # before flat-table). This should be reviewed (later).
171 stub_columns -= 1
173 stub_columns = self.directive.options.get('stub-columns', 0)
176 thead = nodes.thead()
181 tbody = nodes.tbody()
190 row = nodes.row()
201 entry = nodes.entry(**attributes)
209 , nodes.literal_block(self.directive.block_text
217 if len(node) != 1 or not isinstance(node[0], nodes.bullet_list):
237 * Autospan or fill (option ``fill-cells``) missing cells on the right
238 side of the table-row
270 # re-calculate the max columns.
279 if 'fill-cells' in self.directive.options:
283 x = self.max_cols - len(row)
285 if row[-1] is None:
286 row.append( ( x - 1, 0, []) )
288 cspan, rspan, content = row[-1]
289 row[-1] = (cspan + x, rspan, content)
292 row.append( (0, 0, nodes.comment()) )
310 retVal = retVal[:-2]
312 retVal = retVal[:-2]
322 for child in rowItem:
323 if (isinstance(child , nodes.comment)
324 or isinstance(child, nodes.system_message)):
326 elif isinstance(child , nodes.target):
327 target = child
328 elif isinstance(child, nodes.bullet_list):
330 cell = child
338 'two-level bullet list expected, but row %s does not '
339 'contain a second-level bullet list.'