@asciidoctor/core 4.0.0-alpha.5 → 4.0.0-alpha.6
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/build/browser/index.js +25 -6
- package/build/node/index.cjs +25 -6
- package/package.json +6 -6
- package/src/abstract_block.js +1 -1
- package/src/document.js +3 -3
- package/src/parser.js +2 -2
- package/src/table.js +20 -0
- package/types/document.d.ts +1 -1
package/build/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version = "4.0.0-alpha.
|
|
1
|
+
var version = "4.0.0-alpha.6";
|
|
2
2
|
const packageJson = {
|
|
3
3
|
version: version};
|
|
4
4
|
|
|
@@ -4079,7 +4079,7 @@ class AbstractBlock extends AbstractNode {
|
|
|
4079
4079
|
if (anyContext || contextSelector !== 'section') {
|
|
4080
4080
|
// optimisation
|
|
4081
4081
|
// NOTE dlist items can be null
|
|
4082
|
-
for (const b of this.blocks.flat()) {
|
|
4082
|
+
for (const b of this.blocks.flat(Infinity)) {
|
|
4083
4083
|
if (b) b.#findByInternal(selector, result, filter);
|
|
4084
4084
|
}
|
|
4085
4085
|
}
|
|
@@ -8921,6 +8921,25 @@ class Cell extends AbstractBlock {
|
|
|
8921
8921
|
if (cell._innerDocSetup) {
|
|
8922
8922
|
const { lines, parentDoc, parentDoctitle, options } = cell._innerDocSetup;
|
|
8923
8923
|
cell._innerDocSetup = null;
|
|
8924
|
+
// If the first line may be a preprocessor directive (include, ifdef…), expand it using a
|
|
8925
|
+
// temporary PreprocessorReader — matching the Ruby behaviour in table.rb.
|
|
8926
|
+
if (lines.length > 0 && lines[0].includes('::')) {
|
|
8927
|
+
const firstLine = lines[0];
|
|
8928
|
+
const tmpReader = new PreprocessorReader(
|
|
8929
|
+
parentDoc,
|
|
8930
|
+
[firstLine],
|
|
8931
|
+
options.cursor
|
|
8932
|
+
);
|
|
8933
|
+
const preprocessedLines = await tmpReader.readLines();
|
|
8934
|
+
if (
|
|
8935
|
+
!(
|
|
8936
|
+
preprocessedLines.length === 1 && preprocessedLines[0] === firstLine
|
|
8937
|
+
)
|
|
8938
|
+
) {
|
|
8939
|
+
lines.shift();
|
|
8940
|
+
if (preprocessedLines.length > 0) lines.unshift(...preprocessedLines);
|
|
8941
|
+
}
|
|
8942
|
+
}
|
|
8924
8943
|
const innerDoc = await parentDoc.constructor.create(lines, options);
|
|
8925
8944
|
if (parentDoctitle) parentDoc.attributes.doctitle = parentDoctitle;
|
|
8926
8945
|
cell._innerDocument = innerDoc;
|
|
@@ -11012,8 +11031,8 @@ class Parser {
|
|
|
11012
11031
|
const admStyle = attributes.style ?? blockContext;
|
|
11013
11032
|
attributes.name = admStyle.toLowerCase();
|
|
11014
11033
|
attributes.textlabel =
|
|
11015
|
-
|
|
11016
|
-
|
|
11034
|
+
attributes.caption ?? docAttrs[`${attributes.name}-caption`];
|
|
11035
|
+
delete attributes.caption;
|
|
11017
11036
|
block = await Parser.buildBlock(
|
|
11018
11037
|
blockContext,
|
|
11019
11038
|
'compound',
|
|
@@ -16022,8 +16041,8 @@ class Document extends AbstractBlock {
|
|
|
16022
16041
|
if ((this.doctype = attrs.doctype = parentDoctype) !== DEFAULT_DOCTYPE) {
|
|
16023
16042
|
this._updateDoctypeAttributes(DEFAULT_DOCTYPE);
|
|
16024
16043
|
}
|
|
16025
|
-
//
|
|
16026
|
-
this.reader = new
|
|
16044
|
+
// Nested documents use a plain Reader (no include/conditional processing), matching Ruby behaviour.
|
|
16045
|
+
this.reader = new Reader(data, options.cursor, { document: this });
|
|
16027
16046
|
if (this.sourcemap) this.sourceLocation = this.reader.cursor;
|
|
16028
16047
|
} else {
|
|
16029
16048
|
this.backend = null;
|
package/build/node/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const node_fs = require('node:fs');
|
|
|
5
5
|
const path = require('node:path');
|
|
6
6
|
|
|
7
7
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
|
-
var version = "4.0.0-alpha.
|
|
8
|
+
var version = "4.0.0-alpha.6";
|
|
9
9
|
const packageJson = {
|
|
10
10
|
version: version};
|
|
11
11
|
|
|
@@ -4086,7 +4086,7 @@ class AbstractBlock extends AbstractNode {
|
|
|
4086
4086
|
if (anyContext || contextSelector !== 'section') {
|
|
4087
4087
|
// optimisation
|
|
4088
4088
|
// NOTE dlist items can be null
|
|
4089
|
-
for (const b of this.blocks.flat()) {
|
|
4089
|
+
for (const b of this.blocks.flat(Infinity)) {
|
|
4090
4090
|
if (b) b.#findByInternal(selector, result, filter);
|
|
4091
4091
|
}
|
|
4092
4092
|
}
|
|
@@ -8928,6 +8928,25 @@ class Cell extends AbstractBlock {
|
|
|
8928
8928
|
if (cell._innerDocSetup) {
|
|
8929
8929
|
const { lines, parentDoc, parentDoctitle, options } = cell._innerDocSetup;
|
|
8930
8930
|
cell._innerDocSetup = null;
|
|
8931
|
+
// If the first line may be a preprocessor directive (include, ifdef…), expand it using a
|
|
8932
|
+
// temporary PreprocessorReader — matching the Ruby behaviour in table.rb.
|
|
8933
|
+
if (lines.length > 0 && lines[0].includes('::')) {
|
|
8934
|
+
const firstLine = lines[0];
|
|
8935
|
+
const tmpReader = new PreprocessorReader(
|
|
8936
|
+
parentDoc,
|
|
8937
|
+
[firstLine],
|
|
8938
|
+
options.cursor
|
|
8939
|
+
);
|
|
8940
|
+
const preprocessedLines = await tmpReader.readLines();
|
|
8941
|
+
if (
|
|
8942
|
+
!(
|
|
8943
|
+
preprocessedLines.length === 1 && preprocessedLines[0] === firstLine
|
|
8944
|
+
)
|
|
8945
|
+
) {
|
|
8946
|
+
lines.shift();
|
|
8947
|
+
if (preprocessedLines.length > 0) lines.unshift(...preprocessedLines);
|
|
8948
|
+
}
|
|
8949
|
+
}
|
|
8931
8950
|
const innerDoc = await parentDoc.constructor.create(lines, options);
|
|
8932
8951
|
if (parentDoctitle) parentDoc.attributes.doctitle = parentDoctitle;
|
|
8933
8952
|
cell._innerDocument = innerDoc;
|
|
@@ -11019,8 +11038,8 @@ class Parser {
|
|
|
11019
11038
|
const admStyle = attributes.style ?? blockContext;
|
|
11020
11039
|
attributes.name = admStyle.toLowerCase();
|
|
11021
11040
|
attributes.textlabel =
|
|
11022
|
-
|
|
11023
|
-
|
|
11041
|
+
attributes.caption ?? docAttrs[`${attributes.name}-caption`];
|
|
11042
|
+
delete attributes.caption;
|
|
11024
11043
|
block = await Parser.buildBlock(
|
|
11025
11044
|
blockContext,
|
|
11026
11045
|
'compound',
|
|
@@ -16029,8 +16048,8 @@ class Document extends AbstractBlock {
|
|
|
16029
16048
|
if ((this.doctype = attrs.doctype = parentDoctype) !== DEFAULT_DOCTYPE) {
|
|
16030
16049
|
this._updateDoctypeAttributes(DEFAULT_DOCTYPE);
|
|
16031
16050
|
}
|
|
16032
|
-
//
|
|
16033
|
-
this.reader = new
|
|
16051
|
+
// Nested documents use a plain Reader (no include/conditional processing), matching Ruby behaviour.
|
|
16052
|
+
this.reader = new Reader(data, options.cursor, { document: this });
|
|
16034
16053
|
if (this.sourcemap) this.sourceLocation = this.reader.cursor;
|
|
16035
16054
|
} else {
|
|
16036
16055
|
this.backend = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asciidoctor/core",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.6",
|
|
4
4
|
"description": "Asciidoctor.js: AsciiDoc in JavaScript powered by Asciidoctor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/node/index.cjs",
|
|
@@ -66,16 +66,16 @@
|
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://github.com/asciidoctor/asciidoctor.js",
|
|
68
68
|
"volta": {
|
|
69
|
-
"node": "24.
|
|
69
|
+
"node": "24.16.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@biomejs/biome": "^2.4.13",
|
|
73
73
|
"typedoc": "^0.28.4",
|
|
74
74
|
"@rollup/plugin-json": "^6.1.0",
|
|
75
75
|
"@types/node": "^25.6.0",
|
|
76
|
-
"@vitest/browser": "^4.1.
|
|
77
|
-
"@vitest/browser-playwright": "^4.1.
|
|
78
|
-
"@vitest/ui": "^4.1.
|
|
76
|
+
"@vitest/browser": "^4.1.7",
|
|
77
|
+
"@vitest/browser-playwright": "^4.1.7",
|
|
78
|
+
"@vitest/ui": "^4.1.7",
|
|
79
79
|
"@xmldom/xmldom": "^0.9.9",
|
|
80
80
|
"dot": "^1.1.3",
|
|
81
81
|
"ejs": "^5.0.2",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"linkedom": "^0.18.12",
|
|
84
84
|
"node-html-parser": "^7.1.0",
|
|
85
85
|
"nunjucks": "^3.2.4",
|
|
86
|
-
"playwright": "^1.
|
|
86
|
+
"playwright": "^1.60.0",
|
|
87
87
|
"pug": "^3.0.4",
|
|
88
88
|
"rollup": "^4.60.2",
|
|
89
89
|
"typescript": "^6.0.3",
|
package/src/abstract_block.js
CHANGED
|
@@ -626,7 +626,7 @@ export class AbstractBlock extends AbstractNode {
|
|
|
626
626
|
if (anyContext || contextSelector !== 'section') {
|
|
627
627
|
// optimisation
|
|
628
628
|
// NOTE dlist items can be null
|
|
629
|
-
for (const b of this.blocks.flat()) {
|
|
629
|
+
for (const b of this.blocks.flat(Infinity)) {
|
|
630
630
|
if (b) b.#findByInternal(selector, result, filter)
|
|
631
631
|
}
|
|
632
632
|
}
|
package/src/document.js
CHANGED
|
@@ -34,7 +34,7 @@ import { XmlSanitizeRx, AttributeEntryPassMacroRx } from './rx.js'
|
|
|
34
34
|
import { LF } from './constants.js'
|
|
35
35
|
import { applyLogging } from './logging.js'
|
|
36
36
|
import { SyntaxHighlighter, DefaultFactoryProxy } from './syntax_highlighter.js'
|
|
37
|
-
import { PreprocessorReader, Cursor } from './reader.js'
|
|
37
|
+
import { Reader, PreprocessorReader, Cursor } from './reader.js'
|
|
38
38
|
import { Parser } from './parser.js'
|
|
39
39
|
import { Extensions, Registry } from './extensions.js'
|
|
40
40
|
|
|
@@ -483,8 +483,8 @@ export class Document extends AbstractBlock {
|
|
|
483
483
|
if ((this.doctype = attrs.doctype = parentDoctype) !== DEFAULT_DOCTYPE) {
|
|
484
484
|
this._updateDoctypeAttributes(DEFAULT_DOCTYPE)
|
|
485
485
|
}
|
|
486
|
-
//
|
|
487
|
-
this.reader = new
|
|
486
|
+
// Nested documents use a plain Reader (no include/conditional processing), matching Ruby behaviour.
|
|
487
|
+
this.reader = new Reader(data, options.cursor, { document: this })
|
|
488
488
|
if (this.sourcemap) this.sourceLocation = this.reader.cursor
|
|
489
489
|
} else {
|
|
490
490
|
this.backend = null
|
package/src/parser.js
CHANGED
|
@@ -1284,8 +1284,8 @@ export class Parser {
|
|
|
1284
1284
|
const admStyle = attributes.style ?? blockContext
|
|
1285
1285
|
attributes.name = admStyle.toLowerCase()
|
|
1286
1286
|
attributes.textlabel =
|
|
1287
|
-
|
|
1288
|
-
|
|
1287
|
+
attributes.caption ?? docAttrs[`${attributes.name}-caption`]
|
|
1288
|
+
delete attributes.caption
|
|
1289
1289
|
block = await Parser.buildBlock(
|
|
1290
1290
|
blockContext,
|
|
1291
1291
|
'compound',
|
package/src/table.js
CHANGED
|
@@ -14,6 +14,7 @@ import { Inline } from './inline.js'
|
|
|
14
14
|
import { applyLogging } from './logging.js'
|
|
15
15
|
import { LF, ATTR_REF_HEAD, BASIC_SUBS, NORMAL_SUBS } from './constants.js'
|
|
16
16
|
import { BlankLineRx, LeadingInlineAnchorRx } from './rx.js'
|
|
17
|
+
import { PreprocessorReader } from './reader.js'
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Truncate a float to `precision` decimal places (like Ruby's Float#truncate).
|
|
@@ -474,6 +475,25 @@ class Cell extends AbstractBlock {
|
|
|
474
475
|
if (cell._innerDocSetup) {
|
|
475
476
|
const { lines, parentDoc, parentDoctitle, options } = cell._innerDocSetup
|
|
476
477
|
cell._innerDocSetup = null
|
|
478
|
+
// If the first line may be a preprocessor directive (include, ifdef…), expand it using a
|
|
479
|
+
// temporary PreprocessorReader — matching the Ruby behaviour in table.rb.
|
|
480
|
+
if (lines.length > 0 && lines[0].includes('::')) {
|
|
481
|
+
const firstLine = lines[0]
|
|
482
|
+
const tmpReader = new PreprocessorReader(
|
|
483
|
+
parentDoc,
|
|
484
|
+
[firstLine],
|
|
485
|
+
options.cursor
|
|
486
|
+
)
|
|
487
|
+
const preprocessedLines = await tmpReader.readLines()
|
|
488
|
+
if (
|
|
489
|
+
!(
|
|
490
|
+
preprocessedLines.length === 1 && preprocessedLines[0] === firstLine
|
|
491
|
+
)
|
|
492
|
+
) {
|
|
493
|
+
lines.shift()
|
|
494
|
+
if (preprocessedLines.length > 0) lines.unshift(...preprocessedLines)
|
|
495
|
+
}
|
|
496
|
+
}
|
|
477
497
|
const innerDoc = await parentDoc.constructor.create(lines, options)
|
|
478
498
|
if (parentDoctitle) parentDoc.attributes.doctitle = parentDoctitle
|
|
479
499
|
cell._innerDocument = innerDoc
|
package/types/document.d.ts
CHANGED
|
@@ -489,7 +489,7 @@ export namespace Document {
|
|
|
489
489
|
import { Footnote } from './footnote.js';
|
|
490
490
|
import { AttributeEntry } from './attribute_entry.js';
|
|
491
491
|
import { AbstractBlock } from './abstract_block.js';
|
|
492
|
-
import
|
|
492
|
+
import { Reader } from './reader.js';
|
|
493
493
|
import { Section } from './section.js';
|
|
494
494
|
import { Inline } from './inline.js';
|
|
495
495
|
export { Footnote, AttributeEntry };
|