How to use the mustache.escape function in mustache

To help you get started, we’ve selected a few mustache examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jembi / hearth / test / ihe / mhd.js View on Github external
'use strict'

const fs = require('fs')
const path = require('path')
const tap = require('tap')
const uuid = require('uuid/v4')
const request = require('request')
const _ = require('lodash')
const moment = require('moment')
const faker = require('faker')

const mustache = require('mustache')
// disable html escaping
mustache.escape = (v) => v

const env = require('../test-env/init')()
const server = require('../../lib/server')

const host = 'http://localhost:3447/fhir'

const loadResource = (filename, conf) => {
  const resPath = path.join(__dirname, 'mhd-test-samples', filename)
  const res = fs.readFileSync(resPath).toString()
  return mustache.render(res, conf)
}

const post = (host, resourceType, headers, body, onSuccess) => {
  const url = `${host}/${resourceType}`
  request.post({
    url: url,
github getredash / redash / client / app / services / query.js View on Github external
import moment from "moment";
import debug from "debug";
import Mustache from "mustache";
import { zipObject, isEmpty, map, filter, includes, union, uniq, has, identity, extend, each, some } from "lodash";

import { Parameter } from "./parameters";

Mustache.escape = identity; // do not html-escape values

export let Query = null; // eslint-disable-line import/no-mutable-exports

const logger = debug("redash:services:query");

function collectParams(parts) {
  let parameters = [];

  parts.forEach(part => {
    if (part[0] === "name" || part[0] === "&") {
      parameters.push(part[1].split(".")[0]);
    } else if (part[0] === "#") {
      parameters = union(parameters, collectParams(part[4]));
    }
  });
github mesoshq / mesosctl / modules / package.js View on Github external
var request = require("request"),
    MesosDNSAgent = require("mesosdns-http-agent"),
    Mustache = require("mustache"),
    chalk = require('chalk');

// Overwrite Mustache.js HTML escaping
Mustache.escape = function (value) {
    return value;
};

function getDefaultConfiguration (config) {

    var defaultConfigProperties = {};

    Object.getOwnPropertyNames(config.properties).forEach(function (propertyType) {

        // Iterate over all properties of propertyType
        Object.getOwnPropertyNames(config.properties[propertyType].properties).forEach(function (property) {

            // Create subobject if not yet present
            if (!defaultConfigProperties[propertyType]) {
                defaultConfigProperties[propertyType] = {};
            }
github TerriaJS / terriajs / lib / ReactViews / FeatureInfo / FeatureInfoSection.jsx View on Github external
import isArray from "terriajs-cesium/Source/Core/isArray";
import JulianDate from "terriajs-cesium/Source/Core/JulianDate";

import CustomComponents from "../Custom/CustomComponents";
import FeatureInfoDownload from "./FeatureInfoDownload";
import formatNumberForLocale from "../../Core/formatNumberForLocale";
import Icon from "../Icon.jsx";
import ObserveModelMixin from "../ObserveModelMixin";
import propertyGetTimeValues from "../../Core/propertyGetTimeValues";
import parseCustomMarkdownToReact from "../Custom/parseCustomMarkdownToReact";
import { withTranslation } from "react-i18next";

import Styles from "./feature-info-section.scss";

// We use Mustache templates inside React views, where React does the escaping; don't escape twice, or eg. " => "
Mustache.escape = function(string) {
  return string;
};

// Individual feature info section
export const FeatureInfoSection = createReactClass({
  displayName: "FeatureInfoSection",
  mixins: [ObserveModelMixin],

  propTypes: {
    viewState: PropTypes.object.isRequired,
    template: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
    feature: PropTypes.object,
    position: PropTypes.object,
    catalogItem: PropTypes.object, // Note this may not be known (eg. WFS).
    isOpen: PropTypes.bool,
    onClickHeader: PropTypes.func,
github microsoft / pai / src / rest-server / src / config / index.js View on Github external
// module dependencies
const fse = require('fs-extra');
const Joi = require('joi');
const dotenv = require('dotenv');
const mustache = require('mustache');


require.extensions['.mustache'] = (module, filename) => {
  module.exports = fse.readFileSync(filename, 'utf8');
};

dotenv.config();

mustache.escape = (string) => {
  // https://stackoverflow.com/questions/15783701/which-characters-need-to-be-escaped-when-using-bash/27817504#27817504
  return String(string)
    /* eslint-disable no-control-regex */
    .replace(/[\x20-\x24\x26-\x2A\x2C\x3B\x3C\x3E\x3F\x5B-\x5E\x60\x7B-\x7E]/g, '\\$&')
    .replace(/[\x00-\x1F\x7F]/g, (c) => ({
      /* eslint-enable no-control-regex */
      0x07: '\\a',
      0x08: '\\b',
      0x09: '\\t',
      0x0A: '\\n',
      0x0B: '\\v',
      0x0C: '\\f',
      0x0D: '\\r',
      0x1B: '\\E',
    }[c.charCodeAt(0)] || ''));
};
github izelnakri / mber / lib / transpilers / transpile-index-html.js View on Github external
import Mustache from 'mustache';

Mustache.escape = (text) => text; // NOTE: important to disable html escaping

export default function(htmlContent='', ENV={}, buildMetaConfig={}) {
  if (ENV.memserver && ENV.memserver.enabled) {
    const htmlWithMemserver = htmlContent.replace(
      '', `
      
      
    `);

    return Mustache.render(htmlWithMemserver, buildMetaConfig.indexHTMLInjections || {});
  }

  return Mustache.render(htmlContent, buildMetaConfig.indexHTMLInjections || {});
}
github apigee / openbank / init_openapis.js View on Github external
function replace_variables(paths, inject_object) {
    mustache.escape = function (value) {
        return value;
    };

    for(var i=0; i
github apigee / openbank / gulpfile.js View on Github external
function replace_variables(paths, inject_object, cb) {
    mustache.escape = function (value) {
        return value;
    };

    for(var i=0; i
github uber / deck.gl / examples / gallery / build-tools / utils.js View on Github external
const fs = require('fs');
const path = require('path');
const Mustache = require('mustache');

Mustache.escape = escapeHTML;

const {INPUT_DIR, IMAGE_DIR, MAPBOX_TOKEN, PORT} = require('./constants');

const ARGS = parseArgs();
const CACHE = {};
const analytics = ``;

let bundleUrl = null;
github egovernments / egov-services / rainmaker / pdf-service / src / index.js View on Github external
app.use(bodyParser.json({limit: '10mb', extended: true}));
app.use(bodyParser.urlencoded({limit: '10mb', extended: true }));

let maxPagesAllowed=envVariables.MAX_NUMBER_PAGES;
let serverport=envVariables.SERVER_PORT;

let dataConfigUrls=envVariables.DATA_CONFIG_URLS;
let formatConfigUrls=envVariables.FORMAT_CONFIG_URLS;

let dataConfigMap={};
let formatConfigMap={};



let mustache = require('mustache');
mustache.escape = function(text) {return text;};
let borderLayout = {
  hLineColor: function(i, node) {
    return "#979797";
  },
  vLineColor: function(i, node) {
    return "#979797";
  },
  hLineWidth: function(i, node) {
    return 0.5;
  },
  vLineWidth: function(i, node) {
    return 0.5;
  }
};

/**