target for all intermediate parsing functions; calls renderTools.Tag.render() & returns html string
766541
function renderElement(tag, attrs, content, indentStr, indentLevel) {
    let indent = indentStr.repeat(indentLevel);
    content = renderFalsey(content);
    content = isNested(content) ? ('\n' + jxh(content, indentStr, ++indentLevel) + indent) : content;
    return Tag.render(indent, tag, attrs, content);
}
1212716
function generateHtml(node) {
    if (isReactElement(node)) {
        return _react2.default.renderToString(node);
    } else if (isReactFragment(node)) {
        var htmlStr = '';

        node.map(function (child) {
            htmlStr += generateHtml(child);
        });

        return htmlStr;
    } else if (isReactText(node)) {
        return String(node);
    } else if (isReactEmpty(node)) {
        return '';
    }

    try {
        return JSON.stringify(node);
    } catch (err) {
        console.error('stringify error:', err.message);
        return node;
    }
}
163893
function compileSourcePreCode() {
    var $version = '##version##';

    var componentRenderers = {};

    function extend(target, source) {
        if (source) {
            Object.keys(source).forEach(function (key) {
                var value = source[key];
                if (typeof value !== 'undefined') {
                    target[key] = value;
                }
            });
        }

        return target;
    }

    function each(array, iterator) {
        if (array && array.length > 0) {
            for (var i = 0, l = array.length; i < l; i++) {
                if (iterator(array[i], i) === false) {
                    break;
                }
            }
        }
    }

    function contains(array, value) {
        var result;
        each(array, function (item) {
            result = item === value;
            return !result;
        });

        return result;
    }

    var HTML_ENTITY = {
        /* jshint ignore:start */
        '&': '&amp;',
        '<': '&lt;',
        '>': '&gt;',
        '"': '&quot;',
        /* eslint-disable quotes */
        "'": '&#39;'
        /* eslint-enable quotes */
        /* jshint ignore:end */
    };

    function htmlFilterReplacer(c) {
        return HTML_ENTITY[c];
    }

    function escapeHTML(source) {
        if (source == null) {
            return '';
        }

        if (typeof source === 'string') {
            return source ? source.replace(/[&<>"']/g, htmlFilterReplacer) : '';
        }

        return '' + source;
    }

    function _classFilter(source) {
        if (source instanceof Array) {
            return source.join(' ');
        }

        return source;
    }

    function _styleFilter(source) {
        if (typeof source === 'object') {
            var result = '';
            if (source) {
                Object.keys(source).forEach(function (key) {
                    result += key + ':' + source[key] + ';';
                });
            }

            return result;
        }

        return source;
    }

    function _xclassFilter(source) {
        if (source instanceof Array) {
            source = source.join(' ');
        }

        return source ? ' ' + source : '';
    }

    function _xstyleFilter(source) {
        var result;
        if (typeof source === 'object') {
            result = '';
            if (source) {
                Object.keys(source).forEach(function (key) {
                    result += key + ':' + source[key] + ';';
                });
            }
        }
        else {
            result = source;
        }

        return result ? ';' + result : '';
    }

    function attrFilter(name, value) {
        if (value) {
            return ' ' + name + '="' + value + '"';
        }

        return '';
    }

    function boolAttrFilter(name, value) {
        if (value && value !== 'false' && value !== '0') {
            return ' ' + name;
        }

        return '';
    }

    function callFilter(ctx, name, args) {
        var filter = ctx.proto.filters[name];
        if (typeof filter === 'function') {
            return filter.apply(ctx, args);
        }
    }
}
999752
async function renderObj(nj, myVars, templateVars) {
  return JSON.parse(await render(nj, JSON.stringify(myVars), templateVars));
}
337681
async function renderElements (elements, globals) {
  const { $ } = globals
  const elementMap = keyBy(elements, 'tagName')
  const metaTagNames = filter(elements, { parent: [ 'head' ] }).map(({ tagName }) => tagName)
  const nonMetaTagNames = difference(elements.map(({ tagName }) => tagName), metaTagNames)

  const $nodes = [
    ...$.findNodes(metaTagNames), /** Render the meta elements first to last */
    ...$.findNodes(nonMetaTagNames).reverse() /** Render the elements last to first/outside to inside */
  ]

  for (let $node of $nodes) {
    const element = elementMap[$node.prop('tagName').toLowerCase()]
    const contents = $node.html()
    const attrs = $node[0].attribs

    const renderedValue = await Promise.resolve(renderElement(element, attrs, contents))

    $node.replaceWith(renderedValue.trim())
  }
}
770509
def transform(request, syntax_processor_name=None, var_name="text"):
    
    if request.method != 'POST':
        return HttpResponseNotAllowed("Only POST allowed")

    source = request.POST.get(var_name)
    if not source:
        return HttpResponse('')

    processor = TextProcessor.objects.get(name=syntax_processor_name or getattr(settings, "DEFAULT_MARKUP", "markdown"))
    output = processor.convert(source)

    try:
        t = template.Template(output, name='markup_preview')
        output = t.render(template.Context({'MEDIA_URL' : settings.MEDIA_URL}))
    except template.TemplateSyntaxError, e:
        log.warning('Error in preview rendering: %s' % e)
        output = '<h3 style="color:red">%s</h3><p>%s</p>' % (ugettext('You have an errors in source text!'), e)

    return HttpResponse(output)
1328989
function presentRendering(selector, classNames, speed) {
    const text = document.getElementById(selector).childNodes[0];
    const thisLength = text.length;

    const render = (autoMarkText, cp, length) => {
      let c = cp;
      const r = new Rendering(document, {
        className: classNames
      });
      const range = document.createRange();
      range.setStart(autoMarkText, 0);
      range.setEnd(autoMarkText, 1);
      r.renderWithRange(range);
      if (autoMarkText.parentNode.nextSibling) {
        const nextText = autoMarkText.parentNode.nextSibling.childNodes[0];
        setTimeout(() => {
          render(nextText, ++c, length);
        }, speed);
      }
    };

    return render(text, 0, thisLength);
  }
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);
      }
    }
937738
function(inlines) {
  var result = '';
  for (var i=0; i < inlines.length; i++) {
    result = result + this.renderInline(inlines[i]);
  }
  return result;
}
434341
function(template, context, partials, in_recursion) {
        // tit for tat
        var that = this;

        var new_regex = function() {
          return new RegExp(that.otag + "(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?" +
            that.ctag + "+", "g");
        };

        var regex = new_regex();
        var tag_replace_callback = function(match, operator, name) {
          switch(operator) {
          case "!": // ignore comments
            return "";
          case "=": // set new delimiters, rebuild the replace regexp
            that.set_delimiters(name);
            regex = new_regex();
            return "";
          case ">": // render partial
            return that.render_partial(name, context, partials);
          case "{": // the triple mustache is unescaped
            return that.find(name, context);
          default: // escape the value
            return that.escape(that.find(name, context));
          }
        };
        var lines = template.split("\n");
        for(var i = 0; i < lines.length; i++) {
          lines[i] = lines[i].replace(regex, tag_replace_callback, this);
          if(!in_recursion) {
            this.send(lines[i]);
          }
        }

        if(in_recursion) {
          return lines.join("\n");
        }
      }
1083911
function renderDoc(page, renderOpts) {
    if (generator.renderOpts !== defaultRenderOpts) return log(new Error('Recursive call to renderDoc'));
    var rOpts = generator.renderOpts = function() { return u.assign({}, defaultRenderOpts(page), renderOpts); };
    var out = renderTemplate(page, docTemplate(page), rOpts()); // synchronous
    generator.renderOpts = defaultRenderOpts;
    return out;
  }
1277049
function _renderMarkdown( htmlDoc ) {
    const replacements = {};

    // First turn all outputs into text so *<span class="or-output></span>* can be detected
    htmlDoc.find( '/root/form//span[contains(@class, "or-output")]' ).forEach( ( el, index ) => {
        const key = `---output-${index}`;
        const textNode = el.childNodes()[ 0 ].clone();
        replacements[ key ] = el.toString();
        textNode.text( key );
        el.replace( textNode );
        // Note that we end up in a situation where we likely have sibling text nodes...
    } );

    // Now render markdown
    htmlDoc.find( '/root/form//span[contains(@class, "question-label") or contains(@class, "or-hint")]' ).forEach( ( el, index ) => {
        let key;
        /**
         * Using text() is done because:
         * a) We are certain that these <span>s do not contain other elements, other than formatting/markdown <span>s.
         * b) This avoids the need to merge any sibling text nodes that could have been created in the previous step.
         *
         * Note that text() will convert &gt; to >
         */
        const original = el.text().replace( '<', '&lt;' ).replace( '>', '&gt;' );
        const rendered = markdown.toHtml( original );
        if ( original !== rendered ) {
            key = `$$$${index}`;
            replacements[ key ] = rendered;
            el.text( key );
        }
    } );

    // TODO: does this result in self-closing tags?
    let htmlStr = _docToString( htmlDoc );

    // Now replace the placeholders with the rendered HTML
    // in reverse order so outputs are done last
    Object.keys( replacements ).reverse().forEach( key => {
        const replacement = replacements[ key ];
        if ( replacement ) {
            htmlStr = htmlStr.replace( key, replacement );
        }
    } );

    return htmlStr;
}
710320
def _render(self, text):
        ''''''
        parser = commonmark.Parser()
        ast = parser.parse(text)
        renderer = HtmlRenderer(self)
        html = renderer.render(ast)
        return html
877753
function(inline) {
  var attrs;
  switch (inline.t) {
    case 'Str':
      return this.escape(inline.c);
    case 'Softbreak':
      return this.softbreak;
    case 'Hardbreak':
      return inTags('br',[],"",true) + '\n';
    case 'Emph':
      return inTags('em', [], this.renderInlines(inline.c));
    case 'Strong':
      return inTags('strong', [], this.renderInlines(inline.c));
    case 'Html':
      return inline.c;
    case 'Entity':
      return inline.c;
    case 'Link':
      attrs = [['href', this.escape(inline.destination, true)]];
      if (inline.title) {
        attrs.push(['title', this.escape(inline.title, true)]);
      }
      return inTags('a', attrs, this.renderInlines(inline.label));
    case 'Image':
      attrs = [['src', this.escape(inline.destination, true)],
                   ['alt', this.escape(this.renderInlines(inline.label))]];
      if (inline.title) {
        attrs.push(['title', this.escape(inline.title, true)]);
      }
      return inTags('img', attrs, "", true);
    case 'Code':
      return inTags('code', [], this.escape(inline.c));
    default:
      console.log("Uknown inline type " + inline.t);
      return "";
  }
}
40950
function Renderer(str, options) {
  options = options || {};
  options.globals = options.globals || {};
  options.functions = options.functions || {};
  options.use = options.use || [];
  options.use = Array.isArray(options.use) ? options.use : [options.use];
  options.imports = [join(__dirname, 'functions')].concat(options.imports || []);
  options.paths = options.paths || [];
  options.filename = options.filename || 'stylus';
  options.Evaluator = options.Evaluator || Evaluator;
  this.options = options;
  this.str = str;
  this.events = events;
}
936708
def render_like(parser, token):
    

    tokens = token.split_contents()
    var = tokens[1]

    return LikeRenderer(var)
1161495
function renderTemplate(impl, targetFile){
	var stappoImpl = fs.readFileSync(impl, "utf8");
	return gulp.src([targetFile])
		.pipe(replace('/*__stappo_impl__*/', stappoImpl));
}