@antora/content-classifier
Advanced tools
Comparing version 3.0.0-alpha.2 to 3.0.0-alpha.3
@@ -57,3 +57,3 @@ 'use strict' | ||
const { asciidoc, displayVersion, prerelease, startPage: startPageSpec, title } = descriptor | ||
const componentVersion = { displayVersion: displayVersion || version, title: title || name, version } | ||
const componentVersion = { displayVersion: displayVersion || version || 'default', title: title || name, version } | ||
Object.defineProperty(componentVersion, 'name', { value: name, enumerable: true }) | ||
@@ -63,5 +63,8 @@ if (prerelease) { | ||
if (!displayVersion && (typeof prerelease === 'string' || prerelease instanceof String)) { | ||
const ch0 = prerelease.charAt() | ||
const sep = ch0 === '-' || ch0 === '.' ? '' : ' ' | ||
componentVersion.displayVersion = `${version}${sep}${prerelease}` | ||
if (version) { | ||
const ch0 = prerelease.charAt() | ||
componentVersion.displayVersion = `${version}${ch0 === '-' || ch0 === '.' ? '' : ' '}${prerelease}` | ||
} else { | ||
componentVersion.displayVersion = prerelease | ||
} | ||
} | ||
@@ -313,3 +316,3 @@ } | ||
// NOTE version is not set when alias specifies a component, but not a version | ||
if (!src.version) src.version = component.latest.version | ||
if (src.version == null) src.version = component.latest.version | ||
const existingPage = this.getById(src) | ||
@@ -333,5 +336,5 @@ if (existingPage) { | ||
} | ||
} else if (!src.version) { | ||
} else if (src.version == null) { | ||
// QUESTION should we skip registering alias in this case? | ||
src.version = 'master' | ||
src.version = '' | ||
} | ||
@@ -497,6 +500,6 @@ src.family = 'alias' | ||
function computeVersionSegment (name, version, mode) { | ||
if (mode === 'original') return version === 'master' ? '' : version | ||
if (mode === 'original') return !version || version === 'master' ? '' : version | ||
const strategy = this.latestVersionUrlSegmentStrategy | ||
// NOTE: special exception; revisit in Antora 3 | ||
if (version === 'master') { | ||
if (!version || version === 'master') { | ||
if (mode !== 'alias') return '' | ||
@@ -503,0 +506,0 @@ if (strategy === 'redirect:to') return |
@@ -42,2 +42,4 @@ 'use strict' | ||
if (version === '_') version = '' | ||
if (component) { | ||
@@ -47,3 +49,3 @@ if (!module_) module_ = 'ROOT' | ||
component = ctx.component | ||
if (!version) version = ctx.version | ||
if (version == null) version = ctx.version | ||
if (!module_) module_ = ctx.module | ||
@@ -50,0 +52,0 @@ } |
@@ -31,3 +31,3 @@ 'use strict' | ||
if (!id || !id.family) return false | ||
if (!id.version) { | ||
if (id.version == null) { | ||
const component = catalog.getComponent(id.component) | ||
@@ -34,0 +34,0 @@ if (!component) return |
@@ -24,9 +24,12 @@ 'use strict' | ||
if (a === b) return 0 | ||
const semverA = resolveSemver(a) | ||
const semverB = resolveSemver(b) | ||
if (semverA) { | ||
return semverB ? -semverCompare(semverA, semverB) : 1 | ||
} else { | ||
return semverB ? -1 : -a.localeCompare(b, 'en', { numeric: true }) | ||
if (a && b) { | ||
const semverA = resolveSemver(a) | ||
const semverB = resolveSemver(b) | ||
if (semverA) { | ||
return semverB ? -semverCompare(semverA, semverB) : 1 | ||
} else { | ||
return semverB ? -1 : -a.localeCompare(b, 'en', { numeric: true }) | ||
} | ||
} | ||
return a ? 1 : -1 | ||
} | ||
@@ -33,0 +36,0 @@ |
{ | ||
"name": "@antora/content-classifier", | ||
"version": "3.0.0-alpha.2", | ||
"version": "3.0.0-alpha.3", | ||
"description": "Organizes aggregated content into a virtual file catalog for use in an Antora documentation pipeline.", | ||
@@ -36,3 +36,3 @@ "license": "MPL-2.0", | ||
], | ||
"gitHead": "997231474334311f3e5ff55d68534f5ae6e5d7ee" | ||
"gitHead": "2f02cf0d42fb5db4607ea5e600ca8a4ab45d5a5f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55316
889