flappa-doormal 1.0.0
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.md +7 -0
- package/README.md +357 -0
- package/dist/index.d.mts +460 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +517 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +50 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Numbering styles for markers
|
|
4
|
+
*/
|
|
5
|
+
type NumberingStyle = 'arabic-indic' | 'latin';
|
|
6
|
+
/**
|
|
7
|
+
* Separator styles for markers
|
|
8
|
+
*/
|
|
9
|
+
type SeparatorStyle = 'dash' | 'dot' | 'paren' | 'colon' | 'none';
|
|
10
|
+
/**
|
|
11
|
+
* Marker types for text segmentation
|
|
12
|
+
*/
|
|
13
|
+
type MarkerType = 'numbered' | 'bullet' | 'heading' | 'pattern' | 'bab' | 'hadith-chain' | 'basmala' | 'phrase' | 'square-bracket' | 'num-letter' | 'num-paren' | 'num-slash';
|
|
14
|
+
/**
|
|
15
|
+
* Configuration for a single marker pattern
|
|
16
|
+
*/
|
|
17
|
+
type MarkerConfig = {
|
|
18
|
+
/** The type of marker to look for */
|
|
19
|
+
type: MarkerType;
|
|
20
|
+
/** For numbered markers, the digit style */
|
|
21
|
+
numbering?: NumberingStyle;
|
|
22
|
+
/** The separator that follows the marker */
|
|
23
|
+
separator?: SeparatorStyle | string;
|
|
24
|
+
/**
|
|
25
|
+
* Template format for numbered markers using token syntax.
|
|
26
|
+
* Example: '{bullet}+ {num} {dash}'
|
|
27
|
+
* Only valid when type is 'numbered'.
|
|
28
|
+
*/
|
|
29
|
+
format?: string;
|
|
30
|
+
/**
|
|
31
|
+
* For 'pattern' type, provide a template using tokens like {num}, {dash}, {bullet}.
|
|
32
|
+
* For raw regex patterns that don't use templates, provide the raw pattern string here.
|
|
33
|
+
* Example: '{bullet}? {num}+ {s}{dash}' or '^[•*°]? ([\\u0660-\\u0669]+\\s?[-–—ـ].*)'
|
|
34
|
+
*/
|
|
35
|
+
template?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Alternative to template: raw regex pattern string (for 'pattern' type only).
|
|
38
|
+
* Use this for complex patterns that can't be expressed with templates.
|
|
39
|
+
* The pattern should have a capture group for the content.
|
|
40
|
+
* Example: '^CUSTOM: (.*)'
|
|
41
|
+
*/
|
|
42
|
+
pattern?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Custom token map for advanced users.
|
|
45
|
+
* Extends the default TOKENS with additional definitions.
|
|
46
|
+
*/
|
|
47
|
+
tokens?: Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
* List of phrases for 'phrase' and 'hadith-chain' types.
|
|
50
|
+
* For 'hadith-chain', defaults to common narrator patterns if not provided.
|
|
51
|
+
*/
|
|
52
|
+
phrases?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* Optional: Only apply this marker after a specific page number.
|
|
55
|
+
* Useful for books with different formatting in front matter vs main content.
|
|
56
|
+
*/
|
|
57
|
+
minPage?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Optional: Arbitrary metadata to attach to entries matched by this marker.
|
|
60
|
+
* This allows for agnostic handling of entry properties.
|
|
61
|
+
* Example: { type: 0, category: 'hadith' }
|
|
62
|
+
*/
|
|
63
|
+
metadata?: Record<string, any>;
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/markers/defaults.d.ts
|
|
67
|
+
/**
|
|
68
|
+
* Default numbering style for markers
|
|
69
|
+
*/
|
|
70
|
+
declare const DEFAULT_NUMBERING: NumberingStyle;
|
|
71
|
+
/**
|
|
72
|
+
* Default separator style for markers
|
|
73
|
+
*/
|
|
74
|
+
declare const DEFAULT_SEPARATOR: SeparatorStyle;
|
|
75
|
+
/**
|
|
76
|
+
* Default separator pattern (used when separator is a custom string)
|
|
77
|
+
*/
|
|
78
|
+
declare const DEFAULT_SEPARATOR_PATTERN = "[-\u2013\u2014\u0640]";
|
|
79
|
+
/**
|
|
80
|
+
* Numbering patterns mapped by style
|
|
81
|
+
*/
|
|
82
|
+
declare const NUMBERING_PATTERNS: Record<NumberingStyle, string>;
|
|
83
|
+
/**
|
|
84
|
+
* Separator patterns mapped by style
|
|
85
|
+
*/
|
|
86
|
+
declare const SEPARATOR_PATTERNS: Record<SeparatorStyle, string>;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/markers/generator.d.ts
|
|
89
|
+
/**
|
|
90
|
+
* Generates a regex pattern from a marker configuration.
|
|
91
|
+
* Always returns a regex with three named capture groups:
|
|
92
|
+
* - full: Complete match including marker
|
|
93
|
+
* - marker: Just the marker part (for metadata/indexing)
|
|
94
|
+
* - content: Clean content without marker (for LLM processing)
|
|
95
|
+
*
|
|
96
|
+
* This function applies all default values before delegating to type-specific generators.
|
|
97
|
+
*
|
|
98
|
+
* @param config - Marker configuration
|
|
99
|
+
* @returns Regular expression with named groups
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* const regex = generateRegexFromMarker({ type: 'numbered' });
|
|
103
|
+
* const match = regex.exec('٥ - نص');
|
|
104
|
+
* match.groups.full // "٥ - نص"
|
|
105
|
+
* match.groups.marker // "٥ -"
|
|
106
|
+
* match.groups.content // "نص"
|
|
107
|
+
*/
|
|
108
|
+
declare function generateRegexFromMarker(config: MarkerConfig): RegExp;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/markers/presets.d.ts
|
|
111
|
+
/**
|
|
112
|
+
* Default phrase lists for preset marker types.
|
|
113
|
+
* Export these so users can extend them.
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* Common hadith narrator phrases (diacritic-insensitive)
|
|
117
|
+
* Users can extend: [...DEFAULT_HADITH_PHRASES, 'أَخْبَرَنِي']
|
|
118
|
+
*/
|
|
119
|
+
declare const DEFAULT_HADITH_PHRASES: readonly ["حَدَّثَنَا", "حدثنا", "أَخْبَرَنَا", "حدثني", "حدَّثني", "وحدثنا", "حُدِّثت عن", "وحَدَّثَنَا"];
|
|
120
|
+
/**
|
|
121
|
+
* Common basmala patterns
|
|
122
|
+
* Users can extend: [...DEFAULT_BASMALA_PATTERNS, 'customPattern']
|
|
123
|
+
*/
|
|
124
|
+
declare const DEFAULT_BASMALA_PATTERNS: readonly ["بسم الله", "\\[بسم", "\\[تم"];
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/markers/tokens.d.ts
|
|
127
|
+
/**
|
|
128
|
+
* Token definitions for pattern templates.
|
|
129
|
+
* Tokens provide a readable alternative to raw regex patterns.
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* Standard tokens for building marker patterns.
|
|
133
|
+
* Use these in templates like: '{num} {dash}' instead of '[\\u0660-\\u0669]+ [-–—ـ]'
|
|
134
|
+
*/
|
|
135
|
+
declare const TOKENS: {
|
|
136
|
+
readonly bullet: "[•*°]";
|
|
137
|
+
readonly colon: ":";
|
|
138
|
+
readonly comma: "،";
|
|
139
|
+
readonly content: "(.*)";
|
|
140
|
+
readonly dash: "[-–—ـ]";
|
|
141
|
+
readonly dot: "\\.";
|
|
142
|
+
readonly latin: "\\d+";
|
|
143
|
+
readonly letter: "[أ-ي]";
|
|
144
|
+
readonly num: "[\\u0660-\\u0669]+";
|
|
145
|
+
readonly paren: "\\)";
|
|
146
|
+
readonly s: "\\s?";
|
|
147
|
+
readonly slash: "/";
|
|
148
|
+
readonly space: "\\s+";
|
|
149
|
+
};
|
|
150
|
+
type TokenMap = Record<string, string>;
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/markers/template-parser.d.ts
|
|
153
|
+
/**
|
|
154
|
+
* Result of template validation
|
|
155
|
+
*/
|
|
156
|
+
interface ValidationResult {
|
|
157
|
+
valid: boolean;
|
|
158
|
+
errors?: string[];
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Options for template expansion
|
|
162
|
+
*/
|
|
163
|
+
interface ExpandOptions {
|
|
164
|
+
/** Custom token map to use instead of default TOKENS */
|
|
165
|
+
tokens?: TokenMap;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Expands a template string into a regex pattern using named capture groups.
|
|
169
|
+
* Always creates three groups: full (entire match), marker (just the marker), content (clean text).
|
|
170
|
+
*
|
|
171
|
+
* The content group uses [\s\S]*? (non-greedy) to match across newlines but stop at next marker.
|
|
172
|
+
*
|
|
173
|
+
* @param template - Template string with {token} placeholders
|
|
174
|
+
* @param options - Optional configuration
|
|
175
|
+
* @returns Regex pattern string with named groups
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* expandTemplate('{num} {dash}')
|
|
179
|
+
* // Returns: ^(?<full>(?<marker>[\\u0660-\\u0669]+\\s?[-–—ـ])(?<content>[\\s\\S]*?))
|
|
180
|
+
*/
|
|
181
|
+
declare function expandTemplate(template: string, options?: ExpandOptions): string;
|
|
182
|
+
/**
|
|
183
|
+
* Create a custom token map by extending the base tokens.
|
|
184
|
+
*
|
|
185
|
+
* @param customTokens - Custom token definitions
|
|
186
|
+
* @returns Combined token map
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* const myTokens = createTokenMap({
|
|
190
|
+
* verse: '\\[[\\u0660-\\u0669]+\\]',
|
|
191
|
+
* tafsir: 'تفسير'
|
|
192
|
+
* });
|
|
193
|
+
*/
|
|
194
|
+
declare function createTokenMap(customTokens: Record<string, string>): TokenMap;
|
|
195
|
+
/**
|
|
196
|
+
* Validates a template string.
|
|
197
|
+
*
|
|
198
|
+
* @param template - Template to validate
|
|
199
|
+
* @param tokens - Token map to validate against
|
|
200
|
+
* @returns Validation result with errors if invalid
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* validateTemplate('{num} {dash}')
|
|
204
|
+
* // Returns: { valid: true }
|
|
205
|
+
*
|
|
206
|
+
* validateTemplate('{invalid}')
|
|
207
|
+
* // Returns: { valid: false, errors: ['Unknown token: {invalid}'] }
|
|
208
|
+
*/
|
|
209
|
+
declare function validateTemplate(template: string, tokens?: TokenMap): ValidationResult;
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/markers/type-generators.d.ts
|
|
212
|
+
/**
|
|
213
|
+
* Generates a regular expression for pattern-type markers.
|
|
214
|
+
*
|
|
215
|
+
* Supports two modes:
|
|
216
|
+
* 1. Template-based: Uses the `template` field with token expansion
|
|
217
|
+
* 2. Pattern-based: Uses the raw `pattern` field as-is
|
|
218
|
+
*
|
|
219
|
+
* @param config - Marker configuration with either `template` or `pattern` field
|
|
220
|
+
* @returns A compiled RegExp object for matching the pattern
|
|
221
|
+
* @throws {Error} When neither `template` nor `pattern` is provided
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* // Using template
|
|
225
|
+
* const regex = generatePatternRegex({ type: 'pattern', template: '{num} {dash}' });
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* // Using raw pattern
|
|
229
|
+
* const regex = generatePatternRegex({ type: 'pattern', pattern: '^\\d+' });
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* // Using custom tokens
|
|
233
|
+
* const regex = generatePatternRegex({
|
|
234
|
+
* type: 'pattern',
|
|
235
|
+
* template: '{verse}',
|
|
236
|
+
* tokens: { verse: '\\[[0-9]+\\]' }
|
|
237
|
+
* });
|
|
238
|
+
*/
|
|
239
|
+
declare function generatePatternRegex(config: MarkerConfig): RegExp;
|
|
240
|
+
/**
|
|
241
|
+
* Generates a regular expression for 'bab' (chapter) markers.
|
|
242
|
+
*
|
|
243
|
+
* Matches Arabic chapter markers like باب, بَابُ, بَابٌ with optional diacritics.
|
|
244
|
+
* The pattern is diacritic-insensitive using bitaboom's makeDiacriticInsensitive.
|
|
245
|
+
*
|
|
246
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* const regex = generateBabRegex();
|
|
250
|
+
* const match = regex.exec('باب الصلاة');
|
|
251
|
+
* // match.groups.marker -> 'باب'
|
|
252
|
+
* // match.groups.content -> ' الصلاة'
|
|
253
|
+
*/
|
|
254
|
+
declare function generateBabRegex(): RegExp;
|
|
255
|
+
/**
|
|
256
|
+
* Generates a regular expression for hadith chain (isnad) markers.
|
|
257
|
+
*
|
|
258
|
+
* Matches common hadith narrator phrases like حَدَّثَنَا, أَخْبَرَنَا, etc.
|
|
259
|
+
* Uses default phrases from presets or custom phrases from config.
|
|
260
|
+
* All phrases are made diacritic-insensitive.
|
|
261
|
+
*
|
|
262
|
+
* @param config - Marker configuration with optional `phrases` array
|
|
263
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* // Using default phrases
|
|
267
|
+
* const regex = generateHadithChainRegex({ type: 'hadith-chain' });
|
|
268
|
+
* const match = regex.exec('حَدَّثَنَا أبو بكر');
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* // Using custom phrases
|
|
272
|
+
* const regex = generateHadithChainRegex({
|
|
273
|
+
* type: 'hadith-chain',
|
|
274
|
+
* phrases: ['قَالَ', 'رَوَى']
|
|
275
|
+
* });
|
|
276
|
+
*/
|
|
277
|
+
declare function generateHadithChainRegex(config: MarkerConfig): RegExp;
|
|
278
|
+
/**
|
|
279
|
+
* Generates a regular expression for basmala markers.
|
|
280
|
+
*
|
|
281
|
+
* Matches various forms of بِسْمِ اللَّهِ (In the name of Allah):
|
|
282
|
+
* - بسم الله (without diacritics)
|
|
283
|
+
* - بِسْمِ اللَّهِ (with diacritics)
|
|
284
|
+
* - Special patterns like [بسم, [تم
|
|
285
|
+
*
|
|
286
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* const regex = generateBasmalaRegex();
|
|
290
|
+
* const match = regex.exec('بسم الله الرحمن الرحيم');
|
|
291
|
+
* // match.groups.marker -> 'بسم الله'
|
|
292
|
+
*/
|
|
293
|
+
declare function generateBasmalaRegex(): RegExp;
|
|
294
|
+
/**
|
|
295
|
+
* Generates a regular expression for custom phrase markers.
|
|
296
|
+
*
|
|
297
|
+
* Similar to hadith-chain markers but requires explicit phrase list.
|
|
298
|
+
* All phrases are made diacritic-insensitive.
|
|
299
|
+
*
|
|
300
|
+
* @param config - Marker configuration with required `phrases` array
|
|
301
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
302
|
+
* @throws {Error} When `phrases` is undefined or empty
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* const regex = generatePhraseRegex({
|
|
306
|
+
* type: 'phrase',
|
|
307
|
+
* phrases: ['فَائِدَةٌ', 'مَسْأَلَةٌ']
|
|
308
|
+
* });
|
|
309
|
+
*/
|
|
310
|
+
declare function generatePhraseRegex(config: MarkerConfig): RegExp;
|
|
311
|
+
/**
|
|
312
|
+
* Generates a regular expression for square bracket markers.
|
|
313
|
+
*
|
|
314
|
+
* Matches verse or hadith reference numbers in square brackets:
|
|
315
|
+
* - [٦٥] - Simple bracket
|
|
316
|
+
* - • [٦٥] - With bullet prefix
|
|
317
|
+
* - ° [٦٥] - With degree prefix
|
|
318
|
+
*
|
|
319
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* const regex = generateSquareBracketRegex();
|
|
323
|
+
* const match = regex.exec('[٦٥] نص الحديث');
|
|
324
|
+
* // match.groups.content -> ' نص الحديث'
|
|
325
|
+
*/
|
|
326
|
+
declare function generateSquareBracketRegex(): RegExp;
|
|
327
|
+
/**
|
|
328
|
+
* Generates a regular expression for number-letter-separator markers.
|
|
329
|
+
*
|
|
330
|
+
* Matches patterns like:
|
|
331
|
+
* - ٥ أ - (Arabic-Indic number, Arabic letter, dash)
|
|
332
|
+
* - 5 ب. (Latin number, Arabic letter, dot)
|
|
333
|
+
*
|
|
334
|
+
* @param config - Configuration with required `numbering` and `separator` fields
|
|
335
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* const regex = generateNumLetterRegex({
|
|
339
|
+
* numbering: 'arabic-indic',
|
|
340
|
+
* separator: 'dash'
|
|
341
|
+
* });
|
|
342
|
+
* const match = regex.exec('٥ أ - نص');
|
|
343
|
+
*/
|
|
344
|
+
declare function generateNumLetterRegex(config: Pick<MarkerConfig, 'numbering' | 'separator'>): RegExp;
|
|
345
|
+
/**
|
|
346
|
+
* Generates a regular expression for number-parenthetical-separator markers.
|
|
347
|
+
*
|
|
348
|
+
* Matches patterns like:
|
|
349
|
+
* - ٥ (أ) - (number, parenthetical content, separator)
|
|
350
|
+
* - 5 (٦) - (number with parenthetical number)
|
|
351
|
+
*
|
|
352
|
+
* @param config - Configuration with required `numbering` and `separator` fields
|
|
353
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* const regex = generateNumParenRegex({
|
|
357
|
+
* numbering: 'arabic-indic',
|
|
358
|
+
* separator: 'dash'
|
|
359
|
+
* });
|
|
360
|
+
* const match = regex.exec('٥ (أ) - نص');
|
|
361
|
+
*/
|
|
362
|
+
declare function generateNumParenRegex(config: Pick<MarkerConfig, 'numbering' | 'separator'>): RegExp;
|
|
363
|
+
/**
|
|
364
|
+
* Generates a regular expression for number-slash-number markers.
|
|
365
|
+
*
|
|
366
|
+
* Matches patterns like:
|
|
367
|
+
* - ٥/٦ - (number slash number, separator)
|
|
368
|
+
* - ٥ - (single number, separator)
|
|
369
|
+
*
|
|
370
|
+
* The second number after the slash is optional.
|
|
371
|
+
*
|
|
372
|
+
* @param config - Configuration with required `numbering` and `separator` fields
|
|
373
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* const regex = generateNumSlashRegex({
|
|
377
|
+
* numbering: 'arabic-indic',
|
|
378
|
+
* separator: 'dash'
|
|
379
|
+
* });
|
|
380
|
+
* const match1 = regex.exec('٥/٦ - نص');
|
|
381
|
+
* const match2 = regex.exec('٥ - نص'); // Also matches
|
|
382
|
+
*/
|
|
383
|
+
declare function generateNumSlashRegex(config: Pick<MarkerConfig, 'numbering' | 'separator'>): RegExp;
|
|
384
|
+
/**
|
|
385
|
+
* Generates a regular expression for numbered markers with optional format template.
|
|
386
|
+
*
|
|
387
|
+
* Supports two modes:
|
|
388
|
+
* 1. Format template: Uses `format` field with token expansion (e.g., '{bullet}+ {num} {dash}')
|
|
389
|
+
* 2. Default pattern: Uses `numbering` and `separator` to build standard numbered markers
|
|
390
|
+
*
|
|
391
|
+
* When using default pattern:
|
|
392
|
+
* - Separator 'none' generates pattern without separator
|
|
393
|
+
* - Custom separator strings are used as-is or looked up in SEPARATOR_PATTERNS
|
|
394
|
+
*
|
|
395
|
+
* @param config - Configuration with `numbering`, `separator`, and optional `format`/`tokens`
|
|
396
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* // Using format template
|
|
400
|
+
* const regex = generateNumberedRegex({
|
|
401
|
+
* numbering: 'arabic-indic',
|
|
402
|
+
* separator: 'dash',
|
|
403
|
+
* format: '{bullet}+ {num} {dash}'
|
|
404
|
+
* });
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* // Using default pattern
|
|
408
|
+
* const regex = generateNumberedRegex({
|
|
409
|
+
* numbering: 'arabic-indic',
|
|
410
|
+
* separator: 'dash'
|
|
411
|
+
* });
|
|
412
|
+
* const match = regex.exec('٥ - نص');
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* // With 'none' separator
|
|
416
|
+
* const regex = generateNumberedRegex({
|
|
417
|
+
* numbering: 'latin',
|
|
418
|
+
* separator: 'none'
|
|
419
|
+
* });
|
|
420
|
+
* const match = regex.exec('5 text');
|
|
421
|
+
*/
|
|
422
|
+
declare function generateNumberedRegex(config: Pick<MarkerConfig, 'numbering' | 'separator' | 'format' | 'tokens'>): RegExp;
|
|
423
|
+
/**
|
|
424
|
+
* Generates a regular expression for bullet-point markers.
|
|
425
|
+
*
|
|
426
|
+
* Matches common bullet characters:
|
|
427
|
+
* - • (bullet)
|
|
428
|
+
* - * (asterisk)
|
|
429
|
+
* - ° (degree)
|
|
430
|
+
* - - (dash)
|
|
431
|
+
*
|
|
432
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* const regex = generateBulletRegex();
|
|
436
|
+
* const match = regex.exec('• نقطة');
|
|
437
|
+
* // match.groups.content -> 'نقطة'
|
|
438
|
+
*/
|
|
439
|
+
declare function generateBulletRegex(): RegExp;
|
|
440
|
+
/**
|
|
441
|
+
* Generates a regular expression for Markdown-style heading markers.
|
|
442
|
+
*
|
|
443
|
+
* Matches heading levels using hash symbols:
|
|
444
|
+
* - # Heading 1
|
|
445
|
+
* - ## Heading 2
|
|
446
|
+
* - ### Heading 3
|
|
447
|
+
* - etc.
|
|
448
|
+
*
|
|
449
|
+
* @returns A compiled RegExp with named groups: `full`, `marker`, `content`
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* const regex = generateHeadingRegex();
|
|
453
|
+
* const match = regex.exec('## عنوان فرعي');
|
|
454
|
+
* // match.groups.marker -> '## '
|
|
455
|
+
* // match.groups.content -> 'عنوان فرعي'
|
|
456
|
+
*/
|
|
457
|
+
declare function generateHeadingRegex(): RegExp;
|
|
458
|
+
//#endregion
|
|
459
|
+
export { DEFAULT_BASMALA_PATTERNS, DEFAULT_HADITH_PHRASES, DEFAULT_NUMBERING, DEFAULT_SEPARATOR, DEFAULT_SEPARATOR_PATTERN, type MarkerConfig, type MarkerType, NUMBERING_PATTERNS, type NumberingStyle, SEPARATOR_PATTERNS, type SeparatorStyle, TOKENS, createTokenMap, expandTemplate, generateBabRegex, generateBasmalaRegex, generateBulletRegex, generateHadithChainRegex, generateHeadingRegex, generateNumLetterRegex, generateNumParenRegex, generateNumSlashRegex, generateNumberedRegex, generatePatternRegex, generatePhraseRegex, generateRegexFromMarker, generateSquareBracketRegex, validateTemplate };
|
|
460
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/markers/defaults.ts","../src/markers/generator.ts","../src/markers/presets.ts","../src/markers/tokens.ts","../src/markers/template-parser.ts","../src/markers/type-generators.ts"],"sourcesContent":[],"mappings":";;AAGA;AAKA;AAKY,KAVA,cAAA,GAUU,cAAA,GAAA,OAAA;AAmBtB;;;AAMgB,KA9BJ,cAAA,GA8BI,MAAA,GAAA,KAAA,GAAA,OAAA,GAAA,OAAA,GAAA,MAAA;;;;KAzBJ,UAAA;;;ACHZ;AAKa,KDiBD,YAAA,GCjB2C;EAK1C;EAKA,IAAA,EDSH,UCTG;EAQA;cDGG;;cAEA;EESA;;;;ACtChB;EAea,MAAA,CAAA,EAAA,MAAA;;;;ACfb;AAuBA;;;;AC1BA;AAQA;AAmBA;AA8BA;EAkBgB,OAAA,CAAA,EAAA,MAAA;;;;AC/ChB;EA6BgB,MAAA,CAAA,ENDH,MMCG,CAAA,MAAgB,EAAA,MAAA,CAAI;EA4BpB;AAsBhB;AAuBA;AAwBA;EAuBgB,OAAA,CAAA,EAAA,MAAA,EAAA;EAAoC;;;;EAyBpC,OAAA,CAAA,EAAA,MAAA;EAAmC;;;;AA4BnD;EAAmD,QAAA,CAAA,EN9JpC,MM8JoC,CAAA,MAAA,EAAA,GAAA,CAAA;CAAL;;;;;;AN9KjC,cCpDA,iBDoDA,ECpDmB,cDoDnB;;;;cC/CA,mBAAmB;;AALhC;AAKA;AAKa,cAAA,yBAAA,GAAyB,uBAAA;AAKtC;AAQA;;cARa,oBAAoB,OAAO;;ACsBxC;;cDda,oBA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