A section consisting of rows and columns
167723
def section(rows, columns, items, label=None):
    """"""

    # TODO: Integrate label

    sections = []

    column_class = "section-column col-sm-%i" % (12 / columns)

    for vertical in range(columns):
        column_items = []
        for horizontal in range(rows):
            try:
                item = items[horizontal][vertical]
                column_items.append(item)
            except IndexError:
                hfoslog('Field in', label, 'omitted, due to missing row/column:', vertical, horizontal,
                        lvl=warn, emitter='FORMS', tb=True, frame=2)

        column = {
            'type': 'section',
            'htmlClass': column_class,
            'items': column_items
        }
        sections.append(column)

    result = {
        'type': 'section',
        'htmlClass': 'row',
        'items': sections
    }

    return result
615456
function(matrix) {
    var M = matrix.elements || matrix;
    if (typeof(M[0][0]) == 'undefined') { M = Matrix.create(M).elements; }
    // this.columns should equal matrix.rows
    return (this.elements[0].length == M.length);
  }
695049
public static void appendTable(ParagraphAlignment[] alignment, int rows, int cols, String[][] values, int[]
            rowHeight, int[] colWidth, Map<String, Integer> cellMargins, Map<String, Object> styles) {
        createXwpfDocumentIfNull();
        xwpfDocument.createParagraph();
        XWPFTable table = xwpfDocument.createTable(rows, cols);
        XWPFParagraph paragraph;
        XWPFTableRow row;
        XWPFTableCell cell;
        CTTcPr cellPr;
        XWPFRun run;
        if (Checker.isNotEmpty(cellMargins)) {
            int top = MsUtils.checkInteger(cellMargins.get("top"));
            int left = MsUtils.checkInteger(cellMargins.get("left"));
            int bottom = MsUtils.checkInteger(cellMargins.get("bottom"));
            int right = MsUtils.checkInteger(cellMargins.get("right"));
            table.setCellMargins(top, left, bottom, right);
        }
        int minRow = Math.min(rows, values.length);
        for (int i = 0; i < minRow; i++) {
            row = table.getRow(i);
            int height = i < rowHeight.length ? rowHeight[i] : rowHeight[rowHeight.length - 1];
            row.setHeight(height);
            String[] value = values[i];
            int minCol = Math.min(cols, value.length);
            for (int j = 0; j < minCol; j++) {
                cell = row.getCell(j);
                cellPr = cell.getCTTc().addNewTcPr();
                int width = j < colWidth.length ? colWidth[j] : colWidth[colWidth.length - 1];
                cellPr.addNewTcW().setW(BigInteger.valueOf(width));
                paragraph = cell.getParagraphs().get(0);
                int idx = i * cols + j;
                ParagraphAlignment align = idx < alignment.length ? alignment[idx] : alignment[alignment.length - 1];
                paragraph.setAlignment(align);
                run = paragraph.createRun();
                run.setText(value[j]);
                setStyle(run, styles);
            }
        }
    }
1034450
def ordered_cols(self, columns, section):
        
        columns = list(columns)  # might be a tuple
        fixed_cols = [self.key]
        if section.lower() == "different":
            fixed_cols.extend([Differ.CHANGED_MATCH_KEY, Differ.CHANGED_OLD, Differ.CHANGED_NEW])
        map(columns.remove, fixed_cols)
        columns.sort()
        return fixed_cols + columns
1257510
function() {
        var item,
            span,
            size,
            l = this.items.length;

        this.matrix = [];

        for (var i = 0; i < l; i++) {
            item = this.items.eq(i);
            size = item.data('matrix-column-width');

            // How many columns does this item span?
            span = Math.max(Math.round(size / this.colWidth), 1);

            // Span cannot be larger than the total number of columns
            if (span > this.colCount) {
                span = this.colCount;
            }

            this.matrix.push({
                item: item,
                span: span
            });

            // Multiple columns
            if (span > 1) {
                for (var s = 1; s < span; s++) {
                    if (this.matrix) {
                        this.matrix.push({
                            item: item,
                            span: false // Indicates an empty space
                        });
                    }
                }
            }
        }
    }
