@asciidoctor/core 3.0.3 → 4.0.0-alpha.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.
Files changed (91) hide show
  1. package/README.md +42 -10
  2. package/build/browser/index.js +24154 -0
  3. package/build/node/index.cjs +24735 -0
  4. package/{dist/css/asciidoctor.css → data/asciidoctor-default.css} +54 -53
  5. package/package.json +53 -100
  6. package/src/abstract_block.js +849 -0
  7. package/src/abstract_node.js +954 -0
  8. package/src/attribute_entry.js +12 -0
  9. package/src/attribute_list.js +380 -0
  10. package/src/block.js +168 -0
  11. package/src/browser/asset.js +22 -0
  12. package/src/browser/reader.js +138 -0
  13. package/src/browser.js +121 -0
  14. package/src/callouts.js +85 -0
  15. package/src/compliance.js +54 -0
  16. package/src/constants.js +665 -0
  17. package/src/convert.js +370 -0
  18. package/src/converter/composite.js +83 -0
  19. package/src/converter/docbook5.js +1031 -0
  20. package/src/converter/html5.js +1899 -0
  21. package/src/converter/manpage.js +935 -0
  22. package/src/converter/template.js +459 -0
  23. package/src/converter.js +478 -0
  24. package/src/data/stylesheet-data.js +2 -0
  25. package/src/document.js +2134 -0
  26. package/src/extensions.js +1952 -0
  27. package/src/footnote.js +28 -0
  28. package/src/helpers.js +355 -0
  29. package/src/index.js +138 -0
  30. package/src/inline.js +158 -0
  31. package/src/list.js +240 -0
  32. package/src/load.js +276 -0
  33. package/src/logging.js +526 -0
  34. package/src/parser.js +3661 -0
  35. package/src/path_resolver.js +472 -0
  36. package/src/reader.js +1755 -0
  37. package/src/rx.js +829 -0
  38. package/src/section.js +354 -0
  39. package/src/stylesheets.js +30 -0
  40. package/src/substitutors.js +2241 -0
  41. package/src/syntaxHighlighter/highlightjs.js +90 -0
  42. package/src/syntaxHighlighter/html_pipeline.js +33 -0
  43. package/src/syntax_highlighter.js +304 -0
  44. package/src/table.js +952 -0
  45. package/src/timings.js +78 -0
  46. package/types/abstract_block.d.ts +343 -0
  47. package/types/abstract_node.d.ts +471 -0
  48. package/types/attribute_entry.d.ts +7 -0
  49. package/types/attribute_list.d.ts +52 -0
  50. package/types/block.d.ts +55 -0
  51. package/types/browser/asset.d.ts +7 -0
  52. package/types/browser/reader.d.ts +29 -0
  53. package/types/callouts.d.ts +36 -0
  54. package/types/compliance.d.ts +23 -0
  55. package/types/constants.d.ts +268 -0
  56. package/types/convert.d.ts +34 -0
  57. package/types/converter/composite.d.ts +20 -0
  58. package/types/converter/docbook5.d.ts +41 -0
  59. package/types/converter/html5.d.ts +51 -0
  60. package/types/converter/manpage.d.ts +59 -0
  61. package/types/converter/template.d.ts +83 -0
  62. package/types/converter.d.ts +150 -0
  63. package/types/data/stylesheet-data.d.ts +2 -0
  64. package/types/document.d.ts +495 -0
  65. package/types/extensions.d.ts +876 -0
  66. package/types/footnote.d.ts +18 -0
  67. package/types/helpers.d.ts +146 -0
  68. package/types/index.d.ts +73 -3731
  69. package/types/inline.d.ts +69 -0
  70. package/types/list.d.ts +114 -0
  71. package/types/load.d.ts +39 -0
  72. package/types/logging.d.ts +187 -0
  73. package/types/parser.d.ts +114 -0
  74. package/types/path_resolver.d.ts +103 -0
  75. package/types/reader.d.ts +184 -0
  76. package/types/rx.d.ts +513 -0
  77. package/types/section.d.ts +122 -0
  78. package/types/stylesheets.d.ts +10 -0
  79. package/types/substitutors.d.ts +208 -0
  80. package/types/syntaxHighlighter/highlightjs.d.ts +33 -0
  81. package/types/syntaxHighlighter/html_pipeline.d.ts +16 -0
  82. package/types/syntax_highlighter.d.ts +167 -0
  83. package/types/table.d.ts +231 -0
  84. package/types/timings.d.ts +25 -0
  85. package/types/tsconfig.json +9 -0
  86. package/LICENSE +0 -21
  87. package/dist/browser/asciidoctor.js +0 -47654
  88. package/dist/browser/asciidoctor.min.js +0 -1452
  89. package/dist/graalvm/asciidoctor.js +0 -47402
  90. package/dist/node/asciidoctor.cjs +0 -21567
  91. package/dist/node/asciidoctor.js +0 -23037
