Render Indexed Array

Render an indexed array
160346
private function renderArrIndexed($name, $val)
    {
        if ($this->codeif) {
            // Echo if
            echo "{$this->indentation}@if (\${$this->code}$name)<br>";

            // Increase indentation
            $this->increaseIndentation();
        }

        // Start foreach
        echo "{$this->indentation}@foreach (\${$this->code}$name as \$item)<br>";

        // Clear $this->code
        $this->code = '';

        // Increase indentation
        $this->increaseIndentation();

        // Route next value
        foreach ($val as $key_index => $key_val) {
            if (count($val) > 1) {
                echo "{$this->indentation}<strong>[{$key_index}]</strong><br>";
            }
            $this->router('item', $key_val);
        }

        // Decrease indentation
        $this->decreaseIndentation();
    
        // End foreach
        echo "{$this->indentation}@endforeach<br>";

        if ($this->codeif) {
            // Decrease indentation
            $this->decreaseIndentation();

            // Echo endif
            echo "{$this->indentation}@endif<br>";
        }
    }
978671
function renderField(fieldName, index) {
      const field = model.provider.getField(fieldName);
      const fieldContainer = d3.select(this);
      let legendCell = fieldContainer.select(`.${style.jsLegend}`);
      let fieldCell = fieldContainer.select(`.${style.jsFieldName}`);

      // Apply style to row (selected/unselected)
      fieldContainer
        .classed(!field.active ? style.selectedRow : style.unselectedRow, false)
        .classed(field.active ? style.selectedRow : style.unselectedRow, true)
        .on('click', (name) => {
          model.provider.toggleFieldSelection(name);
        });

      // Create missing DOM element if any
      if (legendCell.empty()) {
        legendCell = fieldContainer.append('td').classed(style.legend, true);

        fieldCell = fieldContainer.append('td').classed(style.fieldName, true);
      }

      // Apply legend
      if (model.provider.isA('LegendProvider')) {
        const { color, shape } = model.provider.getLegend(fieldName);
        legendCell.html(`<svg class='${
          style.legendSvg
        }' width='${legendSize}' height='${legendSize}' viewBox='${
          shape.viewBox
        }'
                  fill='${color}' stroke='black'><use xlink:href='#${
          shape.id
        }'/></svg>`);
      } else {
        legendCell
          .html('<i></i>')
          .select('i')
          .classed(
            !field.active ? style.selectedRow : style.unselectedRow,
            false
          )
          .classed(
            field.active ? style.selectedRow : style.unselectedRow,
            true
          );
      }

      // Apply field name
      fieldCell.text(fieldName);

      if (model.fieldShowHistogram) {
        let minCell = fieldContainer.select(`.${style.jsHistMin}`);
        let histCell = fieldContainer.select(`.${style.jsSparkline}`);
        let maxCell = fieldContainer.select(`.${style.jsHistMax}`);

        if (histCell.empty()) {
          minCell = fieldContainer.append('td').classed(style.jsHistMin, true);
          histCell = fieldContainer.append('td').classed(style.sparkline, true);
          maxCell = fieldContainer.append('td').classed(style.jsHistMax, true);
          histCell
            .append('svg')
            .classed(style.sparklineSvg, true)
            .attr('width', model.fieldHistWidth)
            .attr('height', model.fieldHistHeight);
        }

        // make sure our data is ready. If not, render will be called when loaded.
        const hobj = model.histograms ? model.histograms[fieldName] : null;
        if (hobj) {
          histCell.style('display', hideField.hist ? 'none' : null);

          // only do work if histogram is displayed.
          if (!hideField.hist) {
            const cmax = 1.0 * d3.max(hobj.counts);
            const hsize = hobj.counts.length;
            const hdata = histCell
              .select('svg')
              .selectAll(`.${style.jsHistRect}`)
              .data(hobj.counts);

            hdata.enter().append('rect');
            // changes apply to both enter and update data join:
            hdata
              .attr(
                'class',
                (d, i) => (i % 2 === 0 ? style.histRectEven : style.histRectOdd)
              )
              .attr('pname', fieldName)
              .attr('y', (d) => model.fieldHistHeight * (1.0 - d / cmax))
              .attr('x', (d, i) => (model.fieldHistWidth / hsize) * i)
              .attr('height', (d) => model.fieldHistHeight * (d / cmax))
              .attr('width', model.fieldHistWidth / hsize);

            hdata.exit().remove();

            if (model.provider.isA('HistogramBinHoverProvider')) {
              histCell
                .select('svg')
                .on('mousemove', function inner(d, i) {
                  const mCoords = d3.mouse(this);
                  const binNum = Math.floor(
                    (mCoords[0] / model.fieldHistWidth) * hsize
                  );
                  const state = {};
                  state[fieldName] = [binNum];
                  model.provider.setHoverState({ state });
                })
                .on('mouseout', (d, i) => {
                  const state = {};
                  state[fieldName] = [-1];
                  model.provider.setHoverState({ state });
                });
            }
          }

          const formatter = d3.format('.3s');
          minCell
            .text(formatter(hobj.min))
            .style('display', hideField.minMax ? 'none' : null);
          maxCell
            .text(formatter(hobj.max))
            .style('display', hideField.minMax ? 'none' : null);
        }
      }
    }
471963
def render(view)
      tags = []

      render_charset(tags)
      render_title(tags)
      render_icon(tags)
      render_with_normalization(tags, :description)
      render_with_normalization(tags, :keywords)
      render_refresh(tags)
      render_noindex(tags)
      render_alternate(tags)
      render_open_search(tags)
      render_links(tags)

      render_hashes(tags)
      render_custom(tags)

      tags.tap(&:compact!).map! { |tag| tag.render(view) }
      view.safe_join tags, MetaTags.config.minify_output ? "" : "\n"
    end
1359019
function renderStatic (
  index,
  isInFor
) {
  var tree = this._staticTrees[index];
  // if has already-rendered static tree and not inside v-for,
  // we can reuse the same tree by doing a shallow clone.
  if (tree && !isInFor) {
    return Array.isArray(tree)
      ? cloneVNodes(tree)
      : cloneVNode(tree)
  }
  // otherwise, render a fresh tree.
  tree = this._staticTrees[index] =
    this.$options.staticRenderFns[index].call(this._renderProxy);
  markStatic(tree, ("__static__" + index), false);
  return tree
}
593846
def render
      rendered_items = ''

      list.list_items.each do |list_item|
        rendered_items += render_item(list_item)
      end

      content_tag opts[:wrapper_element], rendered_items, html_options, false
    end
99406
def render(self, target, data):
        """"""
        rows = self.get_rows(target, data)
        rows = self._filter_rows(rows)
        renderer = getattr(self, "_render_%s" % target.name, None)
        if renderer is None:
            raise ValueError(
                "Cannot render %r for %s." % (self.value, target))
        else:
            return renderer(rows)
794548
def render
      buffer = []
      _guess_col_widths
      rows = @list.size.to_s.length
      @rows = rows
      _prepare_format
      
      str = ""
      if @numbering
        str = " "*(rows+1)+@y
      end
      str <<  @fmstr % @columns
      buffer << str
      #puts "-" * str.length
      buffer << separator
      if @list
        if @numbering
          @fmstr = "%#{rows}d "+ @y + @fmstr
        end
        #@list.each { |e| puts e.join(@y) }
        count = 0
        @list.each_with_index { |r,i|  
          value = convert_value_to_text r, count
          buffer << value
          count += 1
        }
      end
      buffer
    end
931462
function (locals, cb) {
    if (typeof locals === 'function') {
      cb = locals;
      locals = {};
    }

    lazy.each(this.items, function (item, next) {
      this.app.render(item, locals, next);
    }.bind(this), cb);
  }
483468
function renderInstance(datum, index) {
    const instance = getInstance(this);
    instance.datum = datum;
    render(instance.selection, datum, index);
  }
925545
function renderAll( $element, $childrenOutput, $vars )
    {
        $tagText = '';
        foreach( $childrenOutput as $childOutput )
        {
            $tagText .= $childOutput[1];
        }
        $tagText = $this->renderTag( $element, $tagText, $vars );
        return array( false, $tagText );
    }
124123
function render(renderProperties, encodings, options) {
	encodings = linearizeEncodings(encodings);

	for (var i = 0; i < encodings.length; i++) {
		encodings[i].options = merge(options, encodings[i].options);
		fixOptions(encodings[i].options);
	}

	fixOptions(options);

	var Renderer = renderProperties.renderer;
	var renderer = new Renderer(renderProperties.element, encodings, options);
	renderer.render();

	if (renderProperties.afterRender) {
		renderProperties.afterRender();
	}
}
5086
def Render(self):
        
        xs = [self.xs[0]]
        ps = [0.0]
        for i, p in enumerate(self.ps):
            xs.append(self.xs[i])
            ps.append(p)

            try:
                xs.append(self.xs[i + 1])
                ps.append(p)
            except IndexError:
                pass
        return xs, ps
314154
function parseArray(tag, attrs, content, indentStr, indentLevel) {
    let html = '';
    for (let item of content) {
        if (getType(item)==='object') {
            let innerAttrs = getAttributes(item);
            let innerContent = TEXT in item ? item[TEXT] : '';
            html += renderElement(tag, innerAttrs, innerContent, indentStr, indentLevel);
        } else {
            html += renderElement(tag, attrs, item, indentStr, indentLevel);
        }
    }
    return html;
}
387954
def each_indexed_object(collection, index_name, **where):
    """"""
    index = _db[collection].indexes[index_name]
    for id in index.value_map.get(indexed_value(index, where), []):
        yield get_object(collection, id)
482952
def render_all pad, arr
      pre_render
      @content_cols = @source.pad_cols
      @clearstring = " " * @content_cols
      @list = arr

      att = @attr || NORMAL
      FFI::NCurses.wattron(pad, @cp | att)

      arr.each_with_index { |line, ix|
        render pad, ix, line
      }
      FFI::NCurses.wattroff(pad, @cp | att)
    end
699581
def render
      # Initialize the resulting tag
      tag_parts = []

      # Slice objects into separate lists
      lists = slice_objects

      # Render each list into `tag` variable
      lists.each do |list|
        items = list.collect { |item| render_link_for(item) }
        tag_parts << render_content_tag_for(items)
      end

      tag_parts.join.html_safe
    end
1129666
function eachOfArrayLike(coll, iteratee, callback) {
    callback = once(callback);
    var index = 0,
        completed = 0,
        {length} = coll,
        canceled = false;
    if (length === 0) {
        callback(null);
    }

    function iteratorCallback(err, value) {
        if (err === false) {
            canceled = true
        }
        if (canceled === true) return
        if (err) {
            callback(err);
        } else if ((++completed === length) || value === breakLoop) {
            callback(null);
        }
    }

    for (; index < length; index++) {
        iteratee(coll[index], index, onlyOnce(iteratorCallback));
    }
}