umberto 2.5.0 → 2.5.2

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.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "CKSource Documentation builder",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -47,7 +47,7 @@ module.exports = class AccessorParser extends AbstractParser {
47
47
 
48
48
  scope: this.getScope( item ),
49
49
  readonly: this.isReadonly( item ),
50
- access: this.getVisibility( item ),
50
+ access: this.getVisibilityIncludingSignature( item ),
51
51
  kind: this.getKind( item ),
52
52
  extraId: this.getExtraId( item ),
53
53
  description: this.getComment( getSignature || setSignature ),
@@ -61,4 +61,21 @@ module.exports = class AccessorParser extends AbstractParser {
61
61
  params: null
62
62
  };
63
63
  }
64
+
65
+ /**
66
+ * Returns the access type for the item based on its signatures.
67
+ *
68
+ * @param {TypedocReflection<Accessor>} item
69
+ * @returns {'public'|'internal'|'protected'|'private'}
70
+ */
71
+ getVisibilityIncludingSignature( item ) {
72
+ if ( item.setSignature ) {
73
+ return this.getVisibility( item.setSignature );
74
+ }
75
+
76
+ if ( item.getSignature ) {
77
+ return this.getVisibility( item.getSignature );
78
+ }
79
+ return this.getVisibility( item );
80
+ }
64
81
  };
@@ -339,6 +339,17 @@ function buildProjects( rootPath, projectPaths, options = {} ) {
339
339
  skipGuides: options.skipGuides
340
340
  } );
341
341
 
342
+ if ( !projectConfigs.length ) {
343
+ hexoManager.hexo.extend.filter.register( 'template_locals', locals => {
344
+ // Most probably this if is always true. Locals same for all projects.
345
+ if ( !locals.projectsData ) {
346
+ locals.projectsData = [];
347
+ }
348
+ locals.umbertoVersion = umbertoVersion;
349
+ locals.pathJoin = upath.join;
350
+ } );
351
+ }
352
+
342
353
  projectConfigs.forEach( config => {
343
354
  const basePath = upath.join( config.slug, config.version );
344
355
  const extraStyles = getExtraFiles(
@@ -17,9 +17,6 @@ if ( page[ 'twitter-card' ] || ogConfig.description )
17
17
 
18
18
  meta( name= 'x-generated-at' content= Date() )
19
19
 
20
- if ( projectLocals.projectVersion )
21
- meta( name= 'project-version' content= projectLocals.projectVersion )
22
-
23
20
  if ( mainOg || ( projectLocals && projectLocals.og ) || page[ 'og-description' ] )
24
21
  meta( property='og:title' content= page[ 'og-title' ] || title )
25
22
  if ( ogConfig.description || page[ 'og-description' ] )
@@ -67,3 +64,4 @@ include google-optimize
67
64
  include google-tag-manager
68
65
  include google-analytics
69
66
 
67
+ block projectVersion
@@ -17,3 +17,8 @@ block navtree
17
17
  block append content
18
18
  if page.reportIssueWidget
19
19
  include _partial/report-issue-widget
20
+
21
+ block projectVersion
22
+ if projectLocals
23
+ meta( name= 'project-version' content= projectLocals.projectVersion )
24
+ meta( name= 'project-slug' content= projectLocals.projectSlug )
@@ -19,3 +19,8 @@ block append content
19
19
 
20
20
  block navtree
21
21
  include _partial/nav-tree
22
+
23
+ block projectVersion
24
+ if projectLocals
25
+ meta( name= 'project-version' content= projectLocals.projectVersion )
26
+ meta( name= 'project-slug' content= projectLocals.projectSlug )
@@ -19,3 +19,8 @@ block navtree
19
19
  nav.side-navigation__inner
20
20
  ul.tree.sdk-tree
21
21
  != projectLocals.sdkNavTree
22
+
23
+ block projectVersion
24
+ if projectLocals
25
+ meta( name= 'project-version' content= projectLocals.projectVersion )
26
+ meta( name= 'project-slug' content= projectLocals.projectSlug )
@@ -3,16 +3,16 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
- const latestRegexp = /(?<=\/)latest(?=\/)/;
7
-
8
6
  export default function attachPermalinkListener() {
9
7
  const projectVersionElement = document.querySelector( 'meta[name=project-version]' );
8
+ const projectSlugElement = document.querySelector( 'meta[name=project-slug]' );
10
9
 
11
- if ( !projectVersionElement ) {
10
+ if ( !projectVersionElement || !projectSlugElement ) {
12
11
  return;
13
12
  }
14
13
 
15
14
  const projectVersion = projectVersionElement.getAttribute( 'content' );
15
+ const projectSlug = projectSlugElement.getAttribute( 'content' );
16
16
 
17
17
  document.addEventListener( 'keypress', event => {
18
18
  if ( event.metaKey ) {
@@ -27,11 +27,13 @@ export default function attachPermalinkListener() {
27
27
  return;
28
28
  }
29
29
 
30
+ const latestRegexp = new RegExp( `/${ projectSlug }/latest/` );
31
+
30
32
  if ( !latestRegexp.test( location.href ) ) {
31
33
  return;
32
34
  }
33
35
 
34
- const newUrl = location.href.replace( latestRegexp, projectVersion );
36
+ const newUrl = location.href.replace( latestRegexp, `/${ projectSlug }/${ projectVersion }/` );
35
37
 
36
38
  history.replaceState( history.state, document.title, newUrl );
37
39
  } );