@antora/content-classifier 3.0.0-beta.3 → 3.0.0-rc.1

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.
@@ -64,10 +64,10 @@ function allocateSrc (file, component, version, nav) {
64
64
  let familyFolder = pathSegments[2]
65
65
  switch (familyFolder) {
66
66
  case 'pages':
67
- // this location for partials is deprecated; warn starting in Antora 3.x
67
+ // pages/_partials location for partials is @deprecated; special designation scheduled to be removed in Antora 4
68
68
  if (pathSegments[3] === '_partials') {
69
69
  file.src.family = 'partial'
70
- // relative to modules/<module>/pages/_partials (deprecated)
70
+ // relative to modules/<module>/pages/_partials
71
71
  file.src.relative = pathSegments.slice(4).join('/')
72
72
  } else if (extname === '.adoc') {
73
73
  file.src.family = 'page'
@@ -268,8 +268,12 @@ class ContentCatalog {
268
268
  (startPageSrc = startPage.src).component === name &&
269
269
  startPageSrc.version === version
270
270
  ) {
271
- if ((startPageSrc.module !== 'ROOT' || startPageSrc.relative !== 'index.adoc') && !this.getById(indexPageId)) {
272
- this.addFile({ src: Object.assign({}, indexPageId, { family: 'alias' }), rel: startPage })
271
+ if (!this.getById(indexPageId)) {
272
+ const indexAliasId = Object.assign({}, ROOT_INDEX_ALIAS_ID, { component: name, version })
273
+ const indexAlias = this.getById(indexAliasId)
274
+ indexAlias
275
+ ? indexAlias.synthetic && Object.assign(indexAlias, { rel: startPage })
276
+ : this.addFile({ src: indexAliasId, rel: startPage, synthetic: true })
273
277
  }
274
278
  } else {
275
279
  // TODO pass componentVersion as logObject
@@ -312,7 +316,9 @@ class ContentCatalog {
312
316
  if (!startPageSpec) return
313
317
  const rel = this.resolvePage(startPageSpec)
314
318
  if (rel) {
315
- if (!(this.getSiteStartPage() || { synthetic: true }).synthetic) return
319
+ if (this.getById(ROOT_INDEX_PAGE_ID)) return
320
+ const indexAlias = this.getById(ROOT_INDEX_ALIAS_ID)
321
+ if (indexAlias) return indexAlias.synthetic ? Object.assign(indexAlias, { rel }) : undefined
316
322
  return this.addFile({ src: Object.assign({}, ROOT_INDEX_ALIAS_ID), rel, synthetic: true })
317
323
  } else if (rel === false) {
318
324
  logger.warn('Start page specified for site has invalid syntax: %s', startPageSpec)
@@ -325,7 +331,7 @@ class ContentCatalog {
325
331
 
326
332
  // QUESTION should this be addPageAlias?
327
333
  registerPageAlias (spec, target) {
328
- // .adoc file extension will be required on ID spec for page alias starting in Antora 4 (possibly in Antora 3)
334
+ // adding .adoc file extension to page alias if missing is @deprecated; scheduled to be removed in Antora 4
329
335
  const inferredSpec = spec.endsWith('.adoc') ? undefined : spec + '.adoc'
330
336
  const src = parseResourceId(inferredSpec || spec, target.src, 'page', ['page'])
331
337
  // QUESTION should we throw an error if alias is invalid?
@@ -519,9 +525,9 @@ function computePub (src, out, family, version, htmlUrlExtensionStyle) {
519
525
  }
520
526
 
521
527
  function computeVersionSegment (name, version, mode) {
528
+ // special designation for master verson is @deprecated; special designation scheduled to be removed in Antora 4
522
529
  if (mode === 'original') return !version || version === 'master' ? '' : version
523
530
  const strategy = this.latestVersionUrlSegmentStrategy
524
- // NOTE: special exception; revisit in Antora 3
525
531
  if (!version || version === 'master') {
526
532
  if (mode !== 'alias') return ''
527
533
  if (strategy === 'redirect:to') return
@@ -565,15 +571,9 @@ function createSymbolicVersionAlias (component, version, symbolicVersionSegment,
565
571
  family
566
572
  ),
567
573
  }
568
- if (strategy === 'redirect:to') {
569
- originalVersionAlias.out = undefined
570
- originalVersionAlias.rel = symbolicVersionAlias
571
- return originalVersionAlias
572
- } else {
573
- symbolicVersionAlias.out = undefined
574
- symbolicVersionAlias.rel = originalVersionAlias
575
- return symbolicVersionAlias
576
- }
574
+ return strategy === 'redirect:to'
575
+ ? Object.assign(originalVersionAlias, { out: undefined, rel: symbolicVersionAlias })
576
+ : Object.assign(symbolicVersionAlias, { out: undefined, rel: originalVersionAlias })
577
577
  }
578
578
 
579
579
  function getFileLocation ({ path: path_, src: { abspath, origin } }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/content-classifier",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-rc.1",
4
4
  "description": "Organizes aggregated content into a virtual file catalog for use in an Antora documentation pipeline.",
5
5
  "license": "MPL-2.0",
6
6
  "author": "OpenDevise Inc. (https://opendevise.com)",
@@ -15,8 +15,11 @@
15
15
  "url": "https://gitlab.com/antora/antora/issues"
16
16
  },
17
17
  "main": "lib/index.js",
18
+ "scripts": {
19
+ "test": "_mocha"
20
+ },
18
21
  "dependencies": {
19
- "@antora/logger": "3.0.0-beta.3",
22
+ "@antora/logger": "3.0.0-rc.1",
20
23
  "mime-types": "~2.1",
21
24
  "vinyl": "~2.2"
22
25
  },
@@ -34,5 +37,5 @@
34
37
  "static site",
35
38
  "web publishing"
36
39
  ],
37
- "gitHead": "45da95a2e2dea538379d2d9f42013d2208fb86c3"
40
+ "gitHead": "044371a33e2c0fed9724d30945bbb549d64845d5"
38
41
  }