How to use applause - 4 common examples

To help you get started, we’ve selected a few applause 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 outaTiME / gulp-replace-task / index.js View on Github external
return through2.obj(function (file, enc, cb) {

    if (file.isNull()) {
      this.push(file);
      return cb();
    }

    if (file.isStream()) {
      this.emit('error', new gutil.PluginError(PLUGIN_NAME,
        'Streaming not supported'));
      return cb();
    }

    var options = opts || {};
    var contents = file.contents.toString();
    var applause = Applause.create(options);
    var result = applause.replace(contents);
    if (result !== false) {
      file.contents = new Buffer(result);
    } else {
      // preserve original file
    }

    this.push(file);
    cb();

  });
github outaTiME / grunt-replace / scripts / generate.js View on Github external
sections[section] = contents;
}

// write readme

var Applause = require('applause');
var options = {
  patterns: [{
    match: 'options',
    replacement: function() {
      var name = 'Applause Options';
      return sections[name] || '_(Coming soon)_'; // empty
    }
  }]
};
var applause = Applause.create(options);
var result = applause.replace(fs.readFileSync('docs/README.md', 'utf8'));
fs.writeFileSync('README.md', result.content, 'utf8');
github outaTiME / grunt-replace / tasks / replace.js View on Github external
}, {
          match: '__TARGET_PATH__',
          replacement: function(match, offset, string, source, target) {
            return path.dirname(target);
          },
          builtin: true
        }, {
          match: '__TARGET_FILENAME__',
          replacement: function(match, offset, string, source, target) {
            return path.basename(target);
          },
          builtin: true
        });
      }
      // create applause instance
      var applause = Applause.create(_.extend({}, options, {
        // pass
      }));
      // took code from copy task
      var isExpandedPair;
      var dirs = {};
      var tally = {
        dirs: 0,
        files: 0,
        replacements: 0,
        details: []
      };
      this.files.forEach(function(filePair) {
        isExpandedPair = filePair.orig.expand || false;
        filePair.src.forEach(function(src) {
          src = unixifyPath(src);
          var dest = unixifyPath(filePair.dest);
github atilacamurca / react-native-ebook / epub.js View on Github external
},
        {
            match: /(<|<\/)block.*>/g,
            replacement: ''
        },
        {
            match: /!\[(.*)\]\((.*)\)/g,
            replacement: function () {
                let description = arguments[1];
                let file = arguments[2];
                return `![${description}](./versions/${version}/${file})`;
            }
        }
    ]
};
var applause = Applause.create(options);
let tocMarkdown = [];

function replaceOptions(data) {
    let result = applause.replace(data);
    if (result.content) {
        return result.content;
    }
    return data;
}

function writeMdString(item, callback) {
    const filename = `.tmp/${item.file}.md`;
    let data = `# ${item.title}\n\n`;
    data += fs.readFileSync(`versions/${version}/docs/${item.file}.md`);
    data = replaceOptions(data);
    fs.appendFile(filename, data, function(err) {

applause

Human-friendly replacements.

MIT
Latest version published 4 years ago

Package Health Score

47 / 100
Full package analysis

Popular applause functions