diff options
| author | Peter Bacon Darwin | 2014-02-12 22:47:42 +0000 | 
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-16 19:03:41 +0000 | 
| commit | 389d4879da4aa620ee95d789b19ff9be44eb730a (patch) | |
| tree | 93352ddc8738a975904a1774d51b93d585ca1075 /docs/config/processors/versions-data.js | |
| parent | a564160511bf1bbed5a4fe5d2981fae1bb664eca (diff) | |
| download | angular.js-389d4879da4aa620ee95d789b19ff9be44eb730a.tar.bz2 | |
chore(doc-gen): new docs
chore(doc-gen): implement dgeni
Diffstat (limited to 'docs/config/processors/versions-data.js')
| -rw-r--r-- | docs/config/processors/versions-data.js | 42 | 
1 files changed, 42 insertions, 0 deletions
| diff --git a/docs/config/processors/versions-data.js b/docs/config/processors/versions-data.js new file mode 100644 index 00000000..eb158e79 --- /dev/null +++ b/docs/config/processors/versions-data.js @@ -0,0 +1,42 @@ +var _ = require('lodash'); + +var version; +var versions; + +module.exports = { +  name: 'versions-data', +  description: 'This plugin will create a new doc that will be rendered as an angularjs module ' + +               'which will contain meta information about the versions of angular', +  runAfter: ['adding-extra-docs', 'pages-data'], +  runBefore: ['extra-docs-added'], +  init: function(config) { +    version = config.source.currentVersion; +    versions = config.source.previousVersions; + +    if ( !version ) { +      throw new Error('Invalid configuration.  Please provide a valid `source.currentVersion` property'); +    } +    if ( !versions ) { +      throw new Error('Invalid configuration.  Please provide a valid `source.previousVersions` property'); +    } +  }, +  process: function(docs) { + +    var versionDoc = { +      docType: 'versions-data', +      id: 'versions-data', +      template: 'versions-data.template.js', +      outputPath: 'js/versions-data.js', +    }; + +    versionDoc.currentVersion = version; + +    versionDoc.versions = _(versions) +      .filter(function(version) { return version.major > 0; }) +      .push(version) +      .reverse() +      .value(); + +    docs.push(versionDoc); +  } +};
\ No newline at end of file | 
