@baiyibai-antora/adf-extension 1.0.0-beta.2 → 1.0.0-beta.4

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.
@@ -66,6 +66,14 @@ module.exports = async function convertPages ({
66
66
  const outputDir = ospath.resolve(playbook.dir || '.', config.outputDir || path.join('build', 'adf'))
67
67
  const included = buildVersionFilter(contentCatalog, config)
68
68
 
69
+ // Confluence requires unique page titles per space; the publisher suffixes
70
+ // collisions using this strategy ("parent" or "filename").
71
+ let titleConflicts = config.titleConflicts || 'parent'
72
+ if (!['parent', 'filename'].includes(titleConflicts)) {
73
+ logger.warn(`unknown title_conflicts value "${titleConflicts}"; using "parent" (expected parent or filename)`)
74
+ titleConflicts = 'parent'
75
+ }
76
+
69
77
  const asciidocConfigs = new Map()
70
78
  for (const component of contentCatalog.getComponents()) {
71
79
  for (const { version, asciidoc } of component.versions) {
@@ -229,7 +237,7 @@ module.exports = async function convertPages ({
229
237
  // The manifest itself is written by finalizeManifest (on beforePublish), so
230
238
  // assembler-produced exports (family "export") are collected regardless of
231
239
  // extension registration order.
232
- return { outputDir, manifestPages, nav, included }
240
+ return { outputDir, manifestPages, nav, included, titleConflicts }
233
241
  }
234
242
 
235
243
  // Component/version scoping: `components` limits to the listed component
@@ -263,7 +271,7 @@ function globToRx (pattern) {
263
271
  * final manifest.json.
264
272
  */
265
273
  async function finalizeManifest ({ playbook, contentCatalog, state, logger }) {
266
- const { outputDir, manifestPages, nav, included } = state
274
+ const { outputDir, manifestPages, nav, included, titleConflicts } = state
267
275
  const exports_ = []
268
276
  for (const file of contentCatalog.getFiles()) {
269
277
  if (!file.src || file.src.family !== 'export' || !file.out || !file.contents) continue
@@ -294,6 +302,7 @@ async function finalizeManifest ({ playbook, contentCatalog, state, logger }) {
294
302
  const manifest = {
295
303
  version: 1,
296
304
  site: { title: playbook.site.title || null, url: playbook.site.url || null },
305
+ titleConflicts,
297
306
  pages: manifestPages,
298
307
  nav,
299
308
  exports: exports_,
@@ -13,6 +13,9 @@ const yaml = require('js-yaml')
13
13
  // versions: latest # Antora catalog, so includes and xrefs resolve —
14
14
  // components: [docs] # links to nav-excluded pages fall back to the
15
15
  // output_dir: ./build/adf # static site url. `exclude` is an alias.
16
+ // title_conflicts: parent # or filename — how colliding page titles are
17
+ // # suffixed (Confluence requires unique titles
18
+ // # per space)
16
19
  //
17
20
  // Keys given directly on the extension entry in the playbook win.
18
21
 
@@ -38,6 +41,7 @@ function loadConfig (playbook, config, logger) {
38
41
  if (fileConfig.orphans) normalized.orphans = fileConfig.orphans
39
42
  if (fileConfig.components) normalized.components = fileConfig.components
40
43
  if (fileConfig.output_dir) normalized.outputDir = fileConfig.output_dir
44
+ if (fileConfig.title_conflicts) normalized.titleConflicts = fileConfig.title_conflicts
41
45
  logger.info(`loaded confluence config from ${configPath}`)
42
46
  return { ...normalized, ...config }
43
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baiyibai-antora/adf-extension",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "Antora extension that emits Confluence ADF JSON and a publish manifest for every page during a site build",
5
5
  "license": "MIT",
6
6
  "author": "baiyibai",