@wdprlib/parser 5.0.0 → 5.1.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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Position as Position2, Point, Version as Version2, Element as Element8, SyntaxTree as SyntaxTree5, ContainerType, ContainerData, AttributeMap, VariableMap, Alignment, LinkType, LinkLocation, LinkLabel, PageRef as PageRef4, ImageSource, FloatAlignment, ListType, ListItem, ListData, CodeBlockData as CodeBlockData2, TabData, TableCell, TableRow, TableData, DefinitionListItem, Module as Module5, CollapsibleData, ClearFloat, AnchorTarget, HeaderType, AlignType, HeadingLevel, Heading, DateItem, Embed, TocEntry as TocEntry2, GallerySize, GalleryOrder, GalleryItem, GalleryContent, GalleryData, Diagnostic as Diagnostic4, DiagnosticSeverity, ParseResult as ParseResult4 } from "@wdprlib/ast";
1
+ import { Position as Position2, Point, Version as Version2, Element as Element8, SyntaxTree as SyntaxTree5, ContainerType, ContainerData, AttributeMap, VariableMap, Alignment, LinkType, LinkLocation, LinkLabel, PageRef as PageRef7, ImageSource, FloatAlignment, ListType, ListItem, ListData, CodeBlockData as CodeBlockData2, TabData, TableCell, TableRow, TableData, DefinitionListItem, Module as Module5, CollapsibleData, ClearFloat, AnchorTarget, HeaderType, AlignType, HeadingLevel, Heading, DateItem, Embed, TocEntry as TocEntry2, GallerySize, GalleryOrder, GalleryItem, GalleryContent, GalleryData, Diagnostic as Diagnostic4, DiagnosticSeverity, ParseResult as ParseResult4 } from "@wdprlib/ast";
2
2
  import { createPoint, createPosition, text, container, paragraph, bold, italics, heading, lineBreak, horizontalRule, link, list, listItemElements, listItemSubList } from "@wdprlib/ast";
3
3
  import { WikitextMode, WikitextSettings as WikitextSettings5 } from "@wdprlib/ast";
4
4
  import { createSettings, DEFAULT_SETTINGS } from "@wdprlib/ast";
@@ -212,11 +212,6 @@ declare class Parser {
212
212
  * @since 2.0.0
213
213
  */
214
214
  parse(): ParseResult;
215
- private isAtEnd;
216
- private currentToken;
217
- private eofToken;
218
- private skipWhitespace;
219
- private parseBlock;
220
215
  }
221
216
  /**
222
217
  * Parse a Wikidot markup string into an AST with diagnostics.
@@ -232,8 +227,8 @@ declare class Parser {
232
227
  */
233
228
  declare function parse(source: string, options?: ParserOptions): ParseResult2;
234
229
  import { WikitextPageContext as WikitextPageContext2 } from "@wdprlib/ast";