1187376
function (rows) {
		var row,
			rowsLength,
			col,
			colsLength,
			columns;

		if (rows) {
			columns = [];
			rowsLength = rows.length;
			for (row = 0; row < rowsLength; row++) {
				colsLength = rows[row].length;
				for (col = 0; col < colsLength; col++) {
					if (!columns[col]) {
						columns[col] = [];
					}
					columns[col][row] = rows[row][col];
				}
			}
		}
		return columns;
	}
888385
private void subsection(TileBasedMap map, Space space, ArrayList spaces) {
		if (!clear(map, space)) {
			float width2 = space.getWidth()/2;
			float height2 = space.getHeight()/2;
			
			if ((width2 < smallestSpace) && (height2 < smallestSpace)) {
				return;
			}
			
			subsection(map, new Space(space.getX(), space.getY(), width2, height2), spaces);
			subsection(map, new Space(space.getX(), space.getY()+height2, width2, height2), spaces);
			subsection(map, new Space(space.getX()+width2, space.getY(), width2, height2), spaces);
			subsection(map, new Space(space.getX()+width2, space.getY()+height2, width2, height2), spaces);
		} else {
			spaces.add(space);
		}
	}
364612
function tableRow () {
  var args = arrayify(arguments)
  var rows = args.shift()
  if (!rows) return
  var options = args.pop()
  var cols = args
  var output = ''

  if (options.data) {
    var data = handlebars.createFrame(options.data)
    cols.forEach(function (col, index) {
      var colNumber = index + 1
      data['col' + colNumber] = containsData(rows, col)
    })
  }
  rows.forEach(function (row) {
    output += options.fn(row, { data: data })
  })
  return output
}
1094946
private void organizeCells(ArrayList<TextPiece> linesOfAPage,
	    TableCandidate tc) {
	float captionY = linesOfAPage.get(tc.getCaptionStartLine()).getY();
	float captionEndY = linesOfAPage.get(tc.getCaptionEndLine()).getEndY();
	ArrayList<TextPiece> rawCells = new ArrayList<TextPiece>();
	/*
	 * Copy & sort
	 */
	for (int i = tc.getBodyStartLine(); i <= tc.getBodyEndLine(); i++) {
	    rawCells.add(linesOfAPage.get(i));
	}

	Collections.sort(rawCells);
	assert rawCells.size() >= 4; // due to previous check
	TableRow currentRow = null; // creates first row

	for (TextPiece cell : rawCells) {
	    /*
	     * Skips lines beyond caption //TODO: remove the far Y
	     */
	    if (tc.isTopCaption() && (cell.getY() < captionY))
		continue;
	    if (!tc.isTopCaption() && (cell.getEndY() > captionEndY))
		continue;

	    /*
	     * Lines too close to each other are treated as a single line
	     */
	    if (currentRow != null
		    && cell.getY() - currentRow.getY() < m_docInfo
			    .getAverageLineGap() / 2.0)
		currentRow.addCell(cell);
	    else {
		/*
		 * Creates a new row
		 */
		currentRow = new TableRow();
		currentRow.setY(cell.getY());
		if (cell.isSuperScriptBeginning())
		    currentRow.setSuperScriptRow(true);
		currentRow.addCell(cell);
		tc.addRow(currentRow);
	    }
	}
	if (tc.getRows().size() < 2)
	    tc.setValid(false);
    }
715812
function() {
        this._calculateColumns();

        this.fireEvent('rendering');

        var element = this.element,
            items = this.items;

        // No items
        if (!items.length) {
            element.removeAttr('style');

        // Single column
        } else if (this.colCount <= 1) {
            element.removeAttr('style').addClass('no-columns');
            items.removeAttr('style');

        // Multi column
        } else {
            element.removeClass('no-columns');

            this._organizeItems();
            this._positionItems();
        }

        this.fireEvent('rendered');
    }
469363
def row(self, data):
        """"""
        for column in self.column_funcs:
            if callable(column):
                yield column(data)
            else:
                yield utils.lookup(data, *column)
422352
def <<(row)
      if row == Border::SEPARATOR
        separators << columns_size - (header ? 0 : 2)
      else
        rows_copy = rows.dup
        assert_row_sizes rows_copy << row
        rows << to_row(row)
      end
      self
    end
