aboutsummaryrefslogtreecommitdiffstats
path: root/docs/config/processors/error-docs.js
diff options
context:
space:
mode:
authorPeter Bacon Darwin2014-02-15 20:57:38 +0000
committerPeter Bacon Darwin2014-02-16 19:03:45 +0000
commit0b28de1e550d4811cd7206d2883fde157e500e83 (patch)
treef0b950140143f69fcfe8881d1bb4083b47eb5bd5 /docs/config/processors/error-docs.js
parent84d9a574169e40013f605549074fbf8057466ad5 (diff)
downloadangular.js-0b28de1e550d4811cd7206d2883fde157e500e83.tar.bz2
chore(doc-gen): improve error page navigation
Diffstat (limited to 'docs/config/processors/error-docs.js')
-rw-r--r--docs/config/processors/error-docs.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/config/processors/error-docs.js b/docs/config/processors/error-docs.js
new file mode 100644
index 00000000..80a7b996
--- /dev/null
+++ b/docs/config/processors/error-docs.js
@@ -0,0 +1,42 @@
+var _ = require('lodash');
+var log = require('winston');
+var path = require('canonical-path');
+
+module.exports = {
+ name: 'error-docs',
+ description: 'Compute the various fields for docs in the Error area',
+ runAfter: ['tags-extracted'],
+ init: function(config, injectables) {
+ injectables.value('errorNamespaces', {});
+ },
+ process: function(docs, partialNames, errorNamespaces) {
+
+ // Create error namespace docs and attach error docs to each
+ _.forEach(docs, function(doc) {
+ if ( doc.docType === 'error' ) {
+
+ var namespaceDoc = errorNamespaces[doc.namespace];
+ if ( !namespaceDoc ) {
+ // First time we came across this namespace, so create a new one
+ namespaceDoc = errorNamespaces[doc.namespace] = {
+ area: doc.area,
+ name: doc.namespace,
+ errors: [],
+ path: path.dirname(doc.path),
+ outputPath: path.dirname(doc.outputPath) + '.html',
+ docType: 'errorNamespace'
+ };
+ }
+
+ // Add this error to the namespace
+ namespaceDoc.errors.push(doc);
+ doc.namespace = namespaceDoc;
+
+ }
+
+ });
+
+
+ return docs.concat(_.values(errorNamespaces));
+ }
+}; \ No newline at end of file