@antora/page-composer
Advanced tools
Comparing version 3.0.0-beta.4 to 3.0.0-beta.5
@@ -66,20 +66,20 @@ 'use strict' | ||
const src = file.src | ||
if (src.stem === '404' && !src.component) return { layout: '404', title: file.title } | ||
const { component: component_, version, module: module_, relative: relativeSrcPath, origin, editUrl, fileUri } = src | ||
// QUESTION should attributes be scoped to AsciiDoc, or should this work regardless of markup language? file.data? | ||
const asciidoc = file.asciidoc || {} | ||
const attributes = asciidoc.attributes || {} | ||
const pageAttributes = Object.entries(attributes).reduce((accum, [name, val]) => { | ||
if (name.startsWith('page-')) accum[name.substr(5)] = val | ||
return accum | ||
}, {}) | ||
const pageAttributes = {} | ||
Object.entries(attributes).forEach(([name, val]) => { | ||
if (name.startsWith('page-')) pageAttributes[name.substr(5)] = val | ||
}) | ||
if (src.stem === '404' && !('component' in src)) { | ||
return { 404: true, attributes: pageAttributes, layout: '404', title: file.title } | ||
} | ||
const url = file.pub.url | ||
const { component: component_, version, module: module_, relative: relativeSrcPath, origin, editUrl, fileUri } = src | ||
const component = contentCatalog.getComponent(component_) | ||
const componentVersion = contentCatalog.getComponentVersion(component, version) | ||
const title = file.title || asciidoc.doctitle | ||
const url = file.pub.url | ||
// QUESTION can we cache versions on file.rel so only computed once per page version lineage? | ||
const versions = component.versions.length > 1 ? getPageVersions(file, component, contentCatalog) : undefined | ||
const title = file.title || asciidoc.doctitle | ||
const model = { | ||
@@ -105,7 +105,5 @@ contents: file.contents, | ||
fileUri, | ||
home: url === siteUiModel.homeUrl, | ||
} | ||
if (url === siteUiModel.homeUrl) model.home = true | ||
if (navigationCatalog) attachNavProperties(model, url, title, navigationCatalog.getNavigation(component_, version)) | ||
if (versions) { | ||
@@ -118,3 +116,2 @@ Object.defineProperty(model, 'latest', { | ||
} | ||
// NOTE site URL has already been normalized at this point | ||
@@ -121,0 +118,0 @@ const siteUrl = siteUiModel.url |
@@ -45,3 +45,14 @@ 'use strict' | ||
) | ||
return createPageComposerInternal(buildBaseUiModel(playbook, contentCatalog), layouts) | ||
const composePage = createPageComposerInternal(buildBaseUiModel(playbook, contentCatalog), layouts) | ||
const create404Page = (siteAsciiDocConfig) => { | ||
return composePage({ | ||
asciidoc: siteAsciiDocConfig, | ||
mediaType: 'text/html', | ||
out: { path: '404.html' }, | ||
pub: {}, | ||
src: { stem: '404' }, | ||
title: (siteAsciiDocConfig && siteAsciiDocConfig.attributes['404-page-title']) || 'Page Not Found', | ||
}) | ||
} | ||
return Object.assign(composePage, { composePage, create404Page }) | ||
} | ||
@@ -48,0 +59,0 @@ |
{ | ||
"name": "@antora/page-composer", | ||
"version": "3.0.0-beta.4", | ||
"version": "3.0.0-beta.5", | ||
"description": "Wraps the embeddable HTML contents of each page file from the content catalog in a page layout to yield standalone pages in an Antora documentation pipeline.", | ||
@@ -18,3 +18,3 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/logger": "3.0.0-beta.4", | ||
"@antora/logger": "3.0.0-beta.5", | ||
"handlebars": "~4.7", | ||
@@ -38,4 +38,3 @@ "require-from-string": "~2.0" | ||
], | ||
"gitHead": "8a142499e9f1a9e0631777796e06dd6c010d3a90", | ||
"readmeFilename": "README.md" | ||
"gitHead": "a13d03df41654d4deb78211a5a54953ce2a35fb8" | ||
} |
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
36798
436
+ Added@antora/logger@3.0.0-beta.5(transitive)
+ Addedpino@7.5.1(transitive)
+ Addedsonic-boom@2.4.2(transitive)
- Removed@antora/logger@3.0.0-beta.4(transitive)
- Removedpino@7.4.1(transitive)
- Removedsonic-boom@2.3.2(transitive)
Updated@antora/logger@3.0.0-beta.5