1- const getTagsByName = ( tags , ...names ) => tags . filter ( ( tag ) => names . some ( ( name ) => name === tag . title ) ) ;
1+ /**
2+ * Internal dependencies
3+ */
4+ const getSymbolTagsByName = require ( '../get-symbol-tags-by-name' ) ;
25
36const cleanSpaces = ( paragraph ) =>
47 paragraph ?
@@ -57,7 +60,7 @@ const getSymbolHeading = ( text ) => {
5760} ;
5861
5962module . exports = function ( rootDir , docPath , symbols , headingTitle , headingStartIndex ) {
60- const docs = [ ] ;
63+ const docs = [ ] ;
6164 let headingIndex = headingStartIndex || 1 ;
6265 if ( headingTitle ) {
6366 docs . push ( getHeading ( headingIndex , `${ headingTitle } ` ) ) ;
@@ -79,30 +82,30 @@ module.exports = function( rootDir, docPath, symbols, headingTitle, headingStart
7982 if ( symbols && symbols . length > 0 ) {
8083 symbols . forEach ( ( symbol ) => {
8184 docs . push ( getSymbolHeading ( symbol . name ) ) ;
82- formatDeprecated ( getTagsByName ( symbol . tags , 'deprecated' ) , docs ) ;
85+ formatDeprecated ( getSymbolTagsByName ( symbol , 'deprecated' ) , docs ) ;
8386 formatDescription ( symbol . description , docs ) ;
8487 formatTag (
8588 'Related' ,
86- getTagsByName ( symbol . tags , 'see' , 'link' ) ,
89+ getSymbolTagsByName ( symbol , 'see' , 'link' ) ,
8790 ( tag ) => `\n- ${ tag . description } ` ,
8891 docs
8992 ) ;
90- formatExamples ( getTagsByName ( symbol . tags , 'example' ) , docs ) ;
93+ formatExamples ( getSymbolTagsByName ( symbol , 'example' ) , docs ) ;
9194 formatTag (
9295 'Type' ,
93- getTagsByName ( symbol . tags , 'type' ) ,
96+ getSymbolTagsByName ( symbol , 'type' ) ,
9497 ( tag ) => `\n- \`${ tag . type } \` ${ cleanSpaces ( tag . description ) } ` ,
9598 docs
9699 ) ;
97100 formatTag (
98101 'Parameters' ,
99- getTagsByName ( symbol . tags , 'param' ) ,
102+ getSymbolTagsByName ( symbol , 'param' ) ,
100103 ( tag ) => `\n- *${ tag . name } * \`${ tag . type } \`: ${ cleanSpaces ( tag . description ) } ` ,
101104 docs
102105 ) ;
103106 formatTag (
104107 'Returns' ,
105- getTagsByName ( symbol . tags , 'return' ) ,
108+ getSymbolTagsByName ( symbol , 'return' ) ,
106109 ( tag ) => `\n- \`${ tag . type } \`: ${ cleanSpaces ( tag . description ) } ` ,
107110 docs
108111 ) ;
0 commit comments