Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antora/page-composer

Package Overview
Dependencies
Maintainers
2
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/page-composer - npm Package Compare versions

Comparing version 2.3.0 to 2.3.1

50

lib/build-ui-model.js

@@ -106,5 +106,3 @@ 'use strict'

if (navigationCatalog) {
attachNavProperties(model, url, title, navigationCatalog.getNavigation(component_, version))
}
if (navigationCatalog) attachNavProperties(model, url, title, navigationCatalog.getNavigation(component_, version))

@@ -156,16 +154,26 @@ if (versions) {

function attachNavProperties (model, url, title, navigation = []) {
function attachNavProperties (model, currentUrl, title, navigation = []) {
if (!(model.navigation = navigation).length) return
const { current, ancestors, previous, next } = findNavItem({ url, ancestors: [], seekNext: true }, navigation)
if (current) {
const startPageUrl = model.componentVersion.url
const { match, ancestors, previous, next } = findNavItem({ ancestors: [], seekNext: true, currentUrl }, navigation)
if (match) {
// QUESTION should we filter out component start page from the breadcrumbs?
const breadcrumbs = ancestors.filter((item) => 'content' in item)
const parent = breadcrumbs.find((item) => item.urlType === 'internal')
breadcrumbs.reverse().push(current)
breadcrumbs.reverse().push(match)
model.breadcrumbs = breadcrumbs
if (parent) model.parent = parent
if (previous) model.previous = previous
if (previous) {
model.previous = previous
} else if (currentUrl !== startPageUrl) {
model.previous = { content: model.componentVersion.title, url: startPageUrl, urlType: 'internal', discrete: true }
}
if (next) model.next = next
} else if (title) {
model.breadcrumbs = [{ content: title, url, urlType: 'internal', discrete: true }]
} else {
const orphan = { content: title, url: currentUrl, urlType: 'internal', discrete: true }
if (title) model.breadcrumbs = [orphan]
if (currentUrl === startPageUrl) {
const { next: first } = findNavItem({ ancestors: [], match: orphan, seekNext: true, currentUrl }, navigation)
if (first) model.next = first
}
}

@@ -177,4 +185,4 @@ }

return correlated
} else if (correlated.current) {
if (candidate.urlType === 'internal') {
} else if (correlated.match) {
if (candidate.urlType === 'internal' && !matchesPage(candidate, correlated.currentUrl)) {
correlated.next = candidate

@@ -184,7 +192,6 @@ return correlated

} else if (candidate.urlType === 'internal') {
if (getUrlWithoutHash(candidate) === correlated.url) {
correlated.current = candidate
/* istanbul ignore if */
if (matchesPage(candidate, correlated.currentUrl)) {
correlated.match = candidate
if (!correlated.seekNext) return correlated
} else {
} else if (!(correlated.previous && matchesPage(candidate, correlated.previous.url, correlated.previous.hash))) {
correlated.previous = candidate

@@ -197,7 +204,7 @@ }

correlated = findNavItem(
correlated.current ? correlated : Object.assign({}, correlated, { ancestors: [candidate].concat(ancestors) }),
correlated.match ? correlated : Object.assign({}, correlated, { ancestors: [candidate].concat(ancestors) }),
children,
false
)
if (correlated.current) {
if (correlated.match) {
if (!correlated.seekNext || correlated.next) return correlated

@@ -210,4 +217,3 @@ } else {

correlated = findNavItem(correlated, siblings, root, siblingIdx)
//if (correlated.current && (!correlated.seekNext || correlated.next)) return correlated
} else if (root && !correlated.current) {
} else if (root && !correlated.match) {
delete correlated.previous

@@ -218,6 +224,6 @@ }

function getUrlWithoutHash (item) {
return item.hash ? item.url.substr(0, item.url.length - item.hash.length) : item.url
function matchesPage (candidate, url, hash = undefined) {
return candidate.url === (hash ? url.substr(0, url.length - hash.length) : url) + (candidate.hash || '')
}
module.exports = { buildBaseUiModel, buildSiteUiModel, buildPageUiModel, buildUiModel }
{
"name": "@antora/page-composer",
"version": "2.3.0",
"version": "2.3.1",
"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.",

@@ -36,3 +36,3 @@ "license": "MPL-2.0",

],
"gitHead": "a268deae12211eb89f82ce5cc7d809b97baeb2a2"
"gitHead": "b5c90bd55ba16fc6b293ea76d40452212c6e2a37"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc