nested table constructor
180744
public function nested_table($instance_name = '', $field = '', $inner_tbl = '', $tbl_field = '')
    {
        if ($instance_name && $field && $inner_tbl && $tbl_field)
        {
            $fdata = $this->_parse_field_names($field, 'nested_table');
            foreach ($fdata as $fitem)
            {
                $this->inner_table_instance[$instance_name] = $fitem['table'] . '.' . $fitem['field']; // name of nested object will be stored in parent instance
                $instance = Fruit::get_instance($instance_name); // just another fruit object
                $instance->table($this->prefix . $inner_tbl);
                $instance->is_inner = true; // nested flag

                $fdata2 = $this->_parse_field_names($tbl_field, 'nested_table', $inner_tbl);

                $instance->inner_where[$fitem['table'] . '.' . $fitem['field']] = key($fdata2); // this connects nested table with parent
                return $instance; // only one cycle
            }
        }
    }
627178
function buildItem(parentAttrNode, row, context) {
    const item = {};

    if (context.primaryKey === null) resolvePrimaryKey(row, context);

    Object.keys(parentAttrNode.attributes).forEach(attrName => {
        const attrNode = parentAttrNode.attributes[attrName];

        if (context.selectedInternalLevel > 0) {
            if (!attrNode.selectedInternal) return;
            if (!attrNode.selectedInternal[context.selectedInternalLevel - 1]) return;
        } else if (!attrNode.selected) return;

        if (attrNode.attributes) {
            const subContext = Object.assign({}, context);
            subContext.attrPath = context.attrPath.concat([attrName]);

            if (attrNode.dataSources) {
                // resource context:
                subContext.resourceAttrNode = attrNode;
                subContext.primaryKey = null;
                subContext.secondaryRows = null;

                let rawResult;
                let keys;
                let keyIsNull = true;
                let parentKeyRow = row;

                if (
                    attrNode.parentDataSource &&
                    attrNode.parentDataSource !== context.resourceAttrNode.primaryDataSource
                ) {
                    parentKeyRow = context.secondaryRows[attrNode.parentDataSource];
                }

                if (parentKeyRow) {
                    rawResult = getResult(attrNode, attrNode.joinVia || attrNode.primaryDataSource, subContext);
                    keys = rawResult.parentKey.map(keyAttr => {
                        if (typeof parentKeyRow[keyAttr] === 'undefined') {
                            /*
                            // TODO: Strict mode?
                            throw new DataError(`Sub-resource "${subContext.attrPath.join('.')}" ` +
                                misses keyattribute "${keyAttr}" in parent result ` +
                                `(DataSource "${context.resourceAttrNode.primaryDataSource}")`);
                            */
                        } else if (parentKeyRow[keyAttr] !== null) {
                            keyIsNull = false;
                        }
                        return parentKeyRow[keyAttr];
                    });
                }

                if (keyIsNull) {
                    keys = [];
                } else if (!rawResult.multiValuedParentKey) {
                    // normal and composite parentKey: "keys" is a string (as array) afterwards:
                    keys = [keys.join(keySeparator)];
                } else {
                    // dereference parentKey array (key length must be 1 when multiValued)
                    // but "keys" is still an array (multiValued) afterwards:
                    keys = keys[0];

                    if (!Array.isArray(keys)) {
                        throw new DataError(
                            `Sub-resource "${subContext.attrPath.join('.')}" ` +
                                `multiValued key attribute "${rawResult.parentKey[0]}" ` +
                                'in parent result is not an array ' +
                                `(DataSource "${context.resourceAttrNode.primaryDataSource}")`
                        );
                    }
                }

                let secondaryRows = null;
                if (attrNode.joinVia) {
                    let primaryRawResult = null; // set on demand to avoid errors for empty results
                    const joinViaKeys = [];
                    secondaryRows = {};

                    keys.forEach(key => {
                        let joinViaRows = rawResult.indexedData[key];
                        if (!joinViaRows) return;

                        if (rawResult.uniqueChildKey) joinViaRows = [joinViaRows];

                        joinViaRows.forEach(joinViaRow => {
                            primaryRawResult =
                                primaryRawResult || getResult(attrNode, attrNode.primaryDataSource, subContext);

                            let childKeyIsNull = true;
                            const childKey = primaryRawResult.parentKey
                                .map(keyAttr => {
                                    if (typeof joinViaRow[keyAttr] === 'undefined') {
                                        throw new DataError(
                                            `Sub-resource "${subContext.attrPath.join('.')}" ` +
                                                `misses key attribute "${keyAttr}" in joinVia result ` +
                                                `(DataSource "${attrNode.joinVia}")`
                                        );
                                    } else if (joinViaRow[keyAttr] !== null) {
                                        childKeyIsNull = false;
                                    }
                                    return joinViaRow[keyAttr];
                                })
                                .join(keySeparator);

                            if (!childKeyIsNull) {
                                joinViaKeys.push(childKey);

                                secondaryRows[childKey] = {};
                                secondaryRows[childKey][attrNode.joinVia] = joinViaRow;
                            }
                        });
                    });

                    rawResult = primaryRawResult;
                    keys = joinViaKeys;
                }

                const subItem = [];
                keys.forEach(key => {
                    const subRow = rawResult.indexedData[key];
                    if (!subRow) {
                        // ignore
                    } else {
                        subContext.secondaryRows = secondaryRows ? secondaryRows[key] : null;

                        if (!rawResult.uniqueChildKey) {
                            subRow.forEach(singleSubRow => subItem.push(buildItem(attrNode, singleSubRow, subContext)));
                        } else {
                            subItem.push(buildItem(attrNode, subRow, subContext));
                        }
                    }
                });

                item[attrName] = attrNode.many ? subItem : subItem[0] || null;
            } else {
                // nested-attribute context:
                item[attrName] = buildItem(attrNode, row, subContext);
            }
        } else {
            item[attrName] = buildAttribute(attrNode, row, context);
        }
    });

    // Extension: "item"
    if (parentAttrNode.resourceName) {
        const resource = context.api.getResource(parentAttrNode.resourceName);
        if (resource && resource.extensions && resource.extensions.item) {
            resource.extensions.item({
                item,
                row,
                secondaryRows: context.secondaryRows,
                request: context.request,
                getAttribute: attribute => getAttribute(attribute || [], parentAttrNode),
                getResult: (attrNode, dataSourceName) =>
                    getResult(
                        attrNode || parentAttrNode,
                        dataSourceName || (attrNode || parentAttrNode).primaryDataSource,
                        context
                    ),
                buildItem: attributes => {
                    const maxRecursionLevel = 20;

                    function selectInternal(level, isSelected) {
                        attributes.forEach(attribute => {
                            let attrNode = parentAttrNode;
                            attribute.forEach(attrName => {
                                if (!(attrNode.attributes && attrNode.attributes[attrName])) {
                                    let attrStr = attribute.join('.');
                                    throw new ImplementationError(
                                        `item-extension/buildItem: Unknown attribute "${attrStr}"`
                                    );
                                }
                                attrNode = attrNode.attributes[attrName];

                                if (!attrNode.selectedInternal) {
                                    // we use a flag per recursion level to handle recursive buildItem calls independently
                                    attrNode.selectedInternal = new Array(maxRecursionLevel).fill(false);
                                }
                                attrNode.selectedInternal[level - 1] = isSelected;
                            });
                        });
                    }

                    const subContext = Object.assign({}, context);
                    subContext.selectedInternalLevel++;

                    if (subContext.selectedInternalLevel > maxRecursionLevel) {
                        let attrStr = attributes.map(attribute => attribute.join('.')).join(',');
                        throw new ImplementationError(
                            `item-extension/buildItem: Recursion depth for "${attrStr}" too big`
                        );
                    }

                    selectInternal(subContext.selectedInternalLevel, true);
                    const internalItem = buildItem(parentAttrNode, row, subContext);
                    selectInternal(subContext.selectedInternalLevel, false);

                    return internalItem;
                }
            });
        }
    }

    context.primaryKey = null; // clear primaryKey cache for next row

    return item;
}
1222372
def interior_nesting(cls, elem1, xpath, namespaces=None):
        """"""
        for elem2 in elem1.xpath(xpath, namespaces=namespaces):
            child_elem1 = etree.Element(elem1.tag)
            for k in elem1.attrib:
                child_elem1.set(k, elem1.get(k))
            child_elem1.text, elem2.text = elem2.text, ''
            for ch in elem2.getchildren():
                child_elem1.append(ch)
            elem2.insert(0, child_elem1)
        XML.replace_with_contents(elem1)
