umberto 2.1.3 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umberto",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "CKSource Documentation builder",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const findMainCategoryPage = require( '../utils/findmaincategorypage.js' );
9
+
10
+ hexo.extend.helper.register( 'findMainCategoryPage', findMainCategoryPage );
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ /**
9
+ * The function returns a `page` object that represents the main landing page for given category.
10
+ *
11
+ * @param {String} category
12
+ * @param {Object} allPages
13
+ * @param {Array} allPages.data
14
+ * @returns {*}
15
+ */
16
+ module.exports = function findMainCategoryPage( category, allPages ) {
17
+ return allPages.data
18
+ .filter( page => page.category === category )
19
+ .find( page => page.shortName === 'index' );
20
+ };
@@ -271,6 +271,11 @@ function validateCategories( category, uniqueIds ) {
271
271
 
272
272
  uniqueIds.add( category.id );
273
273
 
274
+ // The "navigationIncludeIndex" option is supported only for top-level categories.
275
+ if ( typeof category.navigationIncludeIndex !== 'undefined' ) {
276
+ throw new Error( `The "navigationIncludeIndex" option is supported only for top-level categories. Found in "${ category.id }".` );
277
+ }
278
+
274
279
  // Check nested categories only if the value is an array.
275
280
  if ( !isArray( category.categories ) ) {
276
281
  return;
@@ -33,8 +33,5 @@ block content
33
33
 
34
34
  include _partial/functions
35
35
 
36
- if page.reportIssueWidget
37
- include ../_partial/report-issue-widget
38
-
39
36
  block navtree
40
37
  != navTree
@@ -2,4 +2,9 @@ extends api-base
2
2
  include ./_mixin/_api-title
3
3
 
4
4
  block prepend content
5
- +apiTitle( { iconPath: 'assets/' + umbertoVersion + '/img/cog.svg', kind: 'Class' } )
5
+ +apiTitle( { iconPath: 'assets/' + umbertoVersion + '/img/cog.svg', kind: 'Class' } )
6
+
7
+ //- Make sure to add the report issue widget at the end of the page.
8
+ block append content
9
+ if page.reportIssueWidget
10
+ include ../_partial/report-issue-widget
@@ -3,3 +3,8 @@ include ./_mixin/_api-title
3
3
 
4
4
  block prepend content
5
5
  +apiTitle( { iconPath: 'assets/' + umbertoVersion + '/img/arrows.svg', kind: 'Interface' } )
6
+
7
+ //- Make sure to add the report issue widget at the end of the page.
8
+ block append content
9
+ if page.reportIssueWidget
10
+ include ../_partial/report-issue-widget
@@ -3,3 +3,8 @@ include ./_mixin/_api-title
3
3
 
4
4
  block prepend content
5
5
  +apiTitle( { iconPath: 'assets/' + umbertoVersion + '/img/cog.svg', kind: 'Mixin' } )
6
+
7
+ //- Make sure to add the report issue widget at the end of the page.
8
+ block append content
9
+ if page.reportIssueWidget
10
+ include ../_partial/report-issue-widget
@@ -3,3 +3,8 @@ include ./_mixin/_api-title
3
3
 
4
4
  block prepend content
5
5
  +apiTitle( { iconPath: 'assets/' + umbertoVersion + '/img/box-red.svg', kind: 'Module' } )
6
+
7
+ //- Make sure to add the report issue widget at the end of the page.
8
+ block append content
9
+ if page.reportIssueWidget
10
+ include ../_partial/report-issue-widget
@@ -3,3 +3,8 @@ include ./_mixin/_api-title
3
3
 
4
4
  block prepend content
5
5
  +apiTitle( { iconPath: 'assets/' + umbertoVersion + '/img/box-brown.svg', kind: 'Namespace' } )
6
+
7
+ //- Make sure to add the report issue widget at the end of the page.
8
+ block append content
9
+ if page.reportIssueWidget
10
+ include ../_partial/report-issue-widget
@@ -22,3 +22,8 @@ block append content
22
22
 
23
23
  if isNonEmptyArray( data.see )
24
24
  +related( data.see )
25
+
26
+ //- Make sure to add the report issue widget at the end of the page.
27
+ block append content
28
+ if page.reportIssueWidget
29
+ include ../_partial/report-issue-widget
@@ -11,11 +11,15 @@ mixin navTreeLevel( data, isRoot )
11
11
  - const shouldPrintSubTree = dataArr.filter( item => item.title || item.hasDescendentLeaf ).length || projectLocals.navigationShowEmptyCategories
12
12
 
13
13
  if isRoot
14
+ if data.navigationIncludeIndex
15
+ +navTreeItem( findMainCategoryPage( data.id, site.pages ) )
16
+
14
17
  each item in dataArr
15
18
  if item.name
16
19
  +navTreeLevel( item, false )
17
20
  else
18
21
  +navTreeItem( item )
22
+
19
23
  //- We don't want to display empty categories (#523).
20
24
  else if shouldPrintSubTree
21
25
  li
@@ -9,9 +9,11 @@ block content
9
9
 
10
10
  != split.content
11
11
 
12
- if page.reportIssueWidget
13
- include _partial/report-issue-widget
14
-
15
12
  block navtree
16
13
  if projectLocals && projectLocals.apiTree
17
14
  != projectLocals.apiTree
15
+
16
+ //- Make sure to add the report issue widget at the end of the page.
17
+ block append content
18
+ if page.reportIssueWidget
19
+ include _partial/report-issue-widget
@@ -12,6 +12,8 @@ block content
12
12
 
13
13
  != split.content
14
14
 
15
+ //- Make sure to add the report issue widget at the end of the page.
16
+ block append content
15
17
  if page.reportIssueWidget
16
18
  include _partial/report-issue-widget
17
19