File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,22 @@ const getSample = (path) => {
3939const getSamples = ( ) => {
4040 const samples = [ ] ;
4141
42+ const getCategoriesFromDemo = ( demo ) => {
43+ const categories = [ ] ;
44+ demo . details . categories ?. forEach ( cat => {
45+ if ( typeof cat === 'string' ) {
46+ categories . push ( cat ) ;
47+ }
48+ if ( typeof cat === 'object' ) {
49+ categories . push . apply (
50+ categories ,
51+ Object . keys ( cat )
52+ ) ;
53+ }
54+ } ) ;
55+ return categories ;
56+ } ;
57+
4258 [
4359 'highcharts' ,
4460 'stock' ,
@@ -90,11 +106,23 @@ const getSamples = () => {
90106 const demoConfigGroup = Object . values ( demoConfig . default ) . find (
91107 config => (
92108 config . path === `/${ group } /` ||
93- config . path === '/' && group === 'highcharts'
109+ ( config . path === '/' && group === 'highcharts' )
94110 )
95111 ) ;
96112
97- demoConfigGroup ?. categories ?. forEach ( category => {
113+ // Get the unique list of categories from the demos
114+ const categories = demoConfigGroup ?. categories || [ ] ;
115+
116+ // Include also categories that may not be in the demoConfig
117+ demos . forEach ( demo => {
118+ getCategoriesFromDemo ( demo ) . forEach ( cat => {
119+ if ( ! categories . includes ( cat ) ) {
120+ categories . push ( cat ) ;
121+ }
122+ } ) ;
123+ } ) ;
124+
125+ categories . forEach ( category => {
98126 const demosInCategory = [ ] ;
99127
100128 for ( let demo of demos ) {
You can’t perform that action at this time.
0 commit comments