1270181
function(tableItemOrString){
                var generatedDef;
                /** @type {TableItem} */
                var tableItem;
                if(typeof tableItemOrString==='string'){
                    tableItem = {name: tableItemOrString};
                }else{
                    tableItem = tableItemOrString;
                }
                if(tableItem.mixin){
                    generatedDef = be.tableMixin(tableItem.mixin[0],tableItem.mixin[1],{
                        name:tableItem.name,
                        title:tableItem.title
                    });
                }else if(tableItem.tableGenerator){
                    generatedDef = tableItem.tableGenerator;
                }else{
                    tableItem = changing({name: tableItem.name, fileName: tableItem.name}, tableItem);
                    tableItem = changing({source: (tableItem.path||be.rootPath+'/server')+'/table-'+tableItem.fileName+'.js'}, tableItem);
                    if(!tableItem.source){
                        throw new Error('Need source for tableItem.name:'+tableItem.name);
                    }else{
                        generatedDef = require(tableItem.source);
                        if(!(generatedDef instanceof Function)){
                            generatedDef=generatedDef[tableItem.name];
                            var contextForDump=be.getContextForDump();
                            var tableDef = generatedDef(contextForDump);
                            if(!tableDef.adapted){
                                generatedDef = function(generatedDef){
                                    /** @param {bp.Context} context  */
                                    return function (context){
                                        return be.tableDefAdapt(generatedDef(context), context);
                                    }
                                }(generatedDef);
                            }
                        }
                    }
                }
                be.tableStructures[tableItem.name] = generatedDef;
            }