@@ -0,0 +1,231 @@
1
+ export class Table extends AbstractBlock<string> {
2
+ constructor(parent: any, attributes: any);
3
+ rows: {
4
+ head: any[];
5
+ foot: any[];
6
+ body: any[];
7
+ /**
8
+ * Retrieve the rows grouped by section as a nested Array.
9
+ * @returns {Array<[string, Array]>}
10
+ */
11
+ bySection(): Array<[string, any[]]>;
12
+ toObject(): {
13
+ head: any[];
14
+ body: any[];
15
+ foot: any[];
16
+ };
17
+ };
18
+ columns: any[];
19
+ hasHeaderOption: boolean;
20
+ }
21
+ export namespace Table {
22
+ export { Rows };
23
+ export { Column };
24
+ export { Cell };
25
+ export { ParserContext };
26
+ }
27
+ import { AbstractBlock } from './abstract_block.js';
28
+ import { AbstractNode } from './abstract_node.js';
29
+ declare class Rows {
30
+ constructor(head?: any[], foot?: any[], body?: any[]);
31
+ head: any[];
32
+ foot: any[];
33
+ body: any[];
34
+ /**
35
+ * Retrieve the rows grouped by section as a nested Array.
36
+ * @returns {Array<[string, Array]>}
37
+ */
38
+ bySection(): Array<[string, any[]]>;
39
+ toObject(): {
40
+ head: any[];
41
+ body: any[];
42
+ foot: any[];
43
+ };
44
+ }
45
+ declare class Column extends AbstractNode {
46
+ constructor(table: any, index: any, attributes?: {});
47
+ style: any;
48
+ /** Alias for parent (always a Table). */
49
+ get table(): AbstractNode;
50
+ /**
51
+ * Get the parent table of this column.
52
+ * @returns {Table}
53
+ */
54
+ getTable(): Table;
55
+ }
56
+ /** @extends {AbstractBlock<string | string[]>} */
57
+ declare class Cell extends AbstractBlock<string | string[]> {
58
+ static get DOUBLE_LF(): string;
59
+ /**
60
+ * Factory — create and fully initialize a Cell asynchronously.
61
+ * For AsciiDoc cells, parses the nested document.
62
+ *
63
+ * NOTE: _innerContent is NOT pre-computed here. Document.convert() will call
64
+ * _convertAsciiDocCells() after parse completes (so callouts are rewound and
65
+ * all cross-references from the parent document are already registered).
66
+ * @param {Table.Column} column
67
+ * @param {string} cellText
68
+ * @param {Object} [attributes={}]
69
+ * @param {Object} [opts={}]
70
+ * @returns {Promise<Table.Cell>}
71
+ */
72
+ static create(column: {
73
+ style: any;
74
+ /** Alias for parent (always a Table). */
75
+ get table(): AbstractNode;
76
+ isBlock(): boolean;
77
+ isInline(): boolean;
78
+ /**
79
+ * Get the parent table of this column.
80
+ * @returns {Table}
81
+ */
82
+ getTable(): Table;
83
+ document: Document;
84
+ context: string;
85
+ nodeName: string;
86
+ id: string;
87
+ attributes: any;
88
+ passthroughs: any[];
89
+ get parent(): AbstractNode;
90
+ set parent(parent: AbstractNode);
91
+ get role(): string | string[];
92
+ set role(names: string | string[]);
93
+ get roles(): any;
94
+ get converter(): object;
95
+ getAttribute(name: string, defaultValue?: any, fallbackName?: string | boolean | null): any;
96
+ hasAttribute(name: string, expectedValue?: any, fallbackName?: string | boolean | null): boolean;
97
+ setAttribute(name: string, value?: any, overwrite?: boolean): string | boolean | null;
98
+ isAttribute(name: any, expectedValue?: any): boolean;
99
+ removeAttribute(name: string): any;
100
+ hasOption(name: string): boolean;
101
+ setOption(name: string): void;
102
+ enabledOptions(): Set<string>;
103
+ updateAttributes(newAttributes: any): any;
104
+ hasRoleAttribute(expectedValue?: string | null): boolean;
105
+ hasRole(name: string): boolean;
106
+ addRole(name: string): boolean;
107
+ removeRole(name: string): boolean;
108
+ get reftext(): string | null;
109
+ precomputeReftext(): Promise<void>;
110
+ hasReftext(): boolean;
111
+ isReftext(): boolean;
112
+ iconUri(name: string): Promise<string>;
113
+ imageUri(targetImage: string, assetDirKey?: string): Promise<string>;
114
+ mediaUri(target: string, assetDirKey?: string): string;
115
+ generateDataUri(targetImage: string, assetDirKey?: string | null): Promise<string>;
116
+ generateDataUriFromUri(imageUri: string, cacheUri?: boolean): Promise<string>;
117
+ normalizeAssetPath(assetRef: string, assetName?: string, autocorrect?: boolean): string;
118
+ normalizeSystemPath(target: string, start?: string | null, jail?: string | null, opts?: any): string;
119
+ normalizeWebPath(target: string, start?: string | null, preserveUriTarget?: boolean): string;
120
+ readAsset(path: string, opts?: any): Promise<string | null>;
121
+ readContents(target: string, opts?: any): Promise<string | null>;
122
+ isUri(str: string): boolean;
123
+ readonly logger: any;
124
+ getLogger(): object;
125
+ getRole(): string | undefined;
126
+ setRole(...names: (string | string[])[]): string;
127
+ getRoles(): string[];
128
+ getAttributes(): any;
129
+ getDocument(): Document;
130
+ getParent(): AbstractNode | undefined;
131
+ setParent(parent: any): void;
132
+ getNodeName(): string;
133
+ getId(): string | undefined;
134
+ setId(id: string): void;
135
+ getContext(): string;
136
+ getConverter(): object;
137
+ getIconUri(name: string): Promise<string>;
138
+ getMediaUri(target: string, assetDirKey?: string): string;
139
+ getImageUri(targetImage: string, assetDirKey?: string | null): Promise<string>;
140
+ getReftext(): string | undefined;
141
+ }, cellText: string, attributes?: any, opts?: any): Promise<typeof Cell>;
142
+ constructor(column: any, cellText: any, attributes?: {}, opts?: {});
143
+ _cursor: any;
144
+ sourceLocation: any;
145
+ colspan: number;
146
+ rowspan: number;
147
+ style: any;
148
+ /** Alias for parent (always a Column). */
149
+ get column(): AbstractNode;
150
+ /** @returns {Promise<Table.Cell>} */
151
+ reinitialize(hasHeader: any): Promise<typeof Cell>;
152
+ _catalogInlineAnchor(cellText?: any, cursor?: any): void;
153
+ set text(val: string | null);
154
+ /**
155
+ * Get the text with substitutions applied.
156
+ * The result is pre-computed during Document.parse() via precomputeText().
157
+ * Falls back to the raw text if precomputeText() has not been called yet.
158
+ * @returns {string|null}
159
+ */
160
+ get text(): string | null;
161
+ /**
162
+ * Pre-compute the converted text asynchronously.
163
+ * Called during Document.parse() so the synchronous getter works during conversion.
164
+ * @returns {Promise<void>}
165
+ */
166
+ precomputeText(): Promise<void>;
167
+ lines(): any;
168
+ source(): any;
169
+ get innerDocument(): any;
170
+ get file(): any;
171
+ get lineno(): any;
172
+ /**
173
+ * Get the text with substitutions applied.
174
+ * @returns {string|null}
175
+ */
176
+ getText(): string | null;
177
+ /**
178
+ * Set the raw text of this cell.
179
+ * @param {string|null} val
180
+ */
181
+ setText(val: string | null): void;
182
+ /**
183
+ * Get the inner document for AsciiDoc-style cells.
184
+ * @returns {Document|null}
185
+ */
186
+ getInnerDocument(): Document | null;
187
+ }
188
+ declare class ParserContext {
189
+ static get FORMATS(): Set<string>;
190
+ static get DELIMITERS(): {
191
+ psv: (string | RegExp)[];
192
+ csv: (string | RegExp)[];
193
+ dsv: (string | RegExp)[];
194
+ tsv: (string | RegExp)[];
195
+ '!sv': (string | RegExp)[];
196
+ };
197
+ constructor(reader: any, table: any, attributes?: {});
198
+ _reader: any;
199
+ _startCursor: any;
200
+ table: any;
201
+ buffer: string;
202
+ format: unknown;
203
+ delimiter: any;
204
+ delimiterRe: any;
205
+ colcount: any;
206
+ _cellspecs: any[];
207
+ _cellOpen: boolean;
208
+ _activeRowspans: number[];
209
+ _columnVisits: number;
210
+ _currentRow: any[];
211
+ _linenum: number;
212
+ startsWith(line: any): any;
213
+ matchDelimiter(line: any): any;
214
+ skipPastDelimiter(pre: any): void;
215
+ skipPastEscapedDelimiter(pre: any): void;
216
+ bufferHasUnclosedQuotesInText(text: any, q?: string): boolean;
217
+ bufferHasUnclosedQuotes(append?: any, q?: string): boolean;
218
+ takeCellspec(): any;
219
+ pushCellspec(cellspec?: {}): void;
220
+ keepCellOpen(): void;
221
+ markCellClosed(): void;
222
+ isCellOpen(): boolean;
223
+ isCellClosed(): boolean;
224
+ closeOpenCell(nextCellspec?: {}): Promise<void>;
225
+ closeCell(eol?: boolean): Promise<void>;
226
+ closeTable(): void;
227
+ _activateRowspan(rowspan: any, colspan: any): void;
228
+ _endOfRow(): 0 | 1 | -1;
229
+ _advance(): void;
230
+ }
231
+ export {};
@@ -0,0 +1,25 @@
1
+ export class Timings {
2
+ static create(): Timings;
3
+ _log: {};
4
+ _timers: {};
5
+ start(key: any): void;
6
+ record(key: any): void;
7
+ time(...keys: any[]): any;
8
+ read(): any;
9
+ parse(): any;
10
+ readParse(): any;
11
+ convert(): any;
12
+ readParseConvert(): any;
13
+ write(): any;
14
+ total(): any;
15
+ /**
16
+ * Print a summary report.
17
+ * @param {{ write?: (s: string) => void, log?: (s: string) => void }} [out=console] - Output sink.
18
+ * @param {string|null} [subject=null] - Optional label for the input file.
19
+ */
20
+ printReport(out?: {
21
+ write?: (s: string) => void;
22
+ log?: (s: string) => void;
23
+ }, subject?: string | null): void;
24
+ _now(): any;
25
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "strict": false,
6
+ "types": ["node"]
7
+ },
8
+ "include": ["./**/*.d.ts"]
9
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (C) 2019 Dan Allen, Guillaume Grossetie, Anthonny Quérouil and the Asciidoctor Project
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.