446385
public void layoutParts() {
    StringBuilder styleClass = new StringBuilder("group");

    // if there are no rows yet, getRowCount returns -1, in this case the next row is 0
    int nextRow = PreferencesFxUtils.getRowCount(grid) + 1;

    // Only when the preferencesGroup has a title
    if (preferencesGroup.getTitle() != null) {
      grid.add(titleLabel, 0, nextRow++, 2, 1);
      styleClass.append("-title");
      titleLabel.getStyleClass().add("group-title");
    }

    List<Field> fields = preferencesGroup.getElements().stream()
        .map(Field.class::cast)
        .collect(Collectors.toList());
    styleClass.append("-setting");

    int rowAmount = nextRow;
    for (int i = 0; i < fields.size(); i++) {
      // add to GridPane
      Field field = fields.get(i);
      SimpleControl c = (SimpleControl) field.getRenderer();
      c.setField(field);
      grid.add(c.getFieldLabel(), 0, i + rowAmount, 1, 1);
      grid.add(c.getNode(), 1, i + rowAmount, 1, 1);

      // Styling
      GridPane.setHgrow(c.getNode(), Priority.SOMETIMES);
      GridPane.setValignment(c.getNode(), VPos.CENTER);
      GridPane.setValignment(c.getFieldLabel(), VPos.CENTER);

      // additional styling for the last setting
      if (i == fields.size() - 1) {
        styleClass.append("-last");
        GridPane.setMargin(
            c.getNode(),
            new Insets(0, 0, PreferencesFxFormRenderer.SPACING * 4, 0)
        );
        GridPane.setMargin(
            c.getFieldLabel(),
            new Insets(0, 0, PreferencesFxFormRenderer.SPACING * 4, 0)
        );
      }

      c.getFieldLabel().getStyleClass().add(styleClass.toString() + "-label");
      c.getNode().getStyleClass().add(styleClass.toString() + "-node");
    }
  }
992847
def _GetRow(self, columns=None):
        """"""

        row = self._table[self._row_index]
        if columns:
            result = []
            for col in columns:
                if col not in self.header:
                    raise TableError("Column header %s not known in table." % col)
                result.append(row[self.header.index(col)])
            row = result
        return row
349481
private void organizeContent()
    {
        table = new TableBox(el, g, ctx);
        table.adoptParent(this);
        table.setStyle(style);
        
        for (Iterator<Box> it = nested.iterator(); it.hasNext(); )
        {
            Box box = it.next();
            if (box instanceof TableCaptionBox)
            {
                caption = (TableCaptionBox) box;
            }
            else if (box instanceof BlockBox && ((BlockBox) box).isPositioned())
            {
                //positioned boxes are ignored
            }
            else //other elements belong to the table itself
            {
                table.addSubBox(box);
                box.setContainingBlockBox(table);
                box.setParent(table);
                it.remove();
                endChild--;
            }
        }
        
        addSubBox(table);
    }
687969
static void bottomTwoColumns(NodeInfo first, NodeInfo second, List<NodeInfo> column0, List<NodeInfo> column1) {
		column0.add(first);
		column0.add(second);

		NodeInfo a = selectClosestN(first,second);
		if( a == null ) {
			return;
		}
		a.marked = true;
		column1.add(a);
		NodeInfo b = second;

		while( true ) {
			NodeInfo t = selectClosestN(a,b);
			if( t == null ) break;
			t.marked = true;
			column1.add(t);

			a = t;
			t = selectClosestN(a,b);
			if( t == null ) break;
			t.marked = true;
			column0.add(t);
			b = t;
		}
	}
736005
def rows(self):
        """"""


        for s_name, s in self.sections.items():

            # Yield the section header
            if s.name != 'Root':
                yield ['']  # Unecessary, but makes for nice formatting. Should actually be done just before write
                yield ['Section', s.value] + s.property_names

            # Yield all of the rows for terms in the section
            for row in s.rows:
                term, value = row

                term = term.replace('root.', '').title()

                try:
                    yield [term] + value
                except:
                    yield [term] + [value]