/*
Renders inverted (^) and normal (#) sections
422255
function(template, context, partials) {
        if(!this.includes("#", template) && !this.includes("^", template)) {
          return template;
        }

        var that = this;
        // CSW - Added "+?" so it finds the tighest bound, not the widest
        var regex = new RegExp(this.otag + "(\\^|\\#)\\s*(.+)\\s*" + this.ctag +
                "\n*([\\s\\S]+?)" + this.otag + "\\/\\s*\\2\\s*" + this.ctag +
                "\\s*", "mg");

        // for each {{#foo}}{{/foo}} section do...
        return template.replace(regex, function(match, type, name, content) {
          var value = that.find(name, context);
          if(type == "^") { // inverted section
            if(!value || that.is_array(value) && value.length === 0) {
              // false or empty list, render it
              return that.render(content, context, partials, true);
            } else {
              return "";
            }
          } else if(type == "#") { // normal section
            if(that.is_array(value)) { // Enumerable, Let's loop!
              return that.map(value, function(row) {
                return that.render(content, that.create_context(row),
                  partials, true);
              }).join("");
            } else if(that.is_object(value)) { // Object, Use it as subcontext!
              return that.render(content, that.create_context(value),
                partials, true);
            } else if(typeof value === "function") {
              // higher order section
              return value.call(context, content, function(text) {
                return that.render(text, context, partials, true);
              });
            } else if(value) { // boolean section
              return that.render(content, context, partials, true);
            } else {
              return "";
            }
          }
        });
      }
392152
function parseAwsIni(ini) {
  var section,
      out = Object.create(null),
      re = /^\[([^\]]+)\]\s*$|^([a-z_]+)\s*=\s*(.+?)\s*$/,
      lines = ini.split(/\r?\n/)

  lines.forEach(function(line) {
    var match = line.match(re)
    if (!match) return
    if (match[1]) {
      section = match[1]
      if (out[section] == null) out[section] = Object.create(null)
    } else if (section) {
      out[section][match[2]] = match[3]
    }
  })

  return out
}
571031
function (obj, opts) {
  var toc = [];

  // Finesse comment markdown data.
  // Also, statefully create TOC.
  var sections = _.chain(obj)
    .map(function (data) { return new Section(data, opts); })
    .filter(function (s) { return s.isPublic(); })
    .map(function (s) {
      toc.push(s.renderToc());  // Add to TOC.
      return s.renderSection(); // Render section.
    })
    .value()
    .join("\n");

  // No Output if not sections.
  if (!sections) {
    return "";
  }

  return "\n" + toc.join("") + "\n" + sections;
}
85519
function render(item, escape) {
        return [
          '<div class="completed">',
            '<strong class="name">'+ escape(item.name) +'</strong>',
           'string' === typeof item.desc ? '<span class="description">'+ escape(item.desc) +'</span>' : '',
          '</div>'
        ].join('');
      }
1178365
private void render(StringBuilder buf, int key, String undef, boolean expanded) {
    boolean force = key != VARIANT && (key == LANGUAGE || expanded);
    String value = fields[key];
    if (value != null || force) {
      if (buf.length() > 0) {
        buf.append(SEP);
      }
      buf.append(value == null ? undef : value);
    }
  }
4522
function renderHelpText(text) {
      if (text) {
        if (!helpTextDiv) {
          helpTextDiv = document.createElement("div");
          helpTextDiv.className = 'col-sm-9 col-sm-offset-3 has-error';
          formGroup.appendChild(helpTextDiv);
        }
        helpTextDiv.innerHTML = '<span style="display: block;" class="help-block">' + text + '</span>';
        $(formGroup).addClass('has-error');
        if (inputGroupButton)
          $(inputGroupButton).addClass('btn-danger');
      } else {
        setTimeout(function () {
          if (helpTextDiv) {
            $(helpTextDiv).remove();
            helpTextDiv = null;
          }
        }, 250);
        $(formGroup).removeClass('has-error');
        if (inputGroupButton)
          $(inputGroupButton).removeClass('btn-danger');
      }
    }
338993
public function renderSection()
    {
        $sections = array();
        foreach ($this->items as $item) {
            $sections[] = $this->renderItem($item);
        }
        return \CHtml::tag('div', $this->htmlOptions, implode("\n", $sections));
    }
12960
function render(issues, enableFiltering) {
		var content = '';

		if (enableFiltering) {
			content += '<div class="filters">' + getSeverityFilters(issues) + '<div>\n';
		}

		content += '<div>' + getIssues(issues) + '</div>';

		return '<div>' + content + '</div>';
	}
1224919
public function render()
    {
        $diff = '';
        $opCodes = $this->diff->getGroupedOpcodes();
        foreach ($opCodes as $group) {
            $diff .= "***************\n";
            $lastItem = count($group) - 1;
            $i1 = $group[0][1];
            $i2 = $group[$lastItem][2];
            $j1 = $group[0][3];
            $j2 = $group[$lastItem][4];

            if ($i2 - $i1 >= 2) {
                $diff .= '*** ' . ($group[0][1] + 1) . ',' . $i2 . " ****\n";
            } else {
                $diff .= '*** ' . $i2 . " ****\n";
            }

            if ($j2 - $j1 >= 2) {
                $separator = '--- ' . ($j1 + 1) . ',' . $j2 . " ----\n";
            } else {
                $separator = '--- ' . $j2 . " ----\n";
            }

            $hasVisible = false;
            foreach ($group as $code) {
                if ($code[0] == 'replace' || $code[0] == 'delete') {
                    $hasVisible = true;
                    break;
                }
            }

            if ($hasVisible) {
                foreach ($group as $code) {
                    list($tag, $i1, $i2, $j1, $j2) = $code;
                    if ($tag == 'insert') {
                        continue;
                    }
                    $diff .= $this->tagMap[$tag] . ' ' . implode("\n" . $this->tagMap[$tag] . ' ',
                            $this->diff->GetA($i1, $i2)) . "\n";
                }
            }

            $hasVisible = false;
            foreach ($group as $code) {
                if ($code[0] == 'replace' || $code[0] == 'insert') {
                    $hasVisible = true;
                    break;
                }
            }

            $diff .= $separator;

            if ($hasVisible) {
                foreach ($group as $code) {
                    list($tag, $i1, $i2, $j1, $j2) = $code;
                    if ($tag == 'delete') {
                        continue;
                    }
                    $diff .= $this->tagMap[$tag] . ' ' . implode("\n" . $this->tagMap[$tag] . ' ',
                            $this->diff->GetB($j1, $j2)) . "\n";
                }
            }
        }
        return $diff;
    }
1032419
function normalizePage(sections, options) {
    options = _.defaults(options || {}, {
        // Current book
        book: null,

        // Do we need to convert svg?
        convertImages: false,

        // Current file path
        input: '.',

        // Navigation to use to transform path
        navigation: {},

        // Directory parent of the file currently in rendering process
        base: './',

        // Directory parent from the html output
        output: './',

        // Glossary terms
        glossary: []
    });

    // List of images to convert
    var toConvert = [];

    sections = _.map(sections, function(section) {
        if (section.type != 'normal') return section;

        var out = normalizeHtml(section.content, options);

        toConvert = toConvert.concat(out.images);
        section.content = out.html;
        return section;
    });

    return Q()
    .then(function() {
        toConvert = _.uniq(toConvert, 'source');
        return convertImages(toConvert, options);
    })
    .thenResolve(sections);
}
976172
function render(template, vars) {
    var rendered = template;

    for (var key in vars) {
        if (vars.hasOwnProperty(key)) {
            var val = vars[key];
            var regExpString = '\\{' + key + '\\}';
            var regExp = new RegExp(regExpString, 'g');

            rendered = rendered.replace(regExp, val);
        }
    }

    return rendered;
}
293586
function compileTokens(tokens) {
    var subRenders = {};

    function subRender(i, tokens, template) {
      if (!subRenders[i]) {
        var fn = compileTokens(tokens);
        subRenders[i] = function (writer, context) {
          return fn(writer, context, template);
        };
      }

      return subRenders[i];
    }

    return function (writer, context, template) {
      var buffer = "";
      var token, sectionText;

      for (var i = 0, len = tokens.length; i < len; ++i) {
        token = tokens[i];

        switch (token[0]) {
        case "#":
          sectionText = template.slice.apply(template, sectionBounds(token));
          buffer += writer._section(token[1], context, sectionText, subRender(i, token[4], template));
          break;
        case "^":
          buffer += writer._inverted(token[1], context, subRender(i, token[4], template));
          break;
        case ">":
          buffer += writer._partial(token[1], context);
          break;
        case "&":
          buffer += writer._name(token[1], context);
          break;
        case "name":
          buffer += writer._escaped(token[1], context);
          break;
        case "text":
          buffer += token[1];
          break;
        }
      }

      return buffer;
    };
  }
378346
function(val, ctx, partials, inverted, start, end, tags) {
      var pass;

      if (isArray(val) && val.length === 0) {
        return false;
      }

      if (typeof val == 'function') {
        val = this.ls(val, ctx, partials, inverted, start, end, tags);
      }

      pass = (val === '') || !!val;

      if (!inverted && pass && ctx) {
        ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
      }

      return pass;
    }
781721
function prettify(md) {
  ast(md);
  const render = md.render;

  md.render = function(str, options) {
    if (typeof str !== 'string') {
      throw new TypeError('expected a string');
    }
    str = str.split(/\]\[\]\s*\n\s*\[/).join('][]\n\n[');
    return render.call(md, str, options);
  };

  md.renderer.renderInline = function(tokens, options, env) {
    const _rules = rules;
    let len = tokens.length, i = 0;
    let str = '';

    while (len--) {
      str += _rules[tokens[i].type](tokens, i++, options, env, this);
    }
    return str;
  };

  md.renderer.render = function(tokens, options, env) {
    let _rules = rules;
    let len = tokens.length, i = -1;
    let str = '';

    while (++i < len) {
      let token = tokens[i];
      if (token.type === 'inline') {
        str += this.renderInline(token.children, options, env);
      } else {
        str += _rules[token.type](tokens, i, options, env, this);
      }
    }

    if (options.condense !== false) {
      str = str.split(/(?:\r\n|\n){2,}/).join('\n\n');
    }

    let newline = '\n';
    if (options.newline === false) {
      newline = '';
    }
    if (typeof options.newline === 'string') {
      newline = options.newline;
    }
    str = str.trim() + newline;
    return str;
  };
}
550214
@Override
    public void renderNothing( PositionedText target, double x, double y, boolean forward )
    {
        target.add( x, y, ">" );
    }
350807
function renderToken(token) {
  var syntax = token.getCGSyntax();
  if (syntax in renderFunc === false) {
    throw new Error('Undefined syntax: ' + syntax);
  }

  return renderFunc[syntax](token.getBody(), this.MDRenderer);
}
1034828
static void render(List<AbstractConfigValue> stack, StringBuilder sb, int indent, boolean atRoot, String atKey,
            ConfigRenderOptions options) {
        boolean commentMerge = options.getComments();
        if (commentMerge) {
            sb.append("# unresolved merge of " + stack.size() + " values follows (\n");
            if (atKey == null) {
                indent(sb, indent, options);
                sb.append("# this unresolved merge will not be parseable because it's at the root of the object\n");
                indent(sb, indent, options);
                sb.append("# the HOCON format has no way to list multiple root objects in a single file\n");
            }
        }

        List<AbstractConfigValue> reversed = new ArrayList<AbstractConfigValue>();
        reversed.addAll(stack);
        Collections.reverse(reversed);

        int i = 0;
        for (AbstractConfigValue v : reversed) {
            if (commentMerge) {
                indent(sb, indent, options);
                if (atKey != null) {
                    sb.append("#     unmerged value " + i + " for key "
                            + ConfigImplUtil.renderJsonString(atKey) + " from ");
                } else {
                    sb.append("#     unmerged value " + i + " from ");
                }
                i += 1;
                sb.append(v.origin().description());
                sb.append("\n");

                for (String comment : v.origin().comments()) {
                    indent(sb, indent, options);
                    sb.append("# ");
                    sb.append(comment);
                    sb.append("\n");
                }
            }
            indent(sb, indent, options);

            if (atKey != null) {
                sb.append(ConfigImplUtil.renderJsonString(atKey));
                if (options.getFormatted())
                    sb.append(" : ");
                else
                    sb.append(":");
            }
            v.render(sb, indent, atRoot, options);
            sb.append(",");
            if (options.getFormatted())
                sb.append('\n');
        }
        // chop comma or newline
        sb.setLength(sb.length() - 1);
        if (options.getFormatted()) {
            sb.setLength(sb.length() - 1); // also chop comma
            sb.append("\n"); // put a newline back
        }
        if (commentMerge) {
            indent(sb, indent, options);
            sb.append("# ) end of unresolved merge\n");
        }
    }