diff options
| author | Di Peng | 2011-08-20 08:51:00 -0700 | 
|---|---|---|
| committer | Igor Minar | 2011-08-24 15:03:09 -0700 | 
| commit | 19401280aed9d4767faddcf58fab91ec13c556a9 (patch) | |
| tree | e3b3d6a45224077f8554d22953a8319f1faf194f /docs/src/writer.js | |
| parent | 08a33e7bb377a4d47917dbf5fabbe59b562f1e04 (diff) | |
| download | angular.js-19401280aed9d4767faddcf58fab91ec13c556a9.tar.bz2 | |
feat(doc): generate both normal and debug version of index.html
- index.html has manifest file and angular.min.js
- index-jq.html has manifest file, angular.min.js and jquery.min.js
- index-debug.html has angular.js
- index-jq-debug.html has angular.js and jquery.min.js
Diffstat (limited to 'docs/src/writer.js')
| -rw-r--r-- | docs/src/writer.js | 29 | 
1 files changed, 24 insertions, 5 deletions
| diff --git a/docs/src/writer.js b/docs/src/writer.js index b33e4164..5aa8f566 100644 --- a/docs/src/writer.js +++ b/docs/src/writer.js @@ -44,16 +44,35 @@ exports.copyTpl = function(filename) {    return exports.copy('docs/src/templates/' + filename, OUTPUT_DIR + filename);  }; -exports.copy = function (from, to, replacementKey, replacement) { -  // Have to use rb (read binary), char 'r' is infered by library. -  return qfs.read(from,'b').then(function(content) { -    if(replacementKey && replacement) { -      content = content.toString().replace(replacementKey, replacement); +/* Copy files from one place to another. + * @param from{string} path of the source file to be copied + * @param to{string} path of where the copied file should be stored + * @param  transform{function=} transfromation function to be applied before return + */ +exports.copy = function(from, to, transform) { +  var args = Array.prototype.slice.call(arguments, 3); + +  // We have to use binary reading, Since some characters are unicode. +  return qfs.read(from, 'b').then(function(content) { +    if (transform) { +      args.unshift(content.toString()); +      content = transform.apply(null, args);      }      qfs.write(to, content);    });  } +/* Replace placeholders in content accordingly + * @param content{string} content to be modified + * @param replacements{obj} key and value pairs in which key will be replaced with value in content + */ +exports.replace = function(content, replacements) { +  for(key in replacements) { +    content = content.replace(key, replacements[key]); +  } +  return content; +} +  exports.copyDir = function copyDir(dir) {    return qfs.listDirectoryTree('docs/' + dir).then(function(dirs) {      var done; | 