235
- import { Diagnostic, PageRef as PageRef3, SyntaxTree, WikitextPageContext, WikitextSettings as WikitextSettings3 } from "@wdprlib/ast";
236
- import { PageRef as PageRef2, WikitextSettings as WikitextSettings2 } from "@wdprlib/ast";
230
+ import { Diagnostic, PageRef as PageRef5, SyntaxTree, WikitextPageContext, WikitextSettings as WikitextSettings3 } from "@wdprlib/ast";
231
+ import { PageRef as PageRef4, WikitextSettings as WikitextSettings2 } from "@wdprlib/ast";
237
232
  interface IncludeAssignment {
238
233
  key: string;
239
234
  value: string;
@@ -246,7 +241,7 @@ interface IncludeAssignment {
246
241
  * Implementations should validate and sanitize page references before
247
242
  * using them in database queries or file system access.
248
243
  */
249
- type IncludeFetcher = (pageRef: PageRef2) => string | null;
244
+ type IncludeFetcher = (pageRef: PageRef4) => string | null;
250
245
  /**
251
246
  * Async callback to fetch page content for include resolution.
252
247
  * Returns a promise of the wikitext source, or null if the page does not exist.
@@ -255,7 +250,7 @@ type IncludeFetcher = (pageRef: PageRef2) => string | null;
255
250
  * Implementations should validate and sanitize page references before
256
251
  * using them in database queries or file system access.
257
252
  */
258
- type AsyncIncludeFetcher = (pageRef: PageRef2) => Promise<string | null>;
253
+ type AsyncIncludeFetcher = (pageRef: PageRef4) => Promise<string | null>;
259
254
  /**
260
255
  * Options for resolveIncludes / resolveIncludesAsync.
261
256
  */
@@ -280,7 +275,7 @@ interface ResolveIncludesOptions {
280
275
  */
281
276
  interface IncludeReference {
282
277
  /** Target page reference parsed from the directive. */
283
- location: PageRef2;
278
+ location: PageRef4;
284
279
  /** Variable assignments parsed from the directive, preserving source order. */
285
280
  assignments: IncludeAssignment[];
286
281
  /** Index of the opening `[[`. */
@@ -836,7 +831,7 @@ interface ProcessWikitextCallbackContext<TPage extends WikitextPageContext> {
836
831
  settings: WikitextSettings3;
837
832
  }
838
833
  interface ProcessWikitextDataProvider<TPage extends WikitextPageContext> {
839
- fetchInclude?: (pageRef: PageRef3, context: ProcessWikitextCallbackContext<TPage>) => Promise<string | null>;
834
+ fetchInclude?: (pageRef: PageRef5, context: ProcessWikitextCallbackContext<TPage>) => Promise<string | null>;
840
835
  fetchListPages?: (query: NormalizedListPagesQuery, requirement: ListPagesDataRequirement, context: ProcessWikitextCallbackContext<TPage>) => Promise<ListPagesExternalData | null | undefined>;
841
836
  fetchListUsers?: (requirement: ListUsersDataRequirement, context: ProcessWikitextCallbackContext<TPage>) => Promise<ListUsersExternalData | null | undefined>;
842
837
  fetchTagCloud?: (requirement: TagCloudDataRequirement, context: ProcessWikitextCallbackContext<TPage>) => Promise<TagCloudExternalData | null | undefined>;
@@ -1200,4 +1195,4 @@ interface ResolveOptions {
1200
1195
  */
1201
1196
  declare function resolveModules(ast: SyntaxTree4, dataProvider: DataProvider, options: ResolveOptions): Promise<SyntaxTree4>;
1202
1197
  import { STYLE_SLOT_PREFIX } from "@wdprlib/ast";
1203
- export { tokenize, text, resolveTagCloud, resolveModules, resolveListUsers, resolveIncludesWithTrace, resolveIncludesAsyncWithTrace, resolveIncludesAsync, resolveIncludes, processWikitext, preprocessIftags, parseTags, parseParent, parseOrder, parseNumericSelector, parseDateSelector, parseCategory, parse, paragraph, normalizeQuery, matchesListPagesSelectors, listItemSubList, listItemElements, list, link, lineBreak, italics, isTagCloudModule, isListUsersModule, horizontalRule, heading, extractListUsersVariables, extractIncludeReferences, extractDataRequirements, definePageData, createToken, createSettings, createPosition, createPoint, container, compileTemplate, compileListUsersTemplate, bold, WikitextSettings5 as WikitextSettings, WikitextMode, Version2 as Version, VariableMap, VariableContext, UserInfo, TokenType, Token, TocEntry2 as TocEntry, TagCloudTagData, TagCloudModuleData, TagCloudExternalData, TagCloudDataRequirement, TagCloudDataFetcher, TableRow, TableData, TableCell, TabData, SyntaxTree5 as SyntaxTree, SiteContext, STYLE_SLOT_PREFIX, ResolveOptions, ResolveIncludesTraceResult, ResolveIncludesOptions, ProcessedWikitextDocument, ProcessWikitextOptions, ProcessWikitextDataProvider, ProcessWikitextCallbackContext, Position2 as Position, Point, ParserOptions, Parser, ParseResult4 as ParseResult, ParseFunction, PageRef4 as PageRef, PageData, NormalizedTags, NormalizedParent, NormalizedOrder, NormalizedNumericSelector, NormalizedListPagesQuery, NormalizedDateSelector, NormalizedCategory, ModuleSourceTransform, ModuleParseResult, Module5 as Module, ListUsersVariableContext, ListUsersVariable, ListUsersUserData, ListUsersExternalData, ListUsersDataRequirement, ListUsersDataFetcher, ListUsersCompiledTemplate, ListType, ListPagesVariable, ListPagesQuery, ListPagesExternalData, ListPagesDataRequirement, ListPagesDataFetcher, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LexerOptions, Lexer, IncludeReference, IncludeIterationTrace, IncludeFetcher, IncludeDependency, ImageSource, HeadingLevel, Heading, HeaderType, GallerySize, GalleryOrder, GalleryItem, GalleryData, GalleryContent, FloatAlignment, ExtractionResult, Embed, Element8 as Element, DiagnosticSeverity, Diagnostic4 as Diagnostic, DefinitionListItem, DateItem, DataRequirements, DataProvider, DEFAULT_SETTINGS, ContainerType, ContainerData, CompiledTemplate, CollapsibleData, CodeBlockData2 as CodeBlockData, ClearFloat, AttributeMap, AsyncIncludeFetcher, AnchorTarget, Alignment, AlignType };
1198
+ export { tokenize, text, resolveTagCloud, resolveModules, resolveListUsers, resolveIncludesWithTrace, resolveIncludesAsyncWithTrace, resolveIncludesAsync, resolveIncludes, processWikitext, preprocessIftags, parseTags, parseParent, parseOrder, parseNumericSelector, parseDateSelector, parseCategory, parse, paragraph, normalizeQuery, matchesListPagesSelectors, listItemSubList, listItemElements, list, link, lineBreak, italics, isTagCloudModule, isListUsersModule, horizontalRule, heading, extractListUsersVariables, extractIncludeReferences, extractDataRequirements, definePageData, createToken, createSettings, createPosition, createPoint, container, compileTemplate, compileListUsersTemplate, bold, WikitextSettings5 as WikitextSettings, WikitextMode, Version2 as Version, VariableMap, VariableContext, UserInfo, TokenType, Token, TocEntry2 as TocEntry, TagCloudTagData, TagCloudModuleData, TagCloudExternalData, TagCloudDataRequirement, TagCloudDataFetcher, TableRow, TableData, TableCell, TabData, SyntaxTree5 as SyntaxTree, SiteContext, STYLE_SLOT_PREFIX, ResolveOptions, ResolveIncludesTraceResult, ResolveIncludesOptions, ProcessedWikitextDocument, ProcessWikitextOptions, ProcessWikitextDataProvider, ProcessWikitextCallbackContext, Position2 as Position, Point, ParserOptions, Parser, ParseResult4 as ParseResult, ParseFunction, PageRef7 as PageRef, PageData, NormalizedTags, NormalizedParent, NormalizedOrder, NormalizedNumericSelector, NormalizedListPagesQuery, NormalizedDateSelector, NormalizedCategory, ModuleSourceTransform, ModuleParseResult, Module5 as Module, ListUsersVariableContext, ListUsersVariable, ListUsersUserData, ListUsersExternalData, ListUsersDataRequirement, ListUsersDataFetcher, ListUsersCompiledTemplate, ListType, ListPagesVariable, ListPagesQuery, ListPagesExternalData, ListPagesDataRequirement, ListPagesDataFetcher, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LexerOptions, Lexer, IncludeReference, IncludeIterationTrace, IncludeFetcher, IncludeDependency, ImageSource, HeadingLevel, Heading, HeaderType, GallerySize, GalleryOrder, GalleryItem, GalleryData, GalleryContent, FloatAlignment, ExtractionResult, Embed, Element8 as Element, DiagnosticSeverity, Diagnostic4 as Diagnostic, DefinitionListItem, DateItem, DataRequirements, DataProvider, DEFAULT_SETTINGS, ContainerType, ContainerData, CompiledTemplate, CollapsibleData, CodeBlockData2 as CodeBlockData, ClearFloat, AttributeMap, AsyncIncludeFetcher, AnchorTarget, Alignment, AlignType };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Position as Position2, Point, Version as Version2, Element as Element8, SyntaxTree as SyntaxTree5, ContainerType, ContainerData, AttributeMap, VariableMap, Alignment, LinkType, LinkLocation, LinkLabel, PageRef as PageRef4, ImageSource, FloatAlignment, ListType, ListItem, ListData, CodeBlockData as CodeBlockData2, TabData, TableCell, TableRow, TableData, DefinitionListItem, Module as Module5, CollapsibleData, ClearFloat, AnchorTarget, HeaderType, AlignType, HeadingLevel, Heading, DateItem, Embed, TocEntry as TocEntry2, GallerySize, GalleryOrder, GalleryItem, GalleryContent, GalleryData, Diagnostic as Diagnostic4, DiagnosticSeverity, ParseResult as ParseResult4 } from "@wdprlib/ast";
1
+ import { Position as Position2, Point, Version as Version2, Element as Element8, SyntaxTree as SyntaxTree5, ContainerType, ContainerData, AttributeMap, VariableMap, Alignment, LinkType, LinkLocation, LinkLabel, PageRef as PageRef7, ImageSource, FloatAlignment, ListType, ListItem, ListData, CodeBlockData as CodeBlockData2, TabData, TableCell, TableRow, TableData, DefinitionListItem, Module as Module5, CollapsibleData, ClearFloat, AnchorTarget, HeaderType, AlignType, HeadingLevel, Heading, DateItem, Embed, TocEntry as TocEntry2, GallerySize, GalleryOrder, GalleryItem, GalleryContent, GalleryData, Diagnostic as Diagnostic4, DiagnosticSeverity, ParseResult as ParseResult4 } from "@wdprlib/ast";
2
2
  import { createPoint, createPosition, text, container, paragraph, bold, italics, heading, lineBreak, horizontalRule, link, list, listItemElements, listItemSubList } from "@wdprlib/ast";
3
3
  import { WikitextMode, WikitextSettings as WikitextSettings5 } from "@wdprlib/ast";
4
4
  import { createSettings, DEFAULT_SETTINGS } from "@wdprlib/ast";
@@ -212,11 +212,6 @@ declare class Parser {
212
212
  * @since 2.0.0
213
213
  */
214
214
  parse(): ParseResult;
215
- private isAtEnd;
216
- private currentToken;
217
- private eofToken;
218
- private skipWhitespace;
219
- private parseBlock;
220
215
  }
221
216
  /**
222
217
  * Parse a Wikidot markup string into an AST with diagnostics.
@@ -232,8 +227,8 @@ declare class Parser {
232
227
  */
233
228
  declare function parse(source: string, options?: ParserOptions): ParseResult2;
234
229
  import { WikitextPageContext as WikitextPageContext2 } from "@wdprlib/ast";
235
- import { Diagnostic, PageRef as PageRef3, SyntaxTree, WikitextPageContext, WikitextSettings as WikitextSettings3 } from "@wdprlib/ast";
236
- import { PageRef as PageRef2, WikitextSettings as WikitextSettings2 } from "@wdprlib/ast";
230
+ import { Diagnostic, PageRef as PageRef5, SyntaxTree, WikitextPageContext, WikitextSettings as WikitextSettings3 } from "@wdprlib/ast";
231
+ import { PageRef as PageRef4, WikitextSettings as WikitextSettings2 } from "@wdprlib/ast";
237
232
  interface IncludeAssignment {
238
233
  key: string;
239
234
  value: string;
@@ -246,7 +241,7 @@ interface IncludeAssignment {
246
241
  * Implementations should validate and sanitize page references before
247
242
  * using them in database queries or file system access.
248
243
  */
249
- type IncludeFetcher = (pageRef: PageRef2) => string | null;
244
+ type IncludeFetcher = (pageRef: PageRef4) => string | null;
250
245
  /**
251
246
  * Async callback to fetch page content for include resolution.
252
247
  * Returns a promise of the wikitext source, or null if the page does not exist.
@@ -255,7 +250,7 @@ type IncludeFetcher = (pageRef: PageRef2) => string | null;
255
250
  * Implementations should validate and sanitize page references before
256
251
  * using them in database queries or file system access.
257
252
  */
258
- type AsyncIncludeFetcher = (pageRef: PageRef2) => Promise<string | null>;
253
+ type AsyncIncludeFetcher = (pageRef: PageRef4) => Promise<string | null>;
259
254
  /**
260
255
  * Options for resolveIncludes / resolveIncludesAsync.
261
256
  */
@@ -280,7 +275,7 @@ interface ResolveIncludesOptions {
280
275
  */
281
276
  interface IncludeReference {
282
277
  /** Target page reference parsed from the directive. */
283
- location: PageRef2;
278
+ location: PageRef4;
284
279
  /** Variable assignments parsed from the directive, preserving source order. */
285
280
  assignments: IncludeAssignment[];
286
281
  /** Index of the opening `[[`. */
@@ -836,7 +831,7 @@ interface ProcessWikitextCallbackContext<TPage extends WikitextPageContext> {
836
831
  settings: WikitextSettings3;
837
832
  }
838
833
  interface ProcessWikitextDataProvider<TPage extends WikitextPageContext> {
839
- fetchInclude?: (pageRef: PageRef3, context: ProcessWikitextCallbackContext<TPage>) => Promise<string | null>;
834
+ fetchInclude?: (pageRef: PageRef5, context: ProcessWikitextCallbackContext<TPage>) => Promise<string | null>;
840
835
  fetchListPages?: (query: NormalizedListPagesQuery, requirement: ListPagesDataRequirement, context: ProcessWikitextCallbackContext<TPage>) => Promise<ListPagesExternalData | null | undefined>;
841
836
  fetchListUsers?: (requirement: ListUsersDataRequirement, context: ProcessWikitextCallbackContext<TPage>) => Promise<ListUsersExternalData | null | undefined>;
842
837
  fetchTagCloud?: (requirement: TagCloudDataRequirement, context: ProcessWikitextCallbackContext<TPage>) => Promise<TagCloudExternalData | null | undefined>;
@@ -1200,4 +1195,4 @@ interface ResolveOptions {
1200
1195
  */
1201
1196
  declare function resolveModules(ast: SyntaxTree4, dataProvider: DataProvider, options: ResolveOptions): Promise<SyntaxTree4>;
1202
1197
  import { STYLE_SLOT_PREFIX } from "@wdprlib/ast";
1203
- export { tokenize, text, resolveTagCloud, resolveModules, resolveListUsers, resolveIncludesWithTrace, resolveIncludesAsyncWithTrace, resolveIncludesAsync, resolveIncludes, processWikitext, preprocessIftags, parseTags, parseParent, parseOrder, parseNumericSelector, parseDateSelector, parseCategory, parse, paragraph, normalizeQuery, matchesListPagesSelectors, listItemSubList, listItemElements, list, link, lineBreak, italics, isTagCloudModule, isListUsersModule, horizontalRule, heading, extractListUsersVariables, extractIncludeReferences, extractDataRequirements, definePageData, createToken, createSettings, createPosition, createPoint, container, compileTemplate, compileListUsersTemplate, bold, WikitextSettings5 as WikitextSettings, WikitextMode, Version2 as Version, VariableMap, VariableContext, UserInfo, TokenType, Token, TocEntry2 as TocEntry, TagCloudTagData, TagCloudModuleData, TagCloudExternalData, TagCloudDataRequirement, TagCloudDataFetcher, TableRow, TableData, TableCell, TabData, SyntaxTree5 as SyntaxTree, SiteContext, STYLE_SLOT_PREFIX, ResolveOptions, ResolveIncludesTraceResult, ResolveIncludesOptions, ProcessedWikitextDocument, ProcessWikitextOptions, ProcessWikitextDataProvider, ProcessWikitextCallbackContext, Position2 as Position, Point, ParserOptions, Parser, ParseResult4 as ParseResult, ParseFunction, PageRef4 as PageRef, PageData, NormalizedTags, NormalizedParent, NormalizedOrder, NormalizedNumericSelector, NormalizedListPagesQuery, NormalizedDateSelector, NormalizedCategory, ModuleSourceTransform, ModuleParseResult, Module5 as Module, ListUsersVariableContext, ListUsersVariable, ListUsersUserData, ListUsersExternalData, ListUsersDataRequirement, ListUsersDataFetcher, ListUsersCompiledTemplate, ListType, ListPagesVariable, ListPagesQuery, ListPagesExternalData, ListPagesDataRequirement, ListPagesDataFetcher, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LexerOptions, Lexer, IncludeReference, IncludeIterationTrace, IncludeFetcher, IncludeDependency, ImageSource, HeadingLevel, Heading, HeaderType, GallerySize, GalleryOrder, GalleryItem, GalleryData, GalleryContent, FloatAlignment, ExtractionResult, Embed, Element8 as Element, DiagnosticSeverity, Diagnostic4 as Diagnostic, DefinitionListItem, DateItem, DataRequirements, DataProvider, DEFAULT_SETTINGS, ContainerType, ContainerData, CompiledTemplate, CollapsibleData, CodeBlockData2 as CodeBlockData, ClearFloat, AttributeMap, AsyncIncludeFetcher, AnchorTarget, Alignment, AlignType };
1198
+ export { tokenize, text, resolveTagCloud, resolveModules, resolveListUsers, resolveIncludesWithTrace, resolveIncludesAsyncWithTrace, resolveIncludesAsync, resolveIncludes, processWikitext, preprocessIftags, parseTags, parseParent, parseOrder, parseNumericSelector, parseDateSelector, parseCategory, parse, paragraph, normalizeQuery, matchesListPagesSelectors, listItemSubList, listItemElements, list, link, lineBreak, italics, isTagCloudModule, isListUsersModule, horizontalRule, heading, extractListUsersVariables, extractIncludeReferences, extractDataRequirements, definePageData, createToken, createSettings, createPosition, createPoint, container, compileTemplate, compileListUsersTemplate, bold, WikitextSettings5 as WikitextSettings, WikitextMode, Version2 as Version, VariableMap, VariableContext, UserInfo, TokenType, Token, TocEntry2 as TocEntry, TagCloudTagData, TagCloudModuleData, TagCloudExternalData, TagCloudDataRequirement, TagCloudDataFetcher, TableRow, TableData, TableCell, TabData, SyntaxTree5 as SyntaxTree, SiteContext, STYLE_SLOT_PREFIX, ResolveOptions, ResolveIncludesTraceResult, ResolveIncludesOptions, ProcessedWikitextDocument, ProcessWikitextOptions, ProcessWikitextDataProvider, ProcessWikitextCallbackContext, Position2 as Position, Point, ParserOptions, Parser, ParseResult4 as ParseResult, ParseFunction, PageRef7 as PageRef, PageData, NormalizedTags, NormalizedParent, NormalizedOrder, NormalizedNumericSelector, NormalizedListPagesQuery, NormalizedDateSelector, NormalizedCategory, ModuleSourceTransform, ModuleParseResult, Module5 as Module, ListUsersVariableContext, ListUsersVariable, ListUsersUserData, ListUsersExternalData, ListUsersDataRequirement, ListUsersDataFetcher, ListUsersCompiledTemplate, ListType, ListPagesVariable, ListPagesQuery, ListPagesExternalData, ListPagesDataRequirement, ListPagesDataFetcher, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LexerOptions, Lexer, IncludeReference, IncludeIterationTrace, IncludeFetcher, IncludeDependency, ImageSource, HeadingLevel, Heading, HeaderType, GallerySize, GalleryOrder, GalleryItem, GalleryData, GalleryContent, FloatAlignment, ExtractionResult, Embed, Element8 as Element, DiagnosticSeverity, Diagnostic4 as Diagnostic, DefinitionListItem, DateItem, DataRequirements, DataProvider, DEFAULT_SETTINGS, ContainerType, ContainerData, CompiledTemplate, CollapsibleData, CodeBlockData2 as CodeBlockData, ClearFloat, AttributeMap, AsyncIncludeFetcher, AnchorTarget, Alignment, AlignType };