@antora/assembler 1.0.0-beta.10 → 1.0.0-beta.11
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.
package/lib/assemble-content.js
CHANGED
|
@@ -267,10 +267,15 @@ function resolveFileOrContents (convertResult, convertAttributes, buildConfig, l
|
|
|
267
267
|
if (entry.name) ctx.program = entry.name
|
|
268
268
|
if (entry.file?.line) ctx.line = entry.file.line
|
|
269
269
|
logger[entry.level](ctx, entry.msg)
|
|
270
|
-
} else if ((match = /^(
|
|
270
|
+
} else if ((match = /^([^:]+):(\d+): warning: (.+)/.exec(line))) {
|
|
271
271
|
const [, scriptPath, lineno, msg] = match
|
|
272
272
|
ctx.stack = [{ file: { path: scriptPath }, line: parseInt(lineno, 10) }]
|
|
273
273
|
logger.warn(ctx, msg)
|
|
274
|
+
} else if ((match = /^asciidoctor: ([A-Z]+): (?:[^:]+: line (\d+): )?(.+)/.exec(line))) {
|
|
275
|
+
// NOTE we don't care about the filename in the message since it can only be docfile
|
|
276
|
+
const [, level, lineno, msg] = match
|
|
277
|
+
if (lineno) ctx.line = parseInt(lineno, 10)
|
|
278
|
+
logger[level === 'WARNING' ? 'warn' : level.toLowerCase()](ctx, msg)
|
|
274
279
|
} else {
|
|
275
280
|
logger.info(ctx, line)
|
|
276
281
|
}
|
package/lib/load-config.js
CHANGED
|
@@ -78,7 +78,8 @@ function loadConfig (playbook, configSource = './antora-assembler.yml') {
|
|
|
78
78
|
throw new Error('Not implemented')
|
|
79
79
|
}
|
|
80
80
|
build.dir &&= expandPath(build.dir, { dot: playbook.dir })
|
|
81
|
-
|
|
81
|
+
// used as cwd of command (and any scripts it requires)
|
|
82
|
+
build.cwd = build.cwd == null ? playbook.dir : expandPath(build.cwd, { dot: playbook.dir })
|
|
82
83
|
if (!('clean' in build) && 'output' in playbook) build.clean = playbook.output.clean
|
|
83
84
|
if (!('publish' in build)) build.publish = true
|
|
84
85
|
if ('keepAggregateSource' in build) {
|
|
@@ -406,7 +406,6 @@ function mergeAsciiDoc (
|
|
|
406
406
|
return m
|
|
407
407
|
}
|
|
408
408
|
if (fragment === resource.asciidoc.id) fragment = ''
|
|
409
|
-
const refid = generateId(resource.src, componentVersion, idCoordinateSeparator, idScopeSeparator, fragment).id
|
|
410
409
|
if (
|
|
411
410
|
text &&
|
|
412
411
|
(assemblyModel.dropExplicitXrefText === 'always' ||
|
|
@@ -414,6 +413,14 @@ function mergeAsciiDoc (
|
|
|
414
413
|
) {
|
|
415
414
|
text = ''
|
|
416
415
|
}
|
|
416
|
+
const refid = generateId(
|
|
417
|
+
resource.src,
|
|
418
|
+
componentVersion,
|
|
419
|
+
idCoordinateSeparator,
|
|
420
|
+
idScopeSeparator,
|
|
421
|
+
text.length > 0,
|
|
422
|
+
fragment
|
|
423
|
+
).id
|
|
417
424
|
return `xref:${refid}[${text}]`
|
|
418
425
|
})
|
|
419
426
|
}
|
|
@@ -566,7 +573,7 @@ function mergeAsciiDoc (
|
|
|
566
573
|
const resource = files.find((it) => it.pub.url === url)
|
|
567
574
|
if (resource) {
|
|
568
575
|
if (resource.src.family === 'page' && pagesInOutline.has(resource.pub.url)) {
|
|
569
|
-
const refid = generateId(resource.src, componentVersion, idCoordinateSeparator, idScopeSeparator).id
|
|
576
|
+
const refid = generateId(resource.src, componentVersion, idCoordinateSeparator, idScopeSeparator, true).id
|
|
570
577
|
sectionTitle = `xref:${refid}[${navtitleAsciiDoc.replace(/\]/g, '\\]')}]`
|
|
571
578
|
} else if (siteRoot) {
|
|
572
579
|
sectionTitle = `${resolveLinkTarget(resource, siteRoot, pubRoot, linkRefStyle)}[${navtitleAsciiDoc.replace(/\]/g, '\\]')}]`
|
|
@@ -807,11 +814,13 @@ function createResourceKey ({ component, version, module: mod, family, relative
|
|
|
807
814
|
return `${version}@${component}:${mod === 'ROOT' ? '' : mod}:${family === 'page' ? '' : family + '$'}${relative}`
|
|
808
815
|
}
|
|
809
816
|
|
|
810
|
-
function generateId (
|
|
817
|
+
function generateId (componentSrc, componentVersion, coordinateSep, scopeSep, escapePass, fragment) {
|
|
818
|
+
let { component, module: mod, relative } = componentSrc
|
|
811
819
|
let id = relative.replace(/\.adoc$/, '').replace(/[/.]/g, '-')
|
|
812
820
|
if (component !== componentVersion.name) {
|
|
813
821
|
id = [component, mod === 'ROOT' ? '' : mod, id].join(coordinateSep)
|
|
814
822
|
} else if (mod !== 'ROOT') {
|
|
823
|
+
if (escapePass && coordinateSep === ':' && /(?:pass|stem)$/.test(mod)) mod = mod.replace(/(?:pass|stem)$/, '\\$&')
|
|
815
824
|
id = mod + coordinateSep + id
|
|
816
825
|
} else if (ReservedIdNames.includes(id)) {
|
|
817
826
|
id += scopeSep
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antora/assembler",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.11",
|
|
4
4
|
"description": "A JavaScript library that merges AsciiDoc content from multiple pages in an Antora site into assembly files and delegates to an exporter to convert those files to another format, such as PDF.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "OpenDevise Inc. (https://opendevise.com)",
|