@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.
- package/README.md +42 -10
- package/build/browser/index.js +24154 -0
- package/build/node/index.cjs +24735 -0
- package/{dist/css/asciidoctor.css → data/asciidoctor-default.css} +54 -53
- package/package.json +53 -100
- package/src/abstract_block.js +849 -0
- package/src/abstract_node.js +954 -0
- package/src/attribute_entry.js +12 -0
- package/src/attribute_list.js +380 -0
- package/src/block.js +168 -0
- package/src/browser/asset.js +22 -0
- package/src/browser/reader.js +138 -0
- package/src/browser.js +121 -0
- package/src/callouts.js +85 -0
- package/src/compliance.js +54 -0
- package/src/constants.js +665 -0
- package/src/convert.js +370 -0
- package/src/converter/composite.js +83 -0
- package/src/converter/docbook5.js +1031 -0
- package/src/converter/html5.js +1899 -0
- package/src/converter/manpage.js +935 -0
- package/src/converter/template.js +459 -0
- package/src/converter.js +478 -0
- package/src/data/stylesheet-data.js +2 -0
- package/src/document.js +2134 -0
- package/src/extensions.js +1952 -0
- package/src/footnote.js +28 -0
- package/src/helpers.js +355 -0
- package/src/index.js +138 -0
- package/src/inline.js +158 -0
- package/src/list.js +240 -0
- package/src/load.js +276 -0
- package/src/logging.js +526 -0
- package/src/parser.js +3661 -0
- package/src/path_resolver.js +472 -0
- package/src/reader.js +1755 -0
- package/src/rx.js +829 -0
- package/src/section.js +354 -0
- package/src/stylesheets.js +30 -0
- package/src/substitutors.js +2241 -0
- package/src/syntaxHighlighter/highlightjs.js +90 -0
- package/src/syntaxHighlighter/html_pipeline.js +33 -0
- package/src/syntax_highlighter.js +304 -0
- package/src/table.js +952 -0
- package/src/timings.js +78 -0
- package/types/abstract_block.d.ts +343 -0
- package/types/abstract_node.d.ts +471 -0
- package/types/attribute_entry.d.ts +7 -0
- package/types/attribute_list.d.ts +52 -0
- package/types/block.d.ts +55 -0
- package/types/browser/asset.d.ts +7 -0
- package/types/browser/reader.d.ts +29 -0
- package/types/callouts.d.ts +36 -0
- package/types/compliance.d.ts +23 -0
- package/types/constants.d.ts +268 -0
- package/types/convert.d.ts +34 -0
- package/types/converter/composite.d.ts +20 -0
- package/types/converter/docbook5.d.ts +41 -0
- package/types/converter/html5.d.ts +51 -0
- package/types/converter/manpage.d.ts +59 -0
- package/types/converter/template.d.ts +83 -0
- package/types/converter.d.ts +150 -0
- package/types/data/stylesheet-data.d.ts +2 -0
- package/types/document.d.ts +495 -0
- package/types/extensions.d.ts +876 -0
- package/types/footnote.d.ts +18 -0
- package/types/helpers.d.ts +146 -0
- package/types/index.d.ts +73 -3731
- package/types/inline.d.ts +69 -0
- package/types/list.d.ts +114 -0
- package/types/load.d.ts +39 -0
- package/types/logging.d.ts +187 -0
- package/types/parser.d.ts +114 -0
- package/types/path_resolver.d.ts +103 -0
- package/types/reader.d.ts +184 -0
- package/types/rx.d.ts +513 -0
- package/types/section.d.ts +122 -0
- package/types/stylesheets.d.ts +10 -0
- package/types/substitutors.d.ts +208 -0
- package/types/syntaxHighlighter/highlightjs.d.ts +33 -0
- package/types/syntaxHighlighter/html_pipeline.d.ts +16 -0
- package/types/syntax_highlighter.d.ts +167 -0
- package/types/table.d.ts +231 -0
- package/types/timings.d.ts +25 -0
- package/types/tsconfig.json +9 -0
- package/LICENSE +0 -21
- package/dist/browser/asciidoctor.js +0 -47654
- package/dist/browser/asciidoctor.min.js +0 -1452
- package/dist/graalvm/asciidoctor.js +0 -47402
- package/dist/node/asciidoctor.cjs +0 -21567
- package/dist/node/asciidoctor.js +0 -23037
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
export class Cursor {
|
|
2
|
+
constructor(file: any, dir?: any, path?: any, lineno?: number);
|
|
3
|
+
file: any;
|
|
4
|
+
dir: any;
|
|
5
|
+
path: any;
|
|
6
|
+
lineno: number;
|
|
7
|
+
advance(num: any): void;
|
|
8
|
+
get lineInfo(): string;
|
|
9
|
+
toString(): string;
|
|
10
|
+
getLineNumber(): number;
|
|
11
|
+
getFile(): any;
|
|
12
|
+
getDirectory(): any;
|
|
13
|
+
getPath(): any;
|
|
14
|
+
/**
|
|
15
|
+
* Get the line info string for this cursor (e.g. "path/to/file.adoc: line 42").
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
getLineInfo(): string;
|
|
19
|
+
}
|
|
20
|
+
export class Reader {
|
|
21
|
+
constructor(data?: any, cursor?: any, opts?: {});
|
|
22
|
+
file: any;
|
|
23
|
+
_dir: any;
|
|
24
|
+
path: any;
|
|
25
|
+
lineno: any;
|
|
26
|
+
_document: any;
|
|
27
|
+
sourceLines: string[];
|
|
28
|
+
_lines: string[];
|
|
29
|
+
_mark: any;
|
|
30
|
+
_lookAhead: number;
|
|
31
|
+
processLines: boolean;
|
|
32
|
+
_unescapeNextLine: boolean;
|
|
33
|
+
unterminated: any;
|
|
34
|
+
_saved: any;
|
|
35
|
+
/** @returns {boolean | Promise<boolean>} */
|
|
36
|
+
hasMoreLines(): boolean | Promise<boolean>;
|
|
37
|
+
/** @returns {boolean | Promise<boolean>} */
|
|
38
|
+
empty(): boolean | Promise<boolean>;
|
|
39
|
+
/** @returns {boolean | Promise<boolean>} */
|
|
40
|
+
eof(): boolean | Promise<boolean>;
|
|
41
|
+
nextLineEmpty(): Promise<boolean>;
|
|
42
|
+
isNextLineEmpty(): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Peek at the next line without consuming it.
|
|
45
|
+
* @param {boolean} [direct=false] - When true, bypass processLine and return the raw stack top.
|
|
46
|
+
* @returns {Promise<string|undefined>} The next line, or undefined if there are no more lines.
|
|
47
|
+
*/
|
|
48
|
+
peekLine(direct?: boolean): Promise<string | undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* Peek at the next num lines without consuming them.
|
|
51
|
+
* @param {number|null} [num=null]
|
|
52
|
+
* @param {boolean} [direct=false]
|
|
53
|
+
* @returns {Promise<string[]>}
|
|
54
|
+
*/
|
|
55
|
+
peekLines(num?: number | null, direct?: boolean): Promise<string[]>;
|
|
56
|
+
readLine(): Promise<string>;
|
|
57
|
+
readLines(): Promise<string[]>;
|
|
58
|
+
readlines(): Promise<string[]>;
|
|
59
|
+
read(): Promise<string>;
|
|
60
|
+
advance(): Promise<boolean>;
|
|
61
|
+
unshiftLine(lineToRestore: any): void;
|
|
62
|
+
restoreLine(lineToRestore: any): void;
|
|
63
|
+
unshiftLines(linesToRestore: any): void;
|
|
64
|
+
restoreLines(linesToRestore: any): void;
|
|
65
|
+
replaceNextLine(replacement: any): boolean;
|
|
66
|
+
replaceLine(replacement: any): boolean;
|
|
67
|
+
skipBlankLines(): Promise<number>;
|
|
68
|
+
skipCommentLines(): Promise<void>;
|
|
69
|
+
skipLineComments(): Promise<string[]>;
|
|
70
|
+
terminate(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Read lines until a termination condition is met.
|
|
73
|
+
* @param {Object} [options={}]
|
|
74
|
+
* @param {string} [options.terminator] - Line at which to stop.
|
|
75
|
+
* @param {boolean} [options.breakOnBlankLines] - Stop on blank lines.
|
|
76
|
+
* @param {boolean} [options.breakOnListContinuation] - Stop on a list continuation (+).
|
|
77
|
+
* @param {boolean} [options.skipFirstLine] - Skip the first line before scanning.
|
|
78
|
+
* @param {boolean} [options.preserveLastLine] - Push the terminating line back.
|
|
79
|
+
* @param {boolean} [options.readLastLine] - Include the terminating line in result.
|
|
80
|
+
* @param {boolean} [options.skipLineComments] - Skip line comments.
|
|
81
|
+
* @param {boolean} [options.skipProcessing] - Disable line preprocessing for this call.
|
|
82
|
+
* @param {string} [options.context] - Name used in unterminated-block warnings.
|
|
83
|
+
* @param {Cursor} [options.cursor] - Starting cursor for unterminated-block warnings.
|
|
84
|
+
* @param {Function|null} [filter=null] - Optional function(line) returning true to break.
|
|
85
|
+
* @returns {Promise<string[]>}
|
|
86
|
+
*/
|
|
87
|
+
readLinesUntil(options?: {
|
|
88
|
+
terminator?: string;
|
|
89
|
+
breakOnBlankLines?: boolean;
|
|
90
|
+
breakOnListContinuation?: boolean;
|
|
91
|
+
skipFirstLine?: boolean;
|
|
92
|
+
preserveLastLine?: boolean;
|
|
93
|
+
readLastLine?: boolean;
|
|
94
|
+
skipLineComments?: boolean;
|
|
95
|
+
skipProcessing?: boolean;
|
|
96
|
+
context?: string;
|
|
97
|
+
cursor?: Cursor;
|
|
98
|
+
}, filter?: Function | null): Promise<string[]>;
|
|
99
|
+
get cursor(): Cursor;
|
|
100
|
+
cursorAtLine(lineno: any): Cursor;
|
|
101
|
+
cursorAtMark(): Cursor;
|
|
102
|
+
cursorBeforeMark(): Cursor;
|
|
103
|
+
cursorAtPrevLine(): Cursor;
|
|
104
|
+
mark(): void;
|
|
105
|
+
lineInfo(): string;
|
|
106
|
+
/**
|
|
107
|
+
* Returns the remaining lines in forward order (first remaining line at index 0).
|
|
108
|
+
* The returned object is a mutable proxy so that element assignments like
|
|
109
|
+
* `reader.lines[i] = newValue` are reflected back into the internal reversed stack.
|
|
110
|
+
* @returns {string[]}
|
|
111
|
+
*/
|
|
112
|
+
get lines(): string[];
|
|
113
|
+
string(): string;
|
|
114
|
+
source(): string;
|
|
115
|
+
save(): void;
|
|
116
|
+
restoreSave(): void;
|
|
117
|
+
discardSave(): void;
|
|
118
|
+
toString(): string;
|
|
119
|
+
getCursor(): Cursor;
|
|
120
|
+
getLines(): string[];
|
|
121
|
+
getString(): string;
|
|
122
|
+
getLogger(): any;
|
|
123
|
+
createLogMessage(text: any, context?: {}): any;
|
|
124
|
+
get logger(): any;
|
|
125
|
+
/** @param {string} msg @param {{ sourceLocation?: any, includeLocation?: any }} [opts] */
|
|
126
|
+
_logWarn(msg: string, { sourceLocation, includeLocation }?: {
|
|
127
|
+
sourceLocation?: any;
|
|
128
|
+
includeLocation?: any;
|
|
129
|
+
}): void;
|
|
130
|
+
_logError(msg: any, opts?: {}): void;
|
|
131
|
+
/** @param {string} msg @param {{ sourceLocation?: any }} [opts] */
|
|
132
|
+
_logInfo(msg: string, { sourceLocation }?: {
|
|
133
|
+
sourceLocation?: any;
|
|
134
|
+
}): void;
|
|
135
|
+
}
|
|
136
|
+
export class PreprocessorReader extends Reader {
|
|
137
|
+
constructor(document: any, data?: any, cursor?: any, opts?: {});
|
|
138
|
+
_sourcemap: any;
|
|
139
|
+
_maxdepth: {
|
|
140
|
+
abs: number;
|
|
141
|
+
curr: number;
|
|
142
|
+
rel: number;
|
|
143
|
+
};
|
|
144
|
+
includeStack: any[];
|
|
145
|
+
_includes: any;
|
|
146
|
+
_skipping: boolean;
|
|
147
|
+
_conditionalStack: any[];
|
|
148
|
+
_includeProcessorExtensions: any;
|
|
149
|
+
/**
|
|
150
|
+
* Drain conditional stack at EOS; treat blank lines as lines (not as EOF).
|
|
151
|
+
* `peekLine()` returns undefined only at true EOF; '' for blank lines.
|
|
152
|
+
* @returns {Promise<boolean>}
|
|
153
|
+
*/
|
|
154
|
+
hasMoreLines(): Promise<boolean>;
|
|
155
|
+
empty(): Promise<boolean>;
|
|
156
|
+
eof(): Promise<boolean>;
|
|
157
|
+
peekLine(direct?: boolean): any;
|
|
158
|
+
/**
|
|
159
|
+
* Push new source onto the reader, switching the include context.
|
|
160
|
+
* @param {string|string[]} data
|
|
161
|
+
* @param {string|null} [file=null]
|
|
162
|
+
* @param {string|null} [path=null]
|
|
163
|
+
* @param {number} [lineno=1]
|
|
164
|
+
* @param {Object} [attributes={}]
|
|
165
|
+
* @returns {this}
|
|
166
|
+
*/
|
|
167
|
+
pushInclude(data: string | string[], file?: string | null, path?: string | null, lineno?: number, attributes?: any): this;
|
|
168
|
+
get includeDepth(): number;
|
|
169
|
+
exceedsMaxDepth(): number;
|
|
170
|
+
exceededMaxDepth(): number;
|
|
171
|
+
hasIncludeProcessors(): boolean;
|
|
172
|
+
createIncludeCursor(file: any, path: any, lineno: any): Cursor;
|
|
173
|
+
/**
|
|
174
|
+
* Evaluate preprocessor directives as lines are visited.
|
|
175
|
+
* @param {string} line
|
|
176
|
+
* @returns {Promise<string|undefined>}
|
|
177
|
+
*/
|
|
178
|
+
processLine(line: string): Promise<string | undefined>;
|
|
179
|
+
/**
|
|
180
|
+
* Get the current include depth (number of nested includes).
|
|
181
|
+
* @returns {number}
|
|
182
|
+
*/
|
|
183
|
+
getIncludeDepth(): number;
|
|
184
|
+
}
|
package/types/rx.d.ts
ADDED
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
export const CC_ALL: "[\\s\\S]";
|
|
2
|
+
export const CC_ANY: ".";
|
|
3
|
+
export const CC_EOL: "$";
|
|
4
|
+
export const CC_ALPHA: "\\p{Alphabetic}";
|
|
5
|
+
export const CG_ALPHA: "\\p{Alphabetic}";
|
|
6
|
+
export const CC_ALNUM: "\\p{Alphabetic}\\p{N}";
|
|
7
|
+
export const CG_ALNUM: "[\\p{Alphabetic}\\p{N}]";
|
|
8
|
+
export const CC_WORD: "\\p{Alphabetic}\\p{N}\\p{Pc}";
|
|
9
|
+
export const CG_WORD: "[\\p{Alphabetic}\\p{N}\\p{Pc}]";
|
|
10
|
+
export const CG_BLANK: "[\\p{Zs}\\t]";
|
|
11
|
+
export const QuoteAttributeListRxt: "\\[([^\\[\\]]+)\\]";
|
|
12
|
+
/**
|
|
13
|
+
* Matches the author info line immediately following the document title.
|
|
14
|
+
* @example
|
|
15
|
+
* Doc Writer <doc@example.com>
|
|
16
|
+
* Mary_Sue Brontë
|
|
17
|
+
*/
|
|
18
|
+
export const AuthorInfoLineRx: RegExp;
|
|
19
|
+
/**
|
|
20
|
+
* Matches the delimiter that separates multiple authors.
|
|
21
|
+
* @example
|
|
22
|
+
* Doc Writer; Junior Writer
|
|
23
|
+
*/
|
|
24
|
+
export const AuthorDelimiterRx: RegExp;
|
|
25
|
+
/**
|
|
26
|
+
* Matches the revision info line immediately following the author info line.
|
|
27
|
+
* @example
|
|
28
|
+
* v1.0
|
|
29
|
+
* 2013-01-01
|
|
30
|
+
* v1.0, 2013-01-01: Ring in the new year release
|
|
31
|
+
*/
|
|
32
|
+
export const RevisionInfoLineRx: RegExp;
|
|
33
|
+
/**
|
|
34
|
+
* Matches the title and volnum in the manpage doctype.
|
|
35
|
+
* @example
|
|
36
|
+
* = asciidoctor(1)
|
|
37
|
+
* = asciidoctor ( 1 )
|
|
38
|
+
*/
|
|
39
|
+
export const ManpageTitleVolnumRx: RegExp;
|
|
40
|
+
/**
|
|
41
|
+
* Matches the name and purpose in the manpage doctype.
|
|
42
|
+
* @example
|
|
43
|
+
* asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats
|
|
44
|
+
*/
|
|
45
|
+
export const ManpageNamePurposeRx: RegExp;
|
|
46
|
+
/**
|
|
47
|
+
* Matches a conditional preprocessor directive (ifdef, ifndef, ifeval, endif).
|
|
48
|
+
* @example
|
|
49
|
+
* ifdef::basebackend-html[]
|
|
50
|
+
* ifeval::["{asciidoctor-version}" >= "0.1.0"]
|
|
51
|
+
* endif::[]
|
|
52
|
+
*/
|
|
53
|
+
export const ConditionalDirectiveRx: RegExp;
|
|
54
|
+
/**
|
|
55
|
+
* Matches a restricted (safe) eval expression.
|
|
56
|
+
* @example
|
|
57
|
+
* "{asciidoctor-version}" >= "0.1.0"
|
|
58
|
+
*/
|
|
59
|
+
export const EvalExpressionRx: RegExp;
|
|
60
|
+
/**
|
|
61
|
+
* Matches an include preprocessor directive.
|
|
62
|
+
* @example
|
|
63
|
+
* include::chapter1.ad[]
|
|
64
|
+
* include::example.txt[lines=1;2;5..10]
|
|
65
|
+
*/
|
|
66
|
+
export const IncludeDirectiveRx: RegExp;
|
|
67
|
+
/**
|
|
68
|
+
* Matches a trailing tag directive in an include file.
|
|
69
|
+
*
|
|
70
|
+
* NOTE: 'm' flag required so that $ matches end-of-line (not only end-of-string) in JS.
|
|
71
|
+
* NOTE: accounts for \r in Windows line endings.
|
|
72
|
+
* @example
|
|
73
|
+
* // tag::try-catch[]
|
|
74
|
+
* // end::try-catch[]
|
|
75
|
+
*/
|
|
76
|
+
export const TagDirectiveRx: RegExp;
|
|
77
|
+
/**
|
|
78
|
+
* Matches a document attribute entry.
|
|
79
|
+
* @example
|
|
80
|
+
* :foo: bar
|
|
81
|
+
* :First Name: Dan
|
|
82
|
+
* :sectnums!:
|
|
83
|
+
*/
|
|
84
|
+
export const AttributeEntryRx: RegExp;
|
|
85
|
+
/** Matches invalid characters in an attribute name. */
|
|
86
|
+
export const InvalidAttributeNameCharsRx: RegExp;
|
|
87
|
+
/**
|
|
88
|
+
* Matches a pass inline macro surrounding an attribute entry value.
|
|
89
|
+
*
|
|
90
|
+
* NOTE: ^ / $ are string anchors here (no 'm' flag). [\s\S]* allows multi-line values.
|
|
91
|
+
* @example
|
|
92
|
+
* pass:[text]
|
|
93
|
+
* pass:a[{a} {b} {c}]
|
|
94
|
+
*/
|
|
95
|
+
export const AttributeEntryPassMacroRx: RegExp;
|
|
96
|
+
/**
|
|
97
|
+
* Matches an inline attribute reference.
|
|
98
|
+
* @example
|
|
99
|
+
* {foobar}
|
|
100
|
+
* {counter:sequence-name:1}
|
|
101
|
+
* {set:foo:bar}
|
|
102
|
+
*/
|
|
103
|
+
export const AttributeReferenceRx: RegExp;
|
|
104
|
+
/**
|
|
105
|
+
* Matches an anchor (id + optional reference text) on a line above a block.
|
|
106
|
+
* @example
|
|
107
|
+
* [[idname]]
|
|
108
|
+
* [[idname,Reference Text]]
|
|
109
|
+
*/
|
|
110
|
+
export const BlockAnchorRx: RegExp;
|
|
111
|
+
/**
|
|
112
|
+
* Matches an attribute list above a block element.
|
|
113
|
+
* @example
|
|
114
|
+
* [quote, Adam Smith, Wealth of Nations]
|
|
115
|
+
* [{lead}]
|
|
116
|
+
*/
|
|
117
|
+
export const BlockAttributeListRx: RegExp;
|
|
118
|
+
/** Combined pattern matching either a block anchor or a block attribute list. */
|
|
119
|
+
export const BlockAttributeLineRx: RegExp;
|
|
120
|
+
/**
|
|
121
|
+
* Matches a title above a block.
|
|
122
|
+
* @example
|
|
123
|
+
* .Title goes here
|
|
124
|
+
*/
|
|
125
|
+
export const BlockTitleRx: RegExp;
|
|
126
|
+
/**
|
|
127
|
+
* Matches an admonition label at the start of a paragraph.
|
|
128
|
+
* @example
|
|
129
|
+
* NOTE: Just a little note.
|
|
130
|
+
* TIP: Don't forget!
|
|
131
|
+
*/
|
|
132
|
+
export const AdmonitionParagraphRx: RegExp;
|
|
133
|
+
/**
|
|
134
|
+
* Matches a literal paragraph (line preceded by at least one space or tab).
|
|
135
|
+
* @example
|
|
136
|
+
* <SPACE>Foo
|
|
137
|
+
* <TAB>Foo
|
|
138
|
+
*/
|
|
139
|
+
export const LiteralParagraphRx: RegExp;
|
|
140
|
+
/**
|
|
141
|
+
* Matches an Atx (single-line) section title.
|
|
142
|
+
* @example
|
|
143
|
+
* == Foo
|
|
144
|
+
* == Foo ==
|
|
145
|
+
*/
|
|
146
|
+
export const AtxSectionTitleRx: RegExp;
|
|
147
|
+
/** Extended Atx section title supporting the Markdown variant (#). */
|
|
148
|
+
export const ExtAtxSectionTitleRx: RegExp;
|
|
149
|
+
/**
|
|
150
|
+
* Matches the first line of a Setext (two-line) section title.
|
|
151
|
+
* Must not start with '.' and must contain at least one alphanumeric character.
|
|
152
|
+
*/
|
|
153
|
+
export const SetextSectionTitleRx: RegExp;
|
|
154
|
+
/**
|
|
155
|
+
* Matches an anchor inside a section title.
|
|
156
|
+
* @example
|
|
157
|
+
* Section Title [[idname]]
|
|
158
|
+
* Section Title [[idname,Reference Text]]
|
|
159
|
+
*/
|
|
160
|
+
export const InlineSectionAnchorRx: RegExp;
|
|
161
|
+
/**
|
|
162
|
+
* Matches invalid ID characters in a section title.
|
|
163
|
+
* NOTE: Uppercase excluded; expression is run only on a lowercase string.
|
|
164
|
+
*/
|
|
165
|
+
export const InvalidSectionIdCharsRx: RegExp;
|
|
166
|
+
/** Matches an explicit section level style like sect1. */
|
|
167
|
+
export const SectionLevelStyleRx: RegExp;
|
|
168
|
+
/**
|
|
169
|
+
* Detects the start of any list item.
|
|
170
|
+
*
|
|
171
|
+
* NOTE: Check only up to the blank character since non-whitespace follows.
|
|
172
|
+
* IMPORTANT: Must agree with the per-list-type regexps or the parser will hang.
|
|
173
|
+
*/
|
|
174
|
+
export const AnyListRx: RegExp;
|
|
175
|
+
/**
|
|
176
|
+
* Matches an unordered list item.
|
|
177
|
+
* @example
|
|
178
|
+
* * Foo
|
|
179
|
+
* - Foo
|
|
180
|
+
*/
|
|
181
|
+
export const UnorderedListRx: RegExp;
|
|
182
|
+
/**
|
|
183
|
+
* Matches an ordered list item.
|
|
184
|
+
* @example
|
|
185
|
+
* . Foo 1. Foo a. Foo I. Foo
|
|
186
|
+
*/
|
|
187
|
+
export const OrderedListRx: RegExp;
|
|
188
|
+
export namespace OrderedListMarkerRxMap {
|
|
189
|
+
let arabic: RegExp;
|
|
190
|
+
let loweralpha: RegExp;
|
|
191
|
+
let lowerroman: RegExp;
|
|
192
|
+
let upperalpha: RegExp;
|
|
193
|
+
let upperroman: RegExp;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Matches a description list entry.
|
|
197
|
+
* @example
|
|
198
|
+
* foo::
|
|
199
|
+
* foo:: The metasyntactic variable …
|
|
200
|
+
*/
|
|
201
|
+
export const DescriptionListRx: RegExp;
|
|
202
|
+
/** Matches a sibling description list item (excluding the delimiter given by key). */
|
|
203
|
+
export const DescriptionListSiblingRx: {
|
|
204
|
+
'::': RegExp;
|
|
205
|
+
':::': RegExp;
|
|
206
|
+
'::::': RegExp;
|
|
207
|
+
';;': RegExp;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Matches a callout list item.
|
|
211
|
+
* @example
|
|
212
|
+
* <1> Explanation
|
|
213
|
+
* <.> Explanation with automatic number
|
|
214
|
+
*/
|
|
215
|
+
export const CalloutListRx: RegExp;
|
|
216
|
+
/**
|
|
217
|
+
* Matches a callout reference inside literal text (applied line-by-line).
|
|
218
|
+
*
|
|
219
|
+
* Group layout:
|
|
220
|
+
* 1 – optional line-comment prefix (// # -- ;;)
|
|
221
|
+
* 2 – backslash escape
|
|
222
|
+
* 3 – optional XML comment delimiter (--)
|
|
223
|
+
* 4 – callout number or dot
|
|
224
|
+
*/
|
|
225
|
+
export const CalloutExtractRx: RegExp;
|
|
226
|
+
/**
|
|
227
|
+
* Template string for CalloutExtractRxMap entries.
|
|
228
|
+
* Runtime value: (\\)?<()(\d+|\.)>(?=(?: ?\\?<(?:\d+|\.)>)*$)
|
|
229
|
+
* Note: 'm' flag added so $ matches end-of-line (Ruby regex default behaviour).
|
|
230
|
+
*/
|
|
231
|
+
export const CalloutExtractRxt: "(\\\\)?<()([\\d]+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)";
|
|
232
|
+
/**
|
|
233
|
+
* Lazy map: line-comment string → callout-extract regex.
|
|
234
|
+
* Mirrors Ruby: Hash.new { |h,k| h[k] = /(prefix)?#{CalloutExtractRxt}/ }
|
|
235
|
+
*/
|
|
236
|
+
export const CalloutExtractRxMap: any;
|
|
237
|
+
/** Matches a callout reference when scanning source (special chars NOT yet replaced). */
|
|
238
|
+
export const CalloutScanRx: RegExp;
|
|
239
|
+
/**
|
|
240
|
+
* Matches a callout reference in HTML output (special chars already replaced).
|
|
241
|
+
*
|
|
242
|
+
* Group layout mirrors CalloutExtractRx.
|
|
243
|
+
* Note: 'm' flag so $ matches end-of-line, matching Ruby regex semantics.
|
|
244
|
+
*/
|
|
245
|
+
export const CalloutSourceRx: RegExp;
|
|
246
|
+
/**
|
|
247
|
+
* Template string for CalloutSourceRxMap entries.
|
|
248
|
+
* Runtime value: (\\)?<()(\d+|\.)>(?=(?: ?\\?<(?:\d+|\.)>)*$)
|
|
249
|
+
*/
|
|
250
|
+
export const CalloutSourceRxt: "(\\\\)?<()([\\d]+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)";
|
|
251
|
+
/** Lazy map: line-comment string → callout-source regex. */
|
|
252
|
+
export const CalloutSourceRxMap: any;
|
|
253
|
+
export namespace ListRxMap {
|
|
254
|
+
export { UnorderedListRx as ulist };
|
|
255
|
+
export { OrderedListRx as olist };
|
|
256
|
+
export { DescriptionListRx as dlist };
|
|
257
|
+
export { CalloutListRx as colist };
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Parses the column test (colspec) for a table.
|
|
261
|
+
* @example
|
|
262
|
+
* 1*h,2*,^3e
|
|
263
|
+
*/
|
|
264
|
+
export const ColumnSpecRx: RegExp;
|
|
265
|
+
/**
|
|
266
|
+
* Parses the start of a cell test.
|
|
267
|
+
* @example
|
|
268
|
+
* 2.3+<.>m
|
|
269
|
+
*/
|
|
270
|
+
export const CellSpecStartRx: RegExp;
|
|
271
|
+
/** Parses the end of a cell test. */
|
|
272
|
+
export const CellSpecEndRx: RegExp;
|
|
273
|
+
/**
|
|
274
|
+
* Matches the custom block macro pattern.
|
|
275
|
+
* @example
|
|
276
|
+
* gist::123456[]
|
|
277
|
+
*/
|
|
278
|
+
export const CustomBlockMacroRx: RegExp;
|
|
279
|
+
/**
|
|
280
|
+
* Matches an image, video or audio block macro.
|
|
281
|
+
* @example
|
|
282
|
+
* image::filename.png[Caption]
|
|
283
|
+
* video::http://youtube.com/12345[Cats vs Dogs]
|
|
284
|
+
*/
|
|
285
|
+
export const BlockMediaMacroRx: RegExp;
|
|
286
|
+
/**
|
|
287
|
+
* Matches the TOC block macro.
|
|
288
|
+
* @example
|
|
289
|
+
* toc::[]
|
|
290
|
+
* toc::[levels=2]
|
|
291
|
+
*/
|
|
292
|
+
export const BlockTocMacroRx: RegExp;
|
|
293
|
+
/**
|
|
294
|
+
* Matches an anchor (id + optional reference text) in the flow of text.
|
|
295
|
+
*
|
|
296
|
+
* Group layout:
|
|
297
|
+
* 1 – backslash escape
|
|
298
|
+
* 2 – id (double-bracket form)
|
|
299
|
+
* 3 – reftext (double-bracket form)
|
|
300
|
+
* 4 – id (anchor: macro form)
|
|
301
|
+
* 5 – reftext (anchor: macro form)
|
|
302
|
+
* @example
|
|
303
|
+
* [[idname]]
|
|
304
|
+
* [[idname,Reference Text]]
|
|
305
|
+
* anchor:idname[]
|
|
306
|
+
* anchor:idname[Reference Text]
|
|
307
|
+
*/
|
|
308
|
+
export const InlineAnchorRx: RegExp;
|
|
309
|
+
/** Scans for a non-escaped anchor in the flow of text. */
|
|
310
|
+
export const InlineAnchorScanRx: RegExp;
|
|
311
|
+
/** Scans for a leading, non-escaped anchor. */
|
|
312
|
+
export const LeadingInlineAnchorRx: RegExp;
|
|
313
|
+
/**
|
|
314
|
+
* Matches a bibliography anchor at the start of a list item.
|
|
315
|
+
* @example
|
|
316
|
+
* [[[Fowler_1997]]] Fowler M. ...
|
|
317
|
+
*/
|
|
318
|
+
export const InlineBiblioAnchorRx: RegExp;
|
|
319
|
+
/**
|
|
320
|
+
* Matches an inline e-mail address.
|
|
321
|
+
* @example
|
|
322
|
+
* doc.writer@example.com
|
|
323
|
+
*/
|
|
324
|
+
export const InlineEmailRx: RegExp;
|
|
325
|
+
/**
|
|
326
|
+
* Matches an inline footnote macro (may span multiple lines).
|
|
327
|
+
*
|
|
328
|
+
* NOTE: [\s\S]*? allows multiline content (Ruby /m + CC_ALL).
|
|
329
|
+
* NOTE: (?!</a>) avoids matching inside an anchor tag.
|
|
330
|
+
* @example
|
|
331
|
+
* footnote:[text]
|
|
332
|
+
* footnote:id[text]
|
|
333
|
+
* footnoteref:[id,text] (legacy)
|
|
334
|
+
*/
|
|
335
|
+
export const InlineFootnoteMacroRx: RegExp;
|
|
336
|
+
/**
|
|
337
|
+
* Matches an image or icon inline macro (may span multiple lines).
|
|
338
|
+
* @example
|
|
339
|
+
* image:filename.png[Alt Text]
|
|
340
|
+
* icon:github[large]
|
|
341
|
+
*/
|
|
342
|
+
export const InlineImageMacroRx: RegExp;
|
|
343
|
+
/**
|
|
344
|
+
* Matches an indexterm inline macro (may span multiple lines).
|
|
345
|
+
* @example
|
|
346
|
+
* indexterm:[Tigers,Big cats]
|
|
347
|
+
* (((Tigers,Big cats)))
|
|
348
|
+
* ((Tigers))
|
|
349
|
+
*/
|
|
350
|
+
export const InlineIndextermMacroRx: RegExp;
|
|
351
|
+
/**
|
|
352
|
+
* Matches either the kbd or btn inline macro (may span multiple lines).
|
|
353
|
+
* @example
|
|
354
|
+
* kbd:[F3] kbd:[Ctrl+Shift+T] btn:[Save]
|
|
355
|
+
*/
|
|
356
|
+
export const InlineKbdBtnMacroRx: RegExp;
|
|
357
|
+
/**
|
|
358
|
+
* Matches an implicit link and the link inline macro.
|
|
359
|
+
*
|
|
360
|
+
* NOTE: This is the Opal/JS variant of the pattern.
|
|
361
|
+
* Group 2 captures ':' inside a lookahead from the <<protocol> branch.
|
|
362
|
+
* (?!\2) then guards the >-terminated branch: when group 2 IS ':',
|
|
363
|
+
* the guard prevents matching '://' at the start of the path; when group 2
|
|
364
|
+
* is UNSET (other prefix branches), (?!\2) expands to (?!"") which ALWAYS
|
|
365
|
+
* FAILS – correctly preventing the > branch for non-< prefixes.
|
|
366
|
+
*
|
|
367
|
+
* *** NO 'u' FLAG: the (?!\2) guard relies on unset back-references matching
|
|
368
|
+
* the empty string, which only holds in non-Unicode mode. ***
|
|
369
|
+
*
|
|
370
|
+
* Group layout:
|
|
371
|
+
* 1 – prefix (^, link:, blank, \\?< or punctuation)
|
|
372
|
+
* 2 – ':' captured by lookahead (only when prefix is \\?<)
|
|
373
|
+
* 3 – URL scheme + ://
|
|
374
|
+
* 4 – target before [ (formal macro)
|
|
375
|
+
* 5 – attrlist (formal macro, may be empty)
|
|
376
|
+
* 6 – target before > (angle-bracket autolink, requires < prefix)
|
|
377
|
+
* 7 – target (bare autolink)
|
|
378
|
+
* 8 – last non-terminating char of bare target
|
|
379
|
+
* @example
|
|
380
|
+
* https://github.com
|
|
381
|
+
* https://github.com[GitHub]
|
|
382
|
+
* <https://github.com>
|
|
383
|
+
* link:https://github.com[]
|
|
384
|
+
*/
|
|
385
|
+
export const InlineLinkRx: RegExp;
|
|
386
|
+
/**
|
|
387
|
+
* Matches a link or e-mail inline macro (may span multiple lines).
|
|
388
|
+
* @example
|
|
389
|
+
* link:path[label]
|
|
390
|
+
* mailto:doc.writer@example.com[]
|
|
391
|
+
*/
|
|
392
|
+
export const InlineLinkMacroRx: RegExp;
|
|
393
|
+
/** Matches the name of a macro. */
|
|
394
|
+
export const MacroNameRx: RegExp;
|
|
395
|
+
/**
|
|
396
|
+
* Matches a stem (and alternatives) inline macro (may span multiple lines).
|
|
397
|
+
* @example
|
|
398
|
+
* stem:[x != 0]
|
|
399
|
+
* latexmath:[\sqrt{4} = 2]
|
|
400
|
+
*/
|
|
401
|
+
export const InlineStemMacroRx: RegExp;
|
|
402
|
+
/**
|
|
403
|
+
* Matches a menu inline macro (may span multiple lines).
|
|
404
|
+
* @example
|
|
405
|
+
* menu:File[Save As...]
|
|
406
|
+
* menu:View[Page Style > No Style]
|
|
407
|
+
*/
|
|
408
|
+
export const InlineMenuMacroRx: RegExp;
|
|
409
|
+
/**
|
|
410
|
+
* Matches an implicit menu inline macro.
|
|
411
|
+
* @example
|
|
412
|
+
* "File > New..."
|
|
413
|
+
*/
|
|
414
|
+
export const InlineMenuRx: RegExp;
|
|
415
|
+
export namespace InlinePassRx {
|
|
416
|
+
let _false: (string | RegExp)[];
|
|
417
|
+
export { _false as false };
|
|
418
|
+
let _true: (string | RegExp)[];
|
|
419
|
+
export { _true as true };
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Matches several variants of the passthrough inline macro (may span multiple lines).
|
|
423
|
+
*
|
|
424
|
+
* Group layout:
|
|
425
|
+
* 1 – optional backslash before attribute list
|
|
426
|
+
* 2 – attribute list content (QuoteAttributeListRxt)
|
|
427
|
+
* 3 – backslash(es) before delimiter (0–2)
|
|
428
|
+
* 4 – delimiter: +++, ++, or $$
|
|
429
|
+
* 5 – content between delimiters (\4 closes)
|
|
430
|
+
* 6 – backslash before pass: macro
|
|
431
|
+
* 7 – subs list after pass:
|
|
432
|
+
* 8 – content inside pass:[…]
|
|
433
|
+
* @example
|
|
434
|
+
* +++text+++
|
|
435
|
+
* $$text$$
|
|
436
|
+
* pass:quotes[text]
|
|
437
|
+
* pass:[]
|
|
438
|
+
*/
|
|
439
|
+
export const InlinePassMacroRx: RegExp;
|
|
440
|
+
/**
|
|
441
|
+
* Matches an xref (cross-reference) inline macro (may span multiple lines).
|
|
442
|
+
*
|
|
443
|
+
* NOTE: { included to support targets beginning with an attribute reference.
|
|
444
|
+
* NOTE: Special characters are already entity-encoded in the matched text.
|
|
445
|
+
*
|
|
446
|
+
* Group layout:
|
|
447
|
+
* 1 – target of <<…>> form
|
|
448
|
+
* 2 – target of xref:…[] form
|
|
449
|
+
* 3 – link text inside xref:…[…]
|
|
450
|
+
* @example
|
|
451
|
+
* <<id,reftext>>
|
|
452
|
+
* xref:id[reftext]
|
|
453
|
+
*/
|
|
454
|
+
export const InlineXrefMacroRx: RegExp;
|
|
455
|
+
/**
|
|
456
|
+
* Matches a trailing + preceded by at least one space, forcing a hard line break.
|
|
457
|
+
*
|
|
458
|
+
* NOTE: 'm' flag required so that ^ / $ are line anchors (not string anchors) in JS.
|
|
459
|
+
* @example
|
|
460
|
+
* Humpty Dumpty sat on a wall, +
|
|
461
|
+
* Humpty Dumpty had a great fall.
|
|
462
|
+
*/
|
|
463
|
+
export const HardLineBreakRx: RegExp;
|
|
464
|
+
/**
|
|
465
|
+
* Matches a Markdown horizontal rule.
|
|
466
|
+
* @example
|
|
467
|
+
* --- or - - -
|
|
468
|
+
* *** or * * *
|
|
469
|
+
* ___ or _ _ _
|
|
470
|
+
*/
|
|
471
|
+
export const MarkdownThematicBreakRx: RegExp;
|
|
472
|
+
/**
|
|
473
|
+
* Matches an AsciiDoc or Markdown horizontal rule, or an AsciiDoc page break.
|
|
474
|
+
* @example
|
|
475
|
+
* ''' <<< --- *** ___
|
|
476
|
+
*/
|
|
477
|
+
export const ExtLayoutBreakRx: RegExp;
|
|
478
|
+
/** Matches consecutive blank lines. */
|
|
479
|
+
export const BlankLineRx: RegExp;
|
|
480
|
+
/**
|
|
481
|
+
* Matches whitespace escaped by a backslash.
|
|
482
|
+
* @example
|
|
483
|
+
* three\ blind\ mice
|
|
484
|
+
*/
|
|
485
|
+
export const EscapedSpaceRx: RegExp;
|
|
486
|
+
/** Detects text that may contain replaceable characters. */
|
|
487
|
+
export const ReplaceableTextRx: RegExp;
|
|
488
|
+
/**
|
|
489
|
+
* Matches a whitespace delimiter (space, tab, newline).
|
|
490
|
+
* Replicates the parsing rules of Ruby %w strings.
|
|
491
|
+
*
|
|
492
|
+
* TODO: Replace with /(?<!\\)[ \t\n]+/ when lookbehind is universally available.
|
|
493
|
+
*/
|
|
494
|
+
export const SpaceDelimiterRx: RegExp;
|
|
495
|
+
/** Matches a + or - modifier in a subs list. */
|
|
496
|
+
export const SubModifierSniffRx: RegExp;
|
|
497
|
+
/**
|
|
498
|
+
* Matches one or more consecutive digits at the end of a line.
|
|
499
|
+
* @example
|
|
500
|
+
* docbook5 html5
|
|
501
|
+
*/
|
|
502
|
+
export const TrailingDigitsRx: RegExp;
|
|
503
|
+
/**
|
|
504
|
+
* Detects strings that resemble URIs.
|
|
505
|
+
*
|
|
506
|
+
* NOTE: ^ is used as a string-start anchor (no 'm' flag), equivalent to Ruby \A.
|
|
507
|
+
* NOTE: Does NOT match Windows paths like c:/sample.adoc or c:\sample.adoc.
|
|
508
|
+
* @example
|
|
509
|
+
* http://domain https://domain file:///path data:info
|
|
510
|
+
*/
|
|
511
|
+
export const UriSniffRx: RegExp;
|
|
512
|
+
/** Detects XML tags. */
|
|
513
|
+
export const XmlSanitizeRx: RegExp;
|