... ctx是运行时render方法透传的模板数据 ...todo blocks是编译时分析出来的xxx
492563
function(ctx, blocks) {
                this.ctx = ctx;
                // ... this.blocks = {xxx: []}
                this.blocks = {};
                this.exported = [];

                for (var name in blocks) {
                    this.addBlock(name, blocks[name]);
                }
            }
191307
def render( content, ctx )
    
    ####################
    ## todo/fix: move ctx to Gen.initialize - why? why not?
    @name     = ctx[:name]

    @outdir   = ctx[:outdir]
    @srcdir   = ctx[:srcdir]
    @usrdir   = ctx[:usrdir]
    
    # run text filters
  
    config.text_filters.each do |filter|
      mn = filter.tr( '-', '_' ).to_sym  # construct method name (mn)
      puts "  run filter #{mn}..."
      content = send( mn, content )   # call filter e.g.  include_helper_hack( content )  
    end

    if config.takahashi?
      content = takahashi_slide_breaks( content )
    end

    # convert light-weight markup to hypertext

    content = markdown_to_html( content )
    content
  end
198342
def _render_context(self, template, block, **context):
        
        return u''.join(block(template.new_context(context)))
1242404
function postRender(engine, output) {
    var content = output.getContent();
    var blocks = output.getBlocks();

    var result = replaceBlocks(content, blocks);

    return Promise.forEach(blocks, function(block) {
        var post = block.get('post');

        if (!post) {
            return;
        }

        return post();
    })
    .thenResolve(result);
}
540751
function(){
            var self = this,
                renderLogContainer = document.createElement('div'),
                renderLogRenderCountNode = document.createElement("div"),
                renderLogDetailContainer = document.createElement("div"),
                renderLogNotesNode = document.createElement("div"),
                renderLogDetailNode = document.createElement("div");

            renderLogContainer.className = 'renderLog';

            // Apply styling
            this._applyCSSStyling(renderLogContainer, this.styling.renderLog);

            // Attach the click handler for toggling the detail log
            renderLogContainer.addEventListener('click', function(){

                // Show the detail Log
                if(renderLogRenderCountNode.style.display === 'none') {
                    renderLogRenderCountNode.style.display = 'block';
                    renderLogDetailContainer.style.display = 'none';
                    renderLogContainer.style.zIndex = '10000';

                // Hide it
                } else {
                    renderLogRenderCountNode.style.display = 'none';
                    renderLogDetailContainer.style.display = 'block';
                    renderLogContainer.style.zIndex = '10001';
                }
            });

            renderLogRenderCountNode.className = 'renderLogCounter';
            renderLogRenderCountNode.innerText = 1;

            renderLogDetailContainer.style.display = 'none';
            renderLogDetailNode.innerText = '';

            if (this.shouldComponentUpdate) {
                renderLogNotesNode.innerText = 'NOTE: This component uses a custom shouldComponentUpdate(), so the results above are purely informational';
            }

            this._applyCSSStyling(renderLogNotesNode, this.styling.renderLogDetailNotes);

            renderLogDetailContainer.appendChild(renderLogDetailNode);
            renderLogDetailContainer.appendChild(renderLogNotesNode);

            renderLogContainer.appendChild(renderLogRenderCountNode);
            renderLogContainer.appendChild(renderLogDetailContainer);

            this.renderLogContainer = renderLogContainer;
            this.renderLogDetail = renderLogDetailNode;
            this.renderLogNotes = renderLogNotesNode;
            this.renderLogRenderCount = renderLogRenderCountNode;

            // Append to the body
            document.getElementsByTagName('body')[0].appendChild(renderLogContainer);

            // Set initial position
            this._updateRenderLogPosition();

            //
            this._updateRenderLogNode();

        }
