File tree Expand file tree Collapse file tree 4 files changed +74
-2
lines changed
Expand file tree Collapse file tree 4 files changed +74
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ module.exports = function(config) {
1010
1111 config . append ( 'processing.processors' , [
1212 require ( './processors/git-data' ) ,
13+ require ( './processors/error-docs' ) ,
1314 require ( './processors/keywords' ) ,
1415 require ( './processors/versions-data' ) ,
1516 require ( './processors/pages-data' ) ,
Original file line number Diff line number Diff line change 1+ var _ = require ( 'lodash' ) ;
2+ var log = require ( 'winston' ) ;
3+ var path = require ( 'canonical-path' ) ;
4+
5+ module . exports = {
6+ name : 'error-docs' ,
7+ description : 'Compute the various fields for docs in the Error area' ,
8+ runAfter : [ 'tags-extracted' ] ,
9+ init : function ( config , injectables ) {
10+ injectables . value ( 'errorNamespaces' , { } ) ;
11+ } ,
12+ process : function ( docs , partialNames , errorNamespaces ) {
13+
14+ // Create error namespace docs and attach error docs to each
15+ _ . forEach ( docs , function ( doc ) {
16+ if ( doc . docType === 'error' ) {
17+
18+ var namespaceDoc = errorNamespaces [ doc . namespace ] ;
19+ if ( ! namespaceDoc ) {
20+ // First time we came across this namespace, so create a new one
21+ namespaceDoc = errorNamespaces [ doc . namespace ] = {
22+ area : doc . area ,
23+ name : doc . namespace ,
24+ errors : [ ] ,
25+ path : path . dirname ( doc . path ) ,
26+ outputPath : path . dirname ( doc . outputPath ) + '.html' ,
27+ docType : 'errorNamespace'
28+ } ;
29+ }
30+
31+ // Add this error to the namespace
32+ namespaceDoc . errors . push ( doc ) ;
33+ doc . namespace = namespaceDoc ;
34+
35+ }
36+
37+ } ) ;
38+
39+
40+ return docs . concat ( _ . values ( errorNamespaces ) ) ;
41+ }
42+ } ;
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ var navGroupMappers = {
103103 return {
104104 name : page . name ,
105105 href : page . path ,
106- type : 'error'
106+ type : page . docType === 'errorNamespace' ? 'section' : 'error'
107107 } ;
108108 } ) ] ;
109109 } ,
@@ -142,7 +142,8 @@ module.exports = {
142142
143143 // We are only interested in docs that are in a area and not landing pages
144144 var navPages = _ . filter ( docs , function ( page ) {
145- return page . area && page . docType != 'componentGroup' ;
145+ return page . area &&
146+ page . docType != 'componentGroup' ;
146147 } ) ;
147148
148149 // Generate an object collection of pages that is grouped by area e.g.
Original file line number Diff line number Diff line change 1+ {% extends 'base.template.html' %}
2+
3+ {% block content %}
4+ < h1 > {$ doc.name $}</ h1 >
5+
6+ < div class ="description ">
7+ Here are the list of errors in the {$ doc.name $} namespace.
8+
9+ </ div >
10+
11+ < div class ="component-breakdown ">
12+ < div >
13+ < table class ="definition-table ">
14+ < tr >
15+ < th > Name</ th >
16+ < th > Description</ th >
17+ </ tr >
18+ {% for errorDoc in doc.errors -%}
19+ < tr >
20+ < td > < a href ="{$ errorDoc.path $} "> {$ errorDoc.name $}</ td >
21+ < td > {$ errorDoc.fullName $}</ td >
22+ </ tr >
23+ {% endfor %}
24+ </ table >
25+ </ div >
26+ </ div >
27+
28+ {% endblock %}
You can’t perform that action at this time.
0 commit comments