@helloao/tools 0.0.5 → 0.0.6-alpha
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/LICENSE +21 -21
- package/README.md +98 -98
- package/dist/cjs/generation/api.cjs +240 -0
- package/dist/cjs/generation/api.cjs.map +7 -0
- package/dist/cjs/generation/audio.cjs +83 -0
- package/dist/cjs/generation/audio.cjs.map +7 -0
- package/dist/cjs/generation/book-order.cjs +508 -0
- package/dist/cjs/generation/book-order.cjs.map +7 -0
- package/dist/cjs/generation/common-types.cjs +17 -0
- package/dist/cjs/generation/common-types.cjs.map +7 -0
- package/dist/cjs/generation/dataset.cjs +158 -0
- package/dist/cjs/generation/dataset.cjs.map +7 -0
- package/dist/cjs/generation/index.cjs +51 -0
- package/dist/cjs/generation/index.cjs.map +7 -0
- package/dist/cjs/index.cjs +45 -0
- package/dist/cjs/index.cjs.map +7 -0
- package/dist/cjs/parser/codex-parser.cjs +176 -0
- package/dist/cjs/parser/codex-parser.cjs.map +7 -0
- package/dist/cjs/parser/index.cjs +48 -0
- package/dist/cjs/parser/index.cjs.map +7 -0
- package/dist/cjs/parser/iterators.cjs +204 -0
- package/dist/cjs/parser/iterators.cjs.map +7 -0
- package/dist/cjs/parser/types.cjs +17 -0
- package/dist/cjs/parser/types.cjs.map +7 -0
- package/dist/cjs/parser/usfm-parser.cjs +791 -0
- package/dist/cjs/parser/usfm-parser.cjs.map +7 -0
- package/dist/cjs/parser/usx-parser.cjs +471 -0
- package/dist/cjs/parser/usx-parser.cjs.map +7 -0
- package/dist/cjs/utils.cjs +85 -0
- package/dist/cjs/utils.cjs.map +7 -0
- package/dist/esm/generation/api.js +198 -0
- package/dist/esm/generation/api.js.map +7 -0
- package/dist/esm/generation/audio.js +53 -0
- package/dist/esm/generation/audio.js.map +7 -0
- package/dist/esm/generation/book-order.js +478 -0
- package/dist/esm/generation/book-order.js.map +7 -0
- package/dist/esm/generation/common-types.js +2 -0
- package/dist/esm/generation/common-types.js.map +7 -0
- package/dist/esm/generation/dataset.js +132 -0
- package/dist/esm/generation/dataset.js.map +7 -0
- package/dist/esm/generation/index.js +8 -0
- package/dist/esm/generation/index.js.map +7 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/parser/codex-parser.js +144 -0
- package/dist/esm/parser/codex-parser.js.map +7 -0
- package/dist/esm/parser/index.js +8 -0
- package/dist/esm/parser/index.js.map +7 -0
- package/dist/esm/parser/iterators.js +152 -0
- package/dist/esm/parser/iterators.js.map +7 -0
- package/dist/esm/parser/types.js +2 -0
- package/dist/esm/parser/types.js.map +7 -0
- package/dist/esm/parser/usfm-parser.js +749 -0
- package/dist/esm/parser/usfm-parser.js.map +7 -0
- package/dist/esm/parser/usx-parser.js +447 -0
- package/dist/esm/parser/usx-parser.js.map +7 -0
- package/dist/esm/utils.js +51 -0
- package/dist/esm/utils.js.map +7 -0
- package/{generation → dist/types/generation}/api.d.ts +14 -2
- package/{generation → dist/types/generation}/audio.d.ts +1 -1
- package/{generation → dist/types/generation}/dataset.d.ts +1 -1
- package/dist/types/generation/index.d.ts +7 -0
- package/dist/types/index.d.ts +5 -0
- package/{parser → dist/types/parser}/codex-parser.d.ts +1 -1
- package/dist/types/parser/index.d.ts +7 -0
- package/{parser → dist/types/parser}/usfm-parser.d.ts +1 -1
- package/{parser → dist/types/parser}/usx-parser.d.ts +2 -2
- package/package.json +25 -4
- package/typings/types.d.ts +13 -13
- package/generation/api.js +0 -179
- package/generation/api.spec.d.ts +0 -2
- package/generation/api.spec.js +0 -656
- package/generation/audio.js +0 -60
- package/generation/audio.spec.d.ts +0 -2
- package/generation/audio.spec.js +0 -36
- package/generation/book-order.js +0 -494
- package/generation/book-order.spec.d.ts +0 -2
- package/generation/book-order.spec.js +0 -8
- package/generation/common-types.js +0 -2
- package/generation/dataset.js +0 -106
- package/generation/index.d.ts +0 -7
- package/generation/index.js +0 -38
- package/index.d.ts +0 -5
- package/index.js +0 -32
- package/parser/codex-parser.js +0 -160
- package/parser/codex-parser.spec.d.ts +0 -2
- package/parser/codex-parser.spec.js +0 -645
- package/parser/index.d.ts +0 -7
- package/parser/index.js +0 -35
- package/parser/iterators.js +0 -222
- package/parser/iterators.spec.d.ts +0 -2
- package/parser/iterators.spec.js +0 -174
- package/parser/types.js +0 -2
- package/parser/usfm-parser.js +0 -840
- package/parser/usfm-parser.spec.d.ts +0 -2
- package/parser/usfm-parser.spec.js +0 -1593
- package/parser/usx-parser.js +0 -425
- package/parser/usx-parser.spec.d.ts +0 -2
- package/parser/usx-parser.spec.js +0 -1260
- package/utils.js +0 -73
- package/utils.spec.d.ts +0 -2
- package/utils.spec.js +0 -42
- /package/{generation → dist/types/generation}/book-order.d.ts +0 -0
- /package/{generation → dist/types/generation}/common-types.d.ts +0 -0
- /package/{parser → dist/types/parser}/iterators.d.ts +0 -0
- /package/{parser → dist/types/parser}/types.d.ts +0 -0
- /package/{utils.d.ts → dist/types/utils.d.ts} +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var iterators_exports = {};
|
|
20
|
+
__export(iterators_exports, {
|
|
21
|
+
Rewindable: () => Rewindable,
|
|
22
|
+
batch: () => batch,
|
|
23
|
+
children: () => children,
|
|
24
|
+
debug: () => debug,
|
|
25
|
+
elements: () => elements,
|
|
26
|
+
isParent: () => isParent,
|
|
27
|
+
iterateAll: () => iterateAll,
|
|
28
|
+
iterateUntil: () => iterateUntil,
|
|
29
|
+
matchingParent: () => matchingParent,
|
|
30
|
+
parentChar: () => parentChar,
|
|
31
|
+
parentNote: () => parentNote,
|
|
32
|
+
rewindable: () => rewindable,
|
|
33
|
+
toAsyncIterable: () => toAsyncIterable,
|
|
34
|
+
uncompletable: () => uncompletable
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(iterators_exports);
|
|
37
|
+
class Rewindable {
|
|
38
|
+
buffer = [];
|
|
39
|
+
_bufferSize = 0;
|
|
40
|
+
_position = -1;
|
|
41
|
+
_iterator;
|
|
42
|
+
constructor(iterator, bufferSize = 2) {
|
|
43
|
+
this._iterator = iterator;
|
|
44
|
+
this._bufferSize = bufferSize;
|
|
45
|
+
if (this._iterator.return) {
|
|
46
|
+
this.return = (value) => {
|
|
47
|
+
return this._iterator.return(value);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (this._iterator.throw) {
|
|
51
|
+
this.throw = (value) => {
|
|
52
|
+
return this._iterator.throw(value);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
rewind(number) {
|
|
57
|
+
this._position += number;
|
|
58
|
+
}
|
|
59
|
+
[Symbol.iterator]() {
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
next(...args) {
|
|
63
|
+
if (this._position >= 0) {
|
|
64
|
+
let item = this.buffer[this._position];
|
|
65
|
+
this._position--;
|
|
66
|
+
return {
|
|
67
|
+
value: item,
|
|
68
|
+
done: false
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
let result = this._iterator.next(...args);
|
|
72
|
+
this.buffer.unshift(result.value);
|
|
73
|
+
if (this.buffer.length > this._bufferSize) {
|
|
74
|
+
this.buffer.splice(this._bufferSize, this.buffer.length - this._bufferSize);
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function* debug(label, iterator) {
|
|
80
|
+
for (let value of uncompletable(iterator)) {
|
|
81
|
+
if (value instanceof Element) {
|
|
82
|
+
console.log(label, value.outerHTML);
|
|
83
|
+
} else if (value instanceof Node) {
|
|
84
|
+
console.log(label, value.textContent);
|
|
85
|
+
} else {
|
|
86
|
+
console.log(label, value);
|
|
87
|
+
}
|
|
88
|
+
yield value;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function rewindable(iterator, bufferSize = 2) {
|
|
92
|
+
return new Rewindable(iterator, bufferSize);
|
|
93
|
+
}
|
|
94
|
+
function* iterateNodes(node) {
|
|
95
|
+
for (let i = 0; i < node.childNodes.length; i++) {
|
|
96
|
+
yield node.childNodes[i];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function parentChar(node) {
|
|
100
|
+
return matchingParent(node, (n) => n instanceof Element && n.nodeName === "char");
|
|
101
|
+
}
|
|
102
|
+
function parentNote(node) {
|
|
103
|
+
return matchingParent(node, (n) => n instanceof Element && n.nodeName === "note");
|
|
104
|
+
}
|
|
105
|
+
function matchingParent(node, filter) {
|
|
106
|
+
let parent = node.parentNode;
|
|
107
|
+
while (parent) {
|
|
108
|
+
if (filter(parent)) {
|
|
109
|
+
return parent;
|
|
110
|
+
}
|
|
111
|
+
parent = parent.parentNode;
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
function isParent(node, parent) {
|
|
116
|
+
let parentNode = node.parentNode;
|
|
117
|
+
while (parentNode) {
|
|
118
|
+
if (parentNode === parent) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
parentNode = parentNode.parentNode;
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
function iterateAll(node) {
|
|
126
|
+
return rewindable(_iterateAll(node));
|
|
127
|
+
}
|
|
128
|
+
function* iterateUntil(iterator, predicate) {
|
|
129
|
+
for (let value of iterator) {
|
|
130
|
+
if (predicate(value)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
yield value;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function* _iterateAll(node) {
|
|
137
|
+
for (let child of node.childNodes) {
|
|
138
|
+
yield child;
|
|
139
|
+
yield* iterateAll(child);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function* elements(iterator) {
|
|
143
|
+
for (let node of uncompletable(iterator)) {
|
|
144
|
+
if (node instanceof Element) {
|
|
145
|
+
yield node;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function* children(iterator, parent) {
|
|
150
|
+
for (let node of uncompletable(iterator)) {
|
|
151
|
+
if (!isParent(node, parent)) {
|
|
152
|
+
iterator.rewind(1);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
yield node;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function* uncompletable(iterable) {
|
|
159
|
+
while (true) {
|
|
160
|
+
const { done, value } = iterable.next();
|
|
161
|
+
if (done) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
yield value;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async function* toAsyncIterable(input) {
|
|
168
|
+
for (let item of input) {
|
|
169
|
+
yield item;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function* batch(input, batchSize) {
|
|
173
|
+
while (true) {
|
|
174
|
+
let batch2 = [];
|
|
175
|
+
for (let item of input) {
|
|
176
|
+
batch2.push(item);
|
|
177
|
+
if (batch2.length >= batchSize) {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (batch2.length === 0) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
yield batch2;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
188
|
+
0 && (module.exports = {
|
|
189
|
+
Rewindable,
|
|
190
|
+
batch,
|
|
191
|
+
children,
|
|
192
|
+
debug,
|
|
193
|
+
elements,
|
|
194
|
+
isParent,
|
|
195
|
+
iterateAll,
|
|
196
|
+
iterateUntil,
|
|
197
|
+
matchingParent,
|
|
198
|
+
parentChar,
|
|
199
|
+
parentNote,
|
|
200
|
+
rewindable,
|
|
201
|
+
toAsyncIterable,
|
|
202
|
+
uncompletable
|
|
203
|
+
});
|
|
204
|
+
//# sourceMappingURL=iterators.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../parser/iterators.ts"],
|
|
4
|
+
"sourcesContent": ["\r\n/**\r\n * Defines an interface that represents an iterator that can be rewound.\r\n */\r\nexport interface RewindableIterator<T> extends IterableIterator<T> {\r\n /**\r\n * Rewinds the iterator by the specified number of elements.\r\n * @param number The number of elements to rewind.\r\n */\r\n rewind(number: number): void;\r\n}\r\n\r\n/**\r\n * Defines a class that implements an iterator that can be rewound.\r\n */\r\nexport class Rewindable<T> implements RewindableIterator<T> {\r\n buffer: T[] = [];\r\n\r\n private _bufferSize: number = 0;\r\n private _position: number = -1;\r\n private _iterator: IterableIterator<T>;\r\n\r\n constructor(iterator: IterableIterator<T>, bufferSize: number = 2) {\r\n this._iterator = iterator;\r\n this._bufferSize = bufferSize;\r\n\r\n if(this._iterator.return) {\r\n this.return = (value?: any) => {\r\n return this._iterator.return!(value);\r\n };\r\n }\r\n if(this._iterator.throw) {\r\n this.throw = (value?: any) => {\r\n return this._iterator.throw!(value);\r\n };\r\n }\r\n }\r\n\r\n rewind(number: number): void {\r\n this._position += number;\r\n }\r\n\r\n [Symbol.iterator](): IterableIterator<T> {\r\n return this;\r\n }\r\n\r\n next(...args: [] | [undefined]): IteratorResult<T, any> {\r\n if (this._position >= 0) {\r\n let item = this.buffer[this._position];\r\n this._position--;\r\n return {\r\n value: item,\r\n done: false\r\n };\r\n }\r\n\r\n let result = this._iterator.next(...args);\r\n this.buffer.unshift(result.value);\r\n if (this.buffer.length > this._bufferSize) {\r\n this.buffer.splice(this._bufferSize, this.buffer.length - this._bufferSize);\r\n }\r\n return result;\r\n }\r\n\r\n return?(value?: any): IteratorResult<T, any>;\r\n throw?(e?: any): IteratorResult<T, any>;\r\n}\r\n\r\nexport function *debug(label: string, iterator: IterableIterator<any>) {\r\n for (let value of uncompletable(iterator)) {\r\n if (value instanceof Element) {\r\n console.log(label, value.outerHTML);\r\n } else if(value instanceof Node) {\r\n console.log(label, value.textContent);\r\n } else {\r\n console.log(label, value);\r\n }\r\n yield value;\r\n }\r\n}\r\n\r\n/**\r\n * Creates a new rewindable iterator from the given iterator.\r\n * @param iterator The iterator.\r\n * @param bufferSize The size of the buffer.\r\n */\r\nexport function rewindable<T>(iterator: IterableIterator<T>, bufferSize: number = 2): Rewindable<T> {\r\n return new Rewindable(iterator, bufferSize);\r\n}\r\n\r\n\r\nfunction *iterateNodes(node: Node) {\r\n for(let i = 0; i < node.childNodes.length; i++) {\r\n yield node.childNodes[i];\r\n }\r\n}\r\n\r\n/**\r\n * Gets the char element that is the parent of the given node.\r\n * @param node The node.\r\n */\r\nexport function parentChar(node: Node): Element | null {\r\n return matchingParent(node, n => n instanceof Element && n.nodeName === 'char') as Element | null;\r\n}\r\n\r\n/**\r\n * Gets the note element that is the parent of the given node.\r\n * @param node The node.\r\n */\r\nexport function parentNote(node: Node): Element | null {\r\n return matchingParent(node, n => n instanceof Element && n.nodeName === 'note') as Element | null;\r\n}\r\n\r\n/**\r\n * Gets the parent node that matches the given filter.\r\n * @param node The node to start the search from.\r\n * @param filter The filter that should be used.\r\n */\r\nexport function matchingParent(node: Node, filter: (node: Node) => boolean): Node | null {\r\n let parent = node.parentNode;\r\n while(parent) {\r\n if (filter(parent)) {\r\n return parent;\r\n }\r\n parent = parent.parentNode;\r\n }\r\n return null;\r\n}\r\n\r\n/**\r\n * Determines if the given node is a child of the parent node.\r\n * @param node The node to test.\r\n * @param parent The parent.\r\n * @returns \r\n */\r\nexport function isParent(node: Node, parent: Node): boolean {\r\n let parentNode = node.parentNode;\r\n while(parentNode) {\r\n if (parentNode === parent) {\r\n return true;\r\n }\r\n parentNode = parentNode.parentNode;\r\n }\r\n return false;\r\n}\r\n\r\n/**\r\n * Iterates through all of the nodes in the tree in a depth-first traversal.\r\n * @param node The node to start the traversal from. \r\n */\r\nexport function iterateAll(node: Node): RewindableIterator<Node> {\r\n return rewindable(_iterateAll(node));\r\n}\r\n\r\nexport function *iterateUntil<T>(iterator: IterableIterator<T>, predicate: (value: T) => boolean): IterableIterator<T> {\r\n for(let value of iterator) {\r\n if (predicate(value)) {\r\n return;\r\n }\r\n yield value;\r\n }\r\n}\r\n\r\nfunction *_iterateAll(node: Node): IterableIterator<Node> {\r\n for(let child of node.childNodes) {\r\n yield child;\r\n yield *iterateAll(child);\r\n }\r\n}\r\n\r\n/**\r\n * Iterates only the elements in the iterator.\r\n * @param iterator The iterator that should be used.\r\n */\r\nexport function *elements(iterator: IterableIterator<Node>): IterableIterator<Element> {\r\n for (let node of uncompletable(iterator)) {\r\n if (node instanceof Element) {\r\n yield node;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Iterates only the children of the given node in the iterator.\r\n * @param iterator The iterator that should be used.\r\n * @param parent The parent node.\r\n */\r\nexport function *children(iterator: RewindableIterator<Node>, parent: Node): IterableIterator<Node> {\r\n for (let node of uncompletable(iterator)) {\r\n if (!isParent(node, parent)) {\r\n iterator.rewind(1);\r\n return;\r\n }\r\n\r\n yield node;\r\n }\r\n}\r\n\r\n/**\r\n * Wraps the given iterable in a generator that will prevent consumers from calling return() on the iterator.\r\n * @param iterable The iterable.\r\n */\r\nexport function *uncompletable<T>(iterable: IterableIterator<T>): IterableIterator<T> {\r\n while(true) {\r\n const { done, value } = iterable.next();\r\n if (done) {\r\n return;\r\n }\r\n yield value;\r\n }\r\n}\r\n\r\n/**\r\n * Converts the given iterable into an async iterable.\r\n * @param input The input iterable.\r\n */\r\nexport async function *toAsyncIterable<T>(input: Iterable<T>): AsyncIterable<T> {\r\n for (let item of input) {\r\n yield item;\r\n }\r\n}\r\n\r\n/**\r\n * Batches items from the given iterator.\r\n * @param input The input iterator.\r\n * @param batchSize The size of each batch.\r\n */\r\nexport function* batch<T>(input: Iterable<T>, batchSize: number): Iterable<T[]> {\r\n while(true) {\r\n let batch = [] as T[];\r\n for (let item of input) {\r\n batch.push(item);\r\n if (batch.length >= batchSize) {\r\n break;\r\n }\r\n }\r\n\r\n if (batch.length === 0) {\r\n return;\r\n }\r\n\r\n yield batch;\r\n }\r\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,MAAM,WAA+C;AAAA,EACxD,SAAc,CAAC;AAAA,EAEP,cAAsB;AAAA,EACtB,YAAoB;AAAA,EACpB;AAAA,EAER,YAAY,UAA+B,aAAqB,GAAG;AAC/D,SAAK,YAAY;AACjB,SAAK,cAAc;AAEnB,QAAG,KAAK,UAAU,QAAQ;AACtB,WAAK,SAAS,CAAC,UAAgB;AAC3B,eAAO,KAAK,UAAU,OAAQ,KAAK;AAAA,MACvC;AAAA,IACJ;AACA,QAAG,KAAK,UAAU,OAAO;AACrB,WAAK,QAAQ,CAAC,UAAgB;AAC1B,eAAO,KAAK,UAAU,MAAO,KAAK;AAAA,MACtC;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,OAAO,QAAsB;AACzB,SAAK,aAAa;AAAA,EACtB;AAAA,EAEA,CAAC,OAAO,QAAQ,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KAAK,IAAI;AACf,UAAIA,OAAM,UAAU,WAAW;AAC3B;AAAA,MACJ;AAAA,IACJ;AAEA,QAAIA,OAAM,WAAW,GAAG;AACpB;AAAA,IACJ;AAEA,UAAMA;AAAA,EACV;AACJ;",
|
|
6
|
+
"names": ["batch"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../parser/types.ts"],
|
|
4
|
+
"sourcesContent": ["\r\n/**\r\n * The parse tree that is gathered.\r\n */\r\nexport interface ParseTree {\r\n type: 'root';\r\n\r\n /**\r\n * The ID of the parse tree.\r\n */\r\n id?: string;\r\n\r\n /**\r\n * The header that was associated with the tree.\r\n */\r\n header?: string;\r\n\r\n /**\r\n * The major title that was associated with the tree.\r\n */\r\n title?: string;\r\n\r\n /**\r\n * The list of chapters for the tree.\r\n */\r\n content: (Heading | Chapter)[];\r\n}\r\n\r\nexport interface Heading {\r\n type: 'heading';\r\n content: string[];\r\n}\r\n\r\nexport type ChapterContent = (Heading | Verse | HebrewSubtitle | LineBreak);\r\n\r\nexport type VerseContent = string | FootnoteReference | Text;\r\n\r\n/**\r\n * Defines an interface that represents a chapter.\r\n */\r\nexport interface Chapter {\r\n type: 'chapter';\r\n number: number;\r\n\r\n /**\r\n * The contents of the chapter.\r\n */\r\n content: ChapterContent[];\r\n\r\n /**\r\n * The list of footnotes for the chapter.\r\n */\r\n footnotes: Footnote[];\r\n}\r\n\r\n/**\r\n * Defines an interface that represents a hebrew subtitle.\r\n */\r\nexport interface HebrewSubtitle {\r\n type: 'hebrew_subtitle';\r\n\r\n /**\r\n * The contents of the subtitle.\r\n */\r\n content: (string | Text | FootnoteReference)[];\r\n}\r\n\r\n/**\r\n * Defines an interface that represents a verse.\r\n */\r\nexport interface Verse {\r\n type: 'verse';\r\n\r\n number: number;\r\n\r\n /**\r\n * The contents of the verse.\r\n */\r\n content: (string | Text | InlineHeading | InlineLineBreak | FootnoteReference)[];\r\n}\r\n\r\n/**\r\n * Defines an interface that represents text that has some markup attributes applied to it.\r\n */\r\nexport interface Text {\r\n\r\n /**\r\n * The text that is contained.\r\n */\r\n text: string;\r\n\r\n /**\r\n * Whether the text represents a poem.\r\n * The number indicates the level of indent.\r\n */\r\n poem?: number;\r\n\r\n /**\r\n * Whether the text contains the words of Jesus.\r\n */\r\n wordsOfJesus?: boolean;\r\n\r\n /**\r\n * Whether the text is descriptive.\r\n * \r\n * This is only used for \"hebrew subtitles\" that are included inside the verse markers.\r\n */\r\n descriptive?: boolean;\r\n}\r\n\r\n/**\r\n * Defines an interface that represents a heading that is embedded in a verse.\r\n */\r\nexport interface InlineHeading {\r\n /**\r\n * The text of the heading.\r\n */\r\n heading: string;\r\n}\r\n\r\n/**\r\n * Defines an interface that represents a line break that is embedded in a verse.\r\n */\r\nexport interface InlineLineBreak {\r\n lineBreak: true;\r\n}\r\n\r\nexport interface FootnoteReference {\r\n /**\r\n * The ID of the note that is referenced.\r\n */\r\n noteId: number;\r\n}\r\n\r\nexport interface Footnote {\r\n noteId: number;\r\n\r\n /**\r\n * The text of the footnote.\r\n */\r\n text: string;\r\n\r\n /**\r\n * The caller that should be used for the footnote.\r\n * For footnotes, a \"caller\" is the character that is used in the text to reference to footnote.\r\n * \r\n * For example, in the text:\r\n * Hello (a) World\r\n * \r\n * ----\r\n * (a) This is a footnote.\r\n * \r\n * The \"(a)\" is the caller.\r\n * \r\n * If \"+\", then the caller should be autogenerated.\r\n * If null, then the caller should be empty.\r\n * If a string, then the caller should be that string.\r\n */\r\n caller: '+' | string | null;\r\n\r\n /**\r\n * The verse reference for the footnote.\r\n */\r\n reference?: {\r\n chapter: number,\r\n verse: number\r\n };\r\n}\r\n\r\nexport interface LineBreak {\r\n type: 'line_break';\r\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|