1216526
function tableFromEvents(eventsObj) {
  const headers = ["Event Name", "Type", "Description"]
  let rows = []

  for(const evt in eventsObj) {
    let cols = []

    cols.push(`${evt}`) // event name
    
    let typeList = ''
    eventsObj[evt]["type"]["names"].forEach((type, idx, arr) => {
      typeList += `${type}${arr[idx+1] ? `|` : ''}`
    })
    cols.push(typeList) // list of event types
    cols.push(`${eventsObj[evt]["description"]}`) // description of the event

    rows.push(cols);
  }

  return rows.length > 0 ? {table: {headers, rows}} : null
}
1208026
def tabulate(data, header=True, headers=None, accessors=None,
             **table_options):
    
    if header and not headers:
        data = iter(data)
        try:
            headers = next(data)
        except StopIteration:
            pass
    if headers and hasattr(headers, 'items') and accessors is None:
        # Dict mode; Build accessors and headers from keys of data.
        data = itertools.chain([headers], data)
        accessors = list(headers)
        headers = [' '.join(map(str.capitalize, x.replace('_', ' ').split()))
                   for x in accessors]
    t = Table(headers=headers, accessors=accessors, **table_options)
    try:
        t.print(data)
    except RowsNotFound:
        pass
    return t
341445
function Table(options, data) {
        options = options || {};

        // Updates indexes on the fly.
        if (!options.update) options.update = {};

        if ('undefined' === typeof options.update.indexes) {
            options.update.indexes = true;
        }

        NDDB.call(this, options, data);

//         // ### Table.row
//         // NDDB hash containing elements grouped by row index
//         // @see NDDB.hash
//         if (!this.row) {
//             this.hash('row', function(c) {
//                 return c.x;
//             });
//         }
//
//         // ### Table.col
//         // NDDB hash containing elements grouped by column index
//         // @see NDDB.hash
//         if (!this.col) {
//             this.hash('col', function(c) {
//                 return c.y;
//             });
//         }

        // ### Table.rowcol
        // NDDB index to access elements with row.col notation
        // @see NDDB.hash
        if (!this.rowcol) {
            this.index('rowcol', function(c) {
                return c.x + '.' + c.y;
            });
        }

        /**
         * ### Table.pointers
         *
         * References to last inserted cell coordinates
         */
        this.pointers = {
            x: options.pointerX || null,
            y: options.pointerY || null
        };

        /**
         * ### Table.header
         *
         * Array containing the header elements of the table
         */
        this.header = [];

        /**
         * ### Table.footer
         *
         * Array containing the footer elements of the table
         */
        this.footer = [];

        /**
         * ### Table.left
         *
         * Array containing elements to keep on the left border of the table
         */
        this.left = [];

        /**
         * ### Table.table
         *
         * Reference to the HTMLElement Table
         */
        this.table = options.table || document.createElement('table');

        if ('string' === typeof options.id) {
            this.table.id = options.id;
        }
        else if (options.id) {
            throw new TypeError('Table constructor: options.id must be ' +
                                'string or undefined.');
        }

        if ('string' === typeof options.className) {
            this.table.className = options.className;
        }
        else if (J.isArray(options.className)) {
            this.table.className = options.className.join(' ');
        }
        else if (options.className) {
            throw new TypeError('Table constructor: options.className must ' +
                                'be string, array, or undefined.');
        }

        /**
         * ### Table.missingClassName
         *
         * Class name for "missing" cells
         *
         * "Missing" cells are cells that are added automatically to complete
         * the table because one or more cells have been added with higher
         * row and column indexes.
         */
        this.missingClassName = 'missing';

        if ('string' === typeof options.missingClassName) {
            this.missingClassName = options.missingClassName;
        }
        else if (J.isArray(options.missingClassName)) {
            this.missingClassName = options.missingClassName.join(' ');
        }
        else if (options.missingClassName) {
            throw new TypeError('Table constructor: options.className must ' +
                                'be string, array, or undefined.');
        }

        /**
         * ### Table.autoParse
         *
         * If TRUE, whenever a new cell is added the table is updated.
         * Default: FALSE
         */
        this.autoParse = 'undefined' !== typeof options.autoParse ?
            options.autoParse : false;

        /**
         * ### Table.trs
         *
         * List of TR elements indexed by their order in the parsed table
         */
        this.trs = {};

        /**
         * ### Table.trCb
         *
         * Callback function applied to each TR HTML element
         *
         * Callback receives the HTML element, and the row index, or
         * 'thead' and 'tfoot' for header and footer.
         */
        if ('function' === typeof options.tr) {
            this.trCb = options.tr;
        }
        else if ('undefined' === typeof options.tr) {
            this.trCb = null;
        }
        else {
            throw new TypeError('Table constructor: options.tr must be ' +
                                'function or undefined.');
        }

        // Init renderer.
        this.initRenderer(options.render);
    }
56612
function Table(selector) {
    var _this = this;

    _this.$table = $(selector).eq(0);

    if (!_this.$table.length) {
      return;
    }

    _this.init();
  }
267336
private static String nestedListToHtml( NestedList nl ){
		if( nl == null ) {
			return "null";
		}

		StringBuilder result = new StringBuilder();

		if( nl.getClass()==NestedListElement.class ){
			result.append( "<li>\n"+ contentElementToHtml( (NestedListElement)nl ) +"</li>\n" );
		}
		else{
			result.append("<table class=\"NestedList\">\n" +
					"<tr><th class=\"NestedList\">NestedList</th></tr>\n"+
					"<tr><td class=\"NestedList\">" );

			result.append((((NestedListContainer)nl).isNumbered()?"<ol>":"<ul>")+"\n" );
			for( NestedList nl2 : ((NestedListContainer)nl).getNestedLists() ) {
				result.append( nestedListToHtml( nl2 ) );
			}
			result.append((((NestedListContainer)nl).isNumbered()?"</ol>":"</ul>")+"\n");

			result.append("</td></tr>\n" );
			result.append("</table>\n");
		}

		return result.toString();
	}
648516
function buildTables(vueObj) {
  let updatedTemplate = [{h3: "<button class='title'>PROPS, METHODS, EVENTS, SLOTS</button>"}]
  let mdTable
  
  mdTable = tableFromProps(vueObj["props"])
  if(mdTable != null) {
    updatedTemplate.push(mdTable)
  }
  
  mdTable = tableFromMethods(vueObj["methods"])
  if(mdTable != null) {
    updatedTemplate.push(mdTable)
  }

  mdTable = tableFromEvents(vueObj["events"])
  if(mdTable != null) {
    updatedTemplate.push(mdTable)
  }
  
  mdTable = tableFromSlots(vueObj["slots"])
  if(mdTable != null) {
    updatedTemplate.push(mdTable)
  }

  return updatedTemplate.length > 1 ? updatedTemplate : []
}
794834
def make_table(self, renderable):
        """"""
        self._make_prefix()
        diffs = renderable.diff._diff

        # set up iterator to wrap lines that exceed desired width
        if self._wrapcolumn:
            diffs = self._line_wrapper(diffs, renderable.diff.hide_expected)

        # collect up from/to lines and flags into lists (also format the lines)
        fromlist, tolist, flaglist = self._collect_lines(diffs)

        # process change flags, generating middle column of next anchors/links
        fromlist, tolist, flaglist, next_href, next_id = self._convert_flags(
            fromlist, tolist, flaglist, False, 5)

        s = []
        fmt = '            <tr><td class="diff_next"%s>%s</td>%s' + \
              '<td class="diff_next">%s</td>%s</tr>\n'
        for i in range(len(flaglist)):
            if flaglist[i] is None:
                # mdiff yields None on separator lines skip the bogus ones
                # generated for the first line
                if i > 0:
                    s.append('        </tbody>        \n        <tbody>\n')
            else:
                s.append(fmt % (next_id[i], next_href[i], fromlist[i],
                                next_href[i], tolist[i]))
        header_row = '<thead><tr>%s%s%s%s</tr></thead>' % (
            '<th class="diff_next"><br /></th>',
            '<th colspan="2" class="diff_header">%s</th>' % self.FROM_DESC,
            '<th class="diff_next"><br /></th>',
            '<th colspan="2" class="diff_header">%s</th>' % self.TO_DESC)

        table = self._table_template % dict(
            data_rows=''.join(s),
            header_row=header_row,
            prefix=self._prefix[1])

        return table.replace('\0+', '<span class="diff_add">'). \
            replace('\0-', '<span class="diff_sub">'). \
            replace('\0^', '<span class="diff_chg">'). \
            replace('\1', '</span>'). \
            replace('\t', '&nbsp;')
500494
function Column (table, header, i) {
  this._table = table, this._header = header, this._i = i
}
801285
def build_table(self):
        
        self.table = self.parent.tinydb.table(self.tablename)
800343
function (table) {
			var isArr = shine.lib.table.getn (table) > 0,
				result = shine.gc['create' + (isArr? 'Array' : 'Object')](),
				numValues = table.__shine.numValues,
				i,
				l = numValues.length;

			for (i = 1; i < l; i++) {
				result[i - 1] = ((numValues[i] || shine.EMPTY_OBJ) instanceof shine.Table)? shine.utils.toObject(numValues[i]) : numValues[i];
			}

			for (i in table) {
				if (table.hasOwnProperty(i) && !(i in shine.Table.prototype) && i !== '__shine') {
					result[i] = ((table[i] || shine.EMPTY_OBJ) instanceof shine.Table)? shine.utils.toObject(table[i]) : table[i];
				}
			}
			
			return result;
		}
104024
function generateTableRowNode(line, separator) {

    const tableRow = {
        type: 'TableRow',
        children: separator.map(align => ({
            type: 'TableDataCell',
            align
        }))
    };

    for (let i = 0, data = calRow(line), len = data.length; i < len; i++) {
        tableRow.children[i].rawValue = data[i];
    }

    return tableRow;

}
975947
def nest(self, node, cls=None):
        

        if cls is None:
            cls = type(self)

        nested_scope = cls(node, self)
        self.children.append(nested_scope)
        return nested_scope
1187598
function initialize() {
  this.sortClass = UNDEFINED;
  this.sortColumnIndex = UNDEFINED;
  this.sortDirection = UNDEFINED;
  this.tableData = [];
  this.bindProperties();
  if ( this.ui.sortButton ) {
    this.sortColumnIndex = this.getColumnIndex();

    this.sortDirection = DIRECTIONS.UP;
    if ( this.ui.sortButton.classList.contains( this.classes.sortDown ) ) {
      this.sortDirection = DIRECTIONS.DOWN;
    }

    this.updateTable();
  }
}