@antora/asciidoc-loader
Advanced tools
Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5
@@ -15,3 +15,3 @@ 'use strict' | ||
* | ||
* * If a component is specified, but not a version, the version defaults to master. | ||
* * If a component is specified, but not a version, the version remains undefined. | ||
* * If a component is specified, but not a module, the module defaults to ROOT. | ||
@@ -35,19 +35,15 @@ * | ||
let relative = match[PAGE_ID_RXG.page] + '.adoc' | ||
const family = 'page' | ||
if (component) { | ||
// if a component is specified, but not a version, assume version is "master" | ||
if (!version) version = 'master' | ||
// if a component is specified, but not a module, assume module is "ROOT" | ||
if (!module) module = 'ROOT' | ||
} else { | ||
component = ctx.component | ||
if (!version) version = ctx.version | ||
if (!module) module = ctx.module | ||
} | ||
return { | ||
component: component || ctx.component, | ||
version: version || ctx.version, | ||
module: module || ctx.module, | ||
family: 'page', | ||
relative, | ||
} | ||
return { component, version, module, family, relative } | ||
} | ||
module.exports = parsePageId |
@@ -9,5 +9,7 @@ 'use strict' | ||
* Parses the specified contextual page ID spec into a page ID object using | ||
* parsePageId, then attempts to locate a file with this page ID in the catalog. | ||
* If a file cannot be resolved, the function returns undefined. If the spec | ||
* does not match the page ID syntax, this function throws an error. | ||
* parsePageId, then attempts to locate a file with this page ID in the | ||
* catalog. If a component is specified, but not a version, the latest version | ||
* of the component is used from the catalog. If a file cannot be resolved, the | ||
* function returns undefined. If the spec does not match the page ID syntax, | ||
* this function throws an error. | ||
* | ||
@@ -29,2 +31,7 @@ * @memberof asciidoc-loader | ||
if (!id.version) { | ||
const component = catalog.getComponent(id.component) | ||
if (component) id.version = component.latestVersion.version | ||
} | ||
return catalog.getById(id) | ||
@@ -31,0 +38,0 @@ } |
{ | ||
"name": "@antora/asciidoc-loader", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0-alpha.5", | ||
"description": "Loads AsciiDoc content into an Asciidoctor Document object (AST) for use in an Antora documentation pipeline.", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
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
22176
505