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AAS,CAAC,EAClC,EAAM,KAAK,OAAO,EAAQ,GAAM,KAAK,KAAI,SAAS,GAChD,IAAI,EAAU,KAAK,QAAQ,GAAM,SAAW,GACxC,EAAW,KAAK,KAAK,EAAQ,GAAM,KAAM,KAAK,KAAK,IAAS,MAChE,EAAK,IAAM,QAAQ,GACnB,IAAI,EAAS,EAAM,YAAY,EAAS,EAAY,EAAM,MAC1D,EAAM,KAAK,MAAM,EAAU,EAC7B,IAEJ,CAMA,GAJA,EAAkB,OAClB,EAAkB,QAGd,KAAK,WAAa,EAAI,OAAO,CACnC,IAEA,IAAI,EAAO,SAAS,GAClB,OAAO,KAAK,KAAK,KAAK,KAAM,EAAU,GACxC,EAGI,EAAO,SAAS,GAClB,OAAO,KAAK,KAAK,KAAK,KAAM,UAAW,MAAO,EAChD,CAEF","file":"/npm/grunt-readme@0.4.5/tasks/readme.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/grunt-readme@0.4.5/tasks/readme.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**!\r\n * grunt-readme\r\n * http://github.com/assemble/grunt-readme\r\n * Partially derived from and inspired by grunt-contrib-internal\r\n *\r\n * Copyright (c) 2013, Jon Schlinkert, contributors\r\n * Licensed under the MIT license.\r\n */\r\n\r\n'use strict';\r\n\r\n\r\n// Node.js\r\nvar path = require('path');\r\n\r\n// node_modules\r\nvar load    = require('resolve-dep');\r\nvar name    = require('node-name');\r\nvar yaml    = require('assemble-yaml');\r\nvar makeTOC = require('marked-toc');\r\nvar marked  = require('marked');\r\nvar glob    = require('glob-utils');\r\nvar grunt   = require('grunt');\r\nvar _       = grunt.util._;\r\n\r\n\r\nmodule.exports = function(grunt) {\r\n\r\n  // Local utils\r\n  var Utils = require('./lib/utils');\r\n\r\n  _.mixin(require('./lib/mixins'));\r\n  _.mixin(require('./lib/badges'));\r\n\r\n\r\n  // Add custom template delimiters for our templates.\r\n  grunt.template.addDelimiters('readme', '{%', '%}');\r\n\r\n  grunt.registerTask('readme', \"Generate your project's README from a template. If you already use Grunt, this is a no brainer.\", function() {\r\n\r\n    // The 'readme' task options.\r\n    var options = this.options({\r\n      templates: '',\r\n      includes: '',\r\n      readme: '',\r\n      config: '',\r\n      sep: '\\n',\r\n      remove: [],\r\n      contributing: false\r\n    });\r\n\r\n\r\n    /**\r\n     * options.metadata\r\n     * @type {Object}\r\n     */\r\n    var metadata = Utils.readOptionsData(options.metadata);\r\n    grunt.verbose.ok('README metadata:'.yellow, metadata);\r\n\r\n    /**\r\n     * meta: {}\r\n     * Root context object passed to templates with a value of \"this\"\r\n     * @type {Object}\r\n     */\r\n    if(grunt.file.exists(path.resolve(process.cwd(),'package.json'))) {\r\n      options.config = _.extend(require('./lib/pkg.js'), grunt.file.readJSON(path.resolve(process.cwd(),'package.json')));\r\n    } else {\r\n      options.config = require('./lib/pkg.js');\r\n    }\r\n    var meta = _.defaults(metadata, options.config);\r\n    grunt.verbose.ok(\">> Meta:\".yellow, JSON.stringify(meta, null, 2));\r\n\r\n    /**\r\n     * Convenience variables.\r\n     */\r\n    meta.copyright = _.copyright();\r\n    meta.homepage  = _.homepage();\r\n    meta.license   = _.license();\r\n    meta.n         = '\\n';\r\n    meta.safename  = _.safename(meta.name);\r\n    meta.shortname = _.shortname(meta.name);\r\n    meta.username  = _.username();\r\n    meta.repo      = _.username() + '/' + meta.name;\r\n\r\n    /**\r\n     * Templates directory.\r\n     * If `options: { templates: '' }` is not defined, then the task will use the\r\n     * templates directory in the `./templates` directory of the grunt-readme task.\r\n     * @type {String}\r\n     */\r\n    if(_.isEmpty(options.templates)) {\r\n      options.templates = root('templates');\r\n    } else {\r\n      options.templates = bind(options.templates);\r\n    }\r\n    var templates = options.templates;\r\n\r\n\r\n    /**\r\n     * Docs directory\r\n     * The location where all of your docs will be stored\r\n     * This defaults to './docs' in the root of your project.\r\n     * @example:\r\n     *   options: {\r\n     *     docs: 'foo/'\r\n     *   }\r\n     */\r\n    var baseDocs = root('docs');\r\n    if(!options.docs) {\r\n      options.docs = path.join.bind(options.docs, 'docs');\r\n    } else if (options.docs) {\r\n      options.docs = path.join.bind(process.cwd(), options.docs, '');\r\n    } else {\r\n      options.docs = baseDocs;\r\n    }\r\n    var docs = options.docs;\r\n\r\n\r\n    if(!_.isEmpty(options.boilerplate)) {\r\n      var boilerplate = root(path.join('templates', 'boilerplates'))(options.boilerplate);\r\n\r\n      if(grunt.file.isDir(boilerplate)) {\r\n        grunt.file.recurse(boilerplate, function(filepath, rootdir, subdir, filename) {\r\n          if(!grunt.file.exists(docs(filename))) {\r\n            grunt.file.copy(filepath, docs(filename));\r\n          }\r\n        });\r\n      }\r\n    }\r\n\r\n    /**\r\n     * README template used to create README.md. Unless a template\r\n     * is defined in the task options, a start template from\r\n     * grunt-readme will be used.\r\n     *\r\n     * @example:\r\n     *   options: {\r\n     *     readme: './foo/README.tmpl.md'\r\n     *   }\r\n     */\r\n\r\n    // If `readme` option is defined with a readme template, use that,\r\n    // otherwise, see if the README template is in the `docs()` dir\r\n    if (!options.readme && grunt.file.exists(docs('README.tmpl.md'))) {\r\n      options.readme = docs('README.tmpl.md');\r\n    // As a last resort, use a template from grunt-readme\r\n    } else {\r\n      options.readme = templates('README.tmpl.md');\r\n    }\r\n\r\n\r\n    // Extract and parse YAML front matter\r\n    var yfm = yaml.extract(options.readme).context;\r\n\r\n    // Extend context with data from YFM\r\n    meta = _.extend({}, meta, yfm);\r\n\r\n    // Extract content from template\r\n    options.readme = yaml.extract(options.readme).content;\r\n\r\n\r\n    grunt.verbose.writeln(\"yfm: \", yfm);\r\n    grunt.verbose.writeln(\"options.readme: \", options.readme);\r\n    grunt.verbose.writeln(\"meta: \", meta);\r\n\r\n\r\n    // Add mixins for use in our templates.\r\n    // TODO: externalize these.\r\n    _.mixin({\r\n      meta: function (key) {\r\n        return Utils.meta(key, meta);\r\n      },\r\n      doc: function (filepath, sep) {\r\n        sep = sep || options.sep;\r\n        return glob.content(docs(filepath), sep).replace(/^#/gm, '##');\r\n      },\r\n      include: function (filepath, sep) {\r\n        sep = sep || options.sep;\r\n        var includesPath = path.join(templates('includes'), filepath);\r\n        return glob.content(includesPath, sep).replace(/^#/gm, '##');\r\n      },\r\n      contrib: function (filepath, sep) {\r\n        sep = sep || options.sep;\r\n        var includesPath = path.join(templates('contrib'), filepath);\r\n        return glob.content(includesPath, sep).replace(/^#/gm, '##');\r\n      },\r\n      badge: function (badge) {\r\n        return grunt.file.read(templates('badges/' + badge + '.md'));\r\n      }\r\n    });\r\n\r\n\r\n    /**\r\n     * TRAVIS\r\n     */\r\n    meta.travis = grunt.file.exists('.travis.yml');\r\n    if (meta.travis) {\r\n      meta.travis = meta.repository.url.replace(/.*:\\/\\/github.com\\/(.*)\\.git/, 'https://travis-ci.org/$1');\r\n    }\r\n\r\n\r\n\r\n    /**\r\n     * CHANGELOG\r\n     */\r\n    meta.changelog = grunt.file.exists('CHANGELOG');\r\n    if (meta.changelog) {\r\n      meta.changelog = grunt.file.readYAML('CHANGELOG');\r\n    }\r\n\r\n\r\n\r\n    /**\r\n     * CONTRIBUTING.md\r\n     * Copy contributing guide from templates.\r\n     */\r\n    if (!grunt.file.exists('CONTRIBUTING.md') && options.contributing) {\r\n      grunt.file.copy(templates('CONTRIBUTING.md'), 'CONTRIBUTING.md');\r\n      grunt.log.ok('Created CONTRIBUTING.md');\r\n    }\r\n\r\n\r\n\r\n    /**\r\n     * AUTHORS\r\n     */\r\n    var authors = grunt.file.exists('AUTHORS');\r\n    if (authors) {\r\n      authors = grunt.file.readYAML('AUTHORS');\r\n      meta.authors = authors.split('\\n').map(function(author) {\r\n        var matches = author.match(/(.*?)\\s*\\((.*)\\)/) || [];\r\n        return {name: matches[1], url: matches[2]};\r\n      });\r\n    }\r\n\r\n\r\n    /**\r\n     * Generate a Table of Contents\r\n     * @usage: {%= toc %}\r\n     */\r\n    meta.toc = makeTOC(options.readme);\r\n\r\n\r\n    /**\r\n     * Generalized template configuration\r\n     */\r\n    var tmplConfig = {\r\n      data: meta,\r\n      delimiters: 'readme'\r\n    };\r\n\r\n\r\n    /**\r\n     * Generate README\r\n     */\r\n    var newReadme = Utils.compileTmpl(options.readme, tmplConfig, Utils.frep);\r\n    grunt.file.write('README.md', newReadme);\r\n    grunt.log.ok('Created README.md');\r\n\r\n    // Optionally generate a HTML page from the README.\r\n    if(options.html) {\r\n      meta.content = marked(newReadme);\r\n      meta.content = meta.content.replace(/\\{%=/g, '[%=').replace(/%}/g, '%]');\r\n      var layout =  grunt.file.read(options.layout || templates('html/layout.tmpl'));\r\n      var html = Utils.compileTmpl(layout, tmplConfig, Utils.frep);\r\n      grunt.file.write(options.html, html);\r\n    }\r\n\r\n    function makeOptionsObject(prop) {\r\n      if(!_.isUndefined(options[prop])) {\r\n        options[prop] = options[prop] || {};\r\n        grunt.file.expand(options[prop].src).map(function(file) {\r\n          var propSrc = yaml.extract(file).content || '';\r\n          var propDest = path.join(options[prop].dest, name.base(file)) + '.md';\r\n          meta.toc = makeTOC(propSrc);\r\n          var output = Utils.compileTmpl(propSrc, tmplConfig, Utils.frep);\r\n          grunt.file.write(propDest, output);\r\n        });\r\n      }\r\n    }\r\n\r\n    makeOptionsObject('alt');\r\n    makeOptionsObject('test');\r\n\r\n    // Fail task if any errors were logged.\r\n    if (this.errorCount > 0) {return false;}\r\n  });\r\n\r\n  var bind = function(filepath) {\r\n    return path.join.bind(null, filepath, '');\r\n  };\r\n\r\n  // The root of the project. This is where the Gruntfile is.\r\n  var root = function(filepath) {\r\n    return path.join.bind(null, __dirname, '../', filepath);\r\n  };\r\n\r\n};\r\n\r\n"]}