1149617
def render(self, ctx=None):
        '''
        
        '''
        self._initialize()
        render_count = 1
        if ctx is None:
            ctx = RenderContext()
            if self._need_second_pass:
                render_count = 2
        ctx.push(self)
        if self.is_default():
            self._current_rendered = self._default_rendered
        else:
            if self.offset is None:
                self.offset = 0
            for i in range(render_count):
                offset = self.offset
                rendered = BitArray()
                for field in self._fields:
                    field.set_offset(offset)
                    frendered = field.render(ctx)
                    if not isinstance(frendered, Bits):
                        raise KittyException('the field %s:%s was rendered to type %s, you should probably wrap it with appropriate encoder' % (
                            field.get_name(), type(field), type(frendered)))
                    rendered.append(frendered)
                    offset += len(frendered)
                self.set_current_value(rendered)
        ctx.pop()
        return self._current_rendered
1105346
function(html) {

        this.logger.log("Rendering header", "render");

        var colSpan = 7,
            DEPR_NAV_LEFT = "us/tr/callt.gif",
            DEPR_NAV_RIGHT = "us/tr/calrt.gif",
            cfg = this.cfg,
            pageDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),
            strings= cfg.getProperty(DEF_CFG.STRINGS.key),
            prevStr = (strings && strings.previousMonth) ?  strings.previousMonth : "",
            nextStr = (strings && strings.nextMonth) ? strings.nextMonth : "",
            monthLabel;

        if (cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)) {
            colSpan += 1;
        }
    
        if (cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)) {
            colSpan += 1;
        }

        html[html.length] = "<thead>";
        html[html.length] =  "<tr>";
        html[html.length] =   '<th colspan="' + colSpan + '" class="' + this.Style.CSS_HEADER_TEXT + '">';
        html[html.length] =    '<div class="' + this.Style.CSS_HEADER + '">';

        var renderLeft, renderRight = false;

        if (this.parent) {
            if (this.index === 0) {
                renderLeft = true;
            }
            if (this.index == (this.parent.cfg.getProperty("pages") -1)) {
                renderRight = true;
            }
        } else {
            renderLeft = true;
            renderRight = true;
        }

        if (renderLeft) {
            monthLabel  = this._buildMonthLabel(DateMath.subtract(pageDate, DateMath.MONTH, 1));

            var leftArrow = cfg.getProperty(DEF_CFG.NAV_ARROW_LEFT.key);
            // Check for deprecated customization - If someone set IMG_ROOT, but didn't set NAV_ARROW_LEFT, then set NAV_ARROW_LEFT to the old deprecated value
            if (leftArrow === null && Calendar.IMG_ROOT !== null) {
                leftArrow = Calendar.IMG_ROOT + DEPR_NAV_LEFT;
            }
            var leftStyle = (leftArrow === null) ? "" : ' style="background-image:url(' + leftArrow + ')"';
            html[html.length] = '<a class="' + this.Style.CSS_NAV_LEFT + '"' + leftStyle + ' href="#">' + prevStr + ' (' + monthLabel + ')' + '</a>';
        }

        var lbl = this.buildMonthLabel();
        var cal = this.parent || this;
        if (cal.cfg.getProperty("navigator")) {
            lbl = "<a class=\"" + this.Style.CSS_NAV + "\" href=\"#\">" + lbl + "</a>";
        }
        html[html.length] = lbl;

        if (renderRight) {
            monthLabel  = this._buildMonthLabel(DateMath.add(pageDate, DateMath.MONTH, 1));

            var rightArrow = cfg.getProperty(DEF_CFG.NAV_ARROW_RIGHT.key);
            if (rightArrow === null && Calendar.IMG_ROOT !== null) {
                rightArrow = Calendar.IMG_ROOT + DEPR_NAV_RIGHT;
            }
            var rightStyle = (rightArrow === null) ? "" : ' style="background-image:url(' + rightArrow + ')"';
            html[html.length] = '<a class="' + this.Style.CSS_NAV_RIGHT + '"' + rightStyle + ' href="#">' + nextStr + ' (' + monthLabel + ')' + '</a>';
        }

        html[html.length] = '</div>\n</th>\n</tr>';

        if (cfg.getProperty(DEF_CFG.SHOW_WEEKDAYS.key)) {
            html = this.buildWeekdays(html);
        }
        
        html[html.length] = '</thead>';
    
        return html;
    }
322826
function TextLayerBuilder_render(timeout) {
      if (!this.divContentDone || this.renderingDone) {
        return;
      }

      if (this.renderTimer) {
        clearTimeout(this.renderTimer);
        this.renderTimer = null;
      }

      if (!timeout) { // Render right away
        this.renderLayer();
      } else { // Schedule
        var self = this;
        this.renderTimer = setTimeout(function() {
          self.renderLayer();
          self.renderTimer = null;
        }, timeout);
      }
    }
593195
@Override
    public Object render(Map<String, Object> context, LNode... nodes) {

        for (int i = 0; i < nodes.length - 1; i += 2) {

            Object exprNodeValue = nodes[i].render(context);
            LNode blockNode = nodes[i + 1];

            if (super.asBoolean(exprNodeValue)) {
                return blockNode.render(context);
            }
        }

        return null;
    }
570385
function render() {
  var content = $($.parseHTML(template));
  var compiler = Handlebars.compile(content.filter("#layout").html());

  Handlebars.registerPartial({
    leftPanel: content.filter("#left-panel").html(),
    rightPanel: content.filter("#right-panel").html(),
    transactionList: content.filter("#transaction-list").html(),
    transactionDetails: content.filter("#transaction-details").html(),
    transactionOther: content.filter("#transaction-other").html(),
  });

  // Adds selected class to selected transaction item.
  Handlebars.registerHelper('isSelected', function(options) {
    var resp =
      (this.business === dataView.selectedTransaction.business) ?
      "selected" : "";
    return options.fn(resp);
  });

  // Returns fake detail monthly total.
  Handlebars.registerHelper('monthlyTotal', function(options) {
    var total = toCurrency(parseFloat(this.selectedTransaction.amount) * 12);
    return options.fn(total);
  });

  // Returns fake detail yearly total.
  Handlebars.registerHelper('yearlyTotal', function(options) {
    var total = toCurrency(parseFloat(this.selectedTransaction.amount) * 40);
    return options.fn(total);
  });

  var html = compiler(dataView);
  $("#demo-app").html(html);

  addClickHandler();
}
1245305
function (cb, layout) {
            layout = layout || 'main';
            var self = this,
                stack = new Y.Parallel();
            stack.html = [];
            stack.view = [];

            var counter = 0;
            Object.keys(self.data.files).forEach(function (k) {
                if (!self.data.files[k].external) {
                    counter++;
                }
            });
            Y.log('Rendering and writing ' + counter + ' source files.', 'info', 'builder');
            Y.each(self.data.files, function (v) {
                if (v.external) {
                    return;
                }
                self.renderFile(stack.add(function (html, view, data) {
                    if (!view || !data) {
                        return;
                    }
                    stack.html.push(html);
                    stack.view.push(view);
                    if (self.options.dumpview) {
                        Y.Files.writeFile(
                            path.join(self.options.outdir, 'json', 'files_' + self.filterFileName(data.name) + '.json'),
                            JSON.stringify(view),
                            stack.add(noop)
                        );
                    }
                    Y.Files.writeFile(
                        path.join(self.options.outdir, 'files', self.filterFileName(data.name) + '.html'),
                        html,
                        stack.add(noop)
                    );
                }), v, layout);
            });
            stack.done(function () {
                Y.log('Finished writing source files', 'info', 'builder');
                cb(stack.html, stack.view);
            });
        }
769874
function render(element, opts) {
    opts = opts || {};

    var prepend = opts.prepend;
    var model = opts.model || {};
    var indentLevel = opts.indentLevel || 0;
    var isPretty = opts.isPretty;
    var jtPrintIndent = isPretty ? '\t' : '';
    var jtPrintNewline = isPretty ? '\n' : '';
    var indent = '', i, len, prop;
    var p = [];  // p is going to be our concatenator for the HTML string

    // if no element, then no HTML so return empty string
    if (!element) { return ''; }

    // if already a string, just return it
    if (utils.isString(element)) { return element; }

    // if an array, wrap it
    if (utils.isArray(element)) { element = naked(element, null); }

    // set the indentation level to the current indent
    if (isPretty && indentLevel) {
        for (i = 0; i < indentLevel; i++) {
            indent += jtPrintIndent;
        }
    }

    // if we are prepending some string, add it first
    if (prepend) {
        p.push(indent, prepend, jtPrintNewline);
    }

    // starting tag open
    if (element.tag) {
        p.push(indent, '<', element.tag);
    }

    // all tag attributes
    if (element.attributes) {
        for (prop in element.attributes) {
            if (element.attributes.hasOwnProperty(prop)) {

                if (element.attributes[prop] === null) {
                    p.push(' ', prop);
                }
                else {
                    p.push(' ', prop, '="', element.attributes[prop], '"');
                }
            }
        }
    }

    // if no children or text, then close the tag
    if (element.tag && !element.children && (element.text === undefined || element.text === null)) {

        // for self closing we just close it, else we add the end tag
        if (selfClosing.indexOf(element.tag) > -1) {
            p.push('/>', jtPrintNewline);
        }
        else {
            p.push('></', element.tag, '>', jtPrintNewline);
        }
    }
    // else we need to add children or the inner text
    else {

        // if a tag (i.e. not just a string literal) put end bracket
        if (element.tag) { p.push('>'); }

        // if children, we will need to recurse
        if (element.children) {
            if (element.tag) { p.push(jtPrintNewline); }

            // recurse down for each child
            for (i = 0, len = element.children.length; i < len; ++i) {
                p.push(render(element.children[i], {
                    indentLevel:    element.tag ? indentLevel + 1 : indentLevel,
                    isPretty:       isPretty,
                    model:          model
                }));
            }

            if (element.tag) { p.push(indent); }
        }

        // if text, simply add it
        if (element.text !== null && element.text !== undefined) { p.push(element.text); }

        // finally if a tag, add close tag
        if (element.tag) {
            p.push('</', element.tag, '>', jtPrintNewline);
        }
    }

    return p.join('');
}
1143813
function(block){
    var escapePrettyMode = this.escapePrettyMode;
    var pp = this.pp;
    var ast = [];
    // Pretty print multi-line text
    if (pp && block.nodes.length > 1 && !escapePrettyMode &&
        block.nodes[0].type === 'Text' && block.nodes[1].type === 'Text' ) {
      push.apply(ast, this.prettyIndent(1, true));
    }
    for (var i = 0; i < block.nodes.length; ++i) {
      // Pretty print text
      if (pp && i > 0 && !escapePrettyMode &&
          block.nodes[i].type === 'Text' && block.nodes[i-1].type === 'Text' &&
          /\n$/.test(block.nodes[i - 1].val)) {
        push.apply(ast,this.prettyIndent(1, false));
      }
      push.apply(ast, this.visit(block.nodes[i], block));
    }
    return ast;
  }
458344
function (html) {
        var self = this;
        var blockList = MARK.matchBlocks(html);
        self.logger.trace('rendering', blockList);
        _.each(blockList, function (blockName) {
            var defineTag = MARK.define(blockName);
            var startTag = MARK.start(blockName);
            var endTag = MARK.end(blockName);

            var outerStartPos = html.indexOf(startTag);
            var startPos = outerStartPos + startTag.length;
            var endPos = html.indexOf(endTag);
            var outerEndPos = endPos + endTag.length;

            var innerHtml = html.substring(startPos, endPos);

            self.logger.trace(startPos, endPos);
            if (startPos >= startTag.length && endPos > startTag.length) {
                // remove outer content
                html = html.substring(0, outerStartPos) + html.substr(outerEndPos);
                // replace tag with innerHtml
                html = html.replace(defineTag, innerHtml);

                // 正则表达式效率过低，页面太长时导致堆栈溢出
                // html = html.replace(defineTag, html.substring(startPos, endPos))
                //    .replace(new RegExp(startTag + '(.|\n)*' + endTag, 'g'), '');
                // self.logger.trace('\n' + html);
            } else {
                html = html.replace(defineTag, '');
            }
        });
        return html;
    }
1196727
function (layoutName, data, moduleName) {
            if (layoutName === undefined) {
                return '';
            }

            if (moduleName === undefined && typeof data === 'string') {
                moduleName = data;
                data = undefined;
            }

            if (moduleName === undefined) {
                // 未指定模块时默认渲染当前模块下layout
                moduleName = resLocals.current_module;
                return renderLayout(layoutName, data, moduleName);
            } else {
                // 跨模块渲染, 在指定模块下完成layout渲染, 完成后切换回原模块
                var lastModule = resLocals.current_module;
                self.logger.trace('set current module from:%s to:%s', resLocals.current_module, moduleName);
                resLocals.current_module = moduleName;
                var html = renderLayout(layoutName, data, moduleName);
                self.logger.trace('set current module from:%s to:%s', resLocals.current_module, lastModule);
                resLocals.current_module = lastModule;
                return html;
            }
        }
944090
function render(){

	ll('Render start...');

	ll('nodes: ' + bbop.dump(nodes));
	// ll('matrix: ' + dump(matrix));
	ll('val_hash: ' + bbop.dump(val_hash));
	ll('max_val: ' + bbop.dump(max_val));

	var haxis = f2;
	var hhead = global_facet2;
	var vaxis = f1;
	var vhead = global_facet1;
	// Figure out which axis is the longer one and switch.
	// if( vaxis.length > haxis.length ){
	//     haxis = f1;
	//     vaxis = f2;	    
	//     vhead = global_facet1;
	//     hhead = global_facet2;
	// }

	var td_id_to_data = {};
	function _assemble_table(haxis, vaxis){
	    ll('try to _assemble_table...');
	    
	    // Start assembling the table parts.	
	    var thead = new html.tag('thead');
	    
	    // Add what we want in the header row.
	    var head = '';
	    var title_list = [head];
	    us.each(haxis, function(hline){
		var ht = hline[0];
		title_list.push(ht);
	    });
	    // Push the header row into thead.
	    us.each(title_list, function(title_item){
		thead.add_to('<th>' + title_item +
			     '<img style="border: 0px;" src="' +
			     sd.image_base + '/reorder.gif" />' +
			     '</th>');
	    });
	    
	    var tbody = new html.tag('tbody');
	    
	    // Add the rows.
	    us.each(vaxis, function(vline){
		var vt = vline[0];
		
		// Header row.
		var rhead = '<td style="background-color:#e9effa"><b>' +
			vt + '</b></td>';
		var row = [rhead];
		
		// Data rows.
		us.each(haxis, function(hline){
		    var ht = hline[0];
		    var cell_val = val_hash[vt][ht];
		    
		    var color = value_to_color(cell_val);
		    
		    // Data entry.
		    var td_attrs = {
			style: 'background-color:' +color + ';',
			title: vt +', '+ ht +': '+ cell_val,
			'class': 'bbop-js-tooltip',
			generate_id: true
		    };
		    var td = new html.tag('td', td_attrs, cell_val);
		    row.push(td.to_string());
		    
		    // Now save the data for later callback
		    // generation.
		    td_id_to_data[td.get_id()] = {
			x: ht,
			y: vt,
			z: cell_val
		    };
		});
		
		tbody.add_to('<tr>' + row.join('') + '</tr>');
	    });

	    //var tbl = new html.table(title_list);
	    var table_attrs = {
		'generate_id': true,
		'class': 'table' // bs3
	    };
	    var table = new html.tag('table', table_attrs);
	    table.add_to(thead);
	    table.add_to(tbody);

	    return table;
	}

	// Add table and sorting to DOM.
	jQuery(results_head).append(vhead + ' &#92; ' + hhead);
	var table_a = _assemble_table(haxis, vaxis);
	jQuery(results_div).append(table_a.to_string());
	jQuery('#' + table_a.get_id()).tablesorter();

	// Add tooltips.
	//var tt_args = {'position': {'my': 'left bottom', 'at': 'right top'}};
	var tt_args = {
	    'position': {'my': 'center bottom-5', 'at': 'center top'},
	    'tooltipClass': 'amigo-searchbar-tooltip-style'
	};
	jQuery('.bbop-js-tooltip').tooltip(tt_args);

	//
	ll('Completed render!');
	ll('Done!');
    }
1142047
function render(engine, str, locals, engineOptions) {
  try {
    var output = engine.render(engine.engine, str, locals, engineOptions)
  } catch(e) {
    throw new Error(
      NAME + ': there was a problem rendering the template:\n' + e)
  }
  return output
}