@wdprlib/parser 4.0.0 → 4.2.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/README.md +9 -1
- package/dist/index.cjs +345 -64
- package/dist/index.d.cts +121 -2
- package/dist/index.d.ts +121 -2
- package/dist/index.js +317 -36
- package/package.json +2 -2
- package/src/index.ts +9 -0
- package/src/parser/rules/block/module/index.ts +10 -0
- package/src/parser/rules/block/module/listpages/extract.ts +9 -0
- package/src/parser/rules/block/module/listpages/extraction/tagcloud.ts +25 -0
- package/src/parser/rules/block/module/listpages/types/data-requirements.ts +2 -0
- package/src/parser/rules/block/module/listpages/url-resolution/fields.ts +4 -4
- package/src/parser/rules/block/module/listpages/url-resolution/params.ts +12 -1
- package/src/parser/rules/block/module/listpages/url-resolution/resolve.ts +10 -1
- package/src/parser/rules/block/module/listpages/url-resolution/value.ts +13 -4
- package/src/parser/rules/block/module/mapping.ts +2 -0
- package/src/parser/rules/block/module/resolution/contexts.ts +29 -1
- package/src/parser/rules/block/module/resolution/data-maps.ts +17 -0
- package/src/parser/rules/block/module/resolution/dynamic-modules.ts +29 -2
- package/src/parser/rules/block/module/resolution/walk-resolve.ts +28 -4
- package/src/parser/rules/block/module/resolve.ts +11 -1
- package/src/parser/rules/block/module/tagcloud/index.ts +15 -0
- package/src/parser/rules/block/module/tagcloud/parser.ts +127 -0
- package/src/parser/rules/block/module/tagcloud/resolve.ts +173 -0
- package/src/parser/rules/block/module/tagcloud/types.ts +85 -0
- package/src/parser/rules/block/module/types-common.ts +15 -0
package/README.md
CHANGED
|
@@ -37,6 +37,14 @@ const resolved = await resolveModules(ast, {
|
|
|
37
37
|
// Fetch pages matching query from your database
|
|
38
38
|
return { pages: [...], totalCount: 100, site: { name: 'mysite' } }
|
|
39
39
|
},
|
|
40
|
+
fetchTagCloud: async ({ category, limit }) => {
|
|
41
|
+
// Fetch up to `limit` tags (weight = page count) for `[[module TagCloud]]`,
|
|
42
|
+
// ordered by weight descending. `category` is the raw, untrusted attribute
|
|
43
|
+
// value — look it up with a parameterized query and return the normalized name
|
|
44
|
+
const found = category ? await findCategory(category) : null // your lookup
|
|
45
|
+
if (category && !found) return { status: 'category-not-found', category }
|
|
46
|
+
return { status: 'ok', tags: [{ tag: 'scp', weight: 42 }], category: found?.unixName ?? null }
|
|
47
|
+
},
|
|
40
48
|
getPageTags: () => ['tag1', 'tag2'],
|
|
41
49
|
}, {
|
|
42
50
|
parse,
|
|
@@ -49,7 +57,7 @@ const resolved = await resolveModules(ast, {
|
|
|
49
57
|
|
|
50
58
|
- Wikidot markup parsing (bold, italic, links, images, tables, etc.)
|
|
51
59
|
- Include resolution (`[[include page]]`)
|
|
52
|
-
- Module support (ListPages, ListUsers, IfTags, etc.)
|
|
60
|
+
- Module support (ListPages, ListUsers, TagCloud, IfTags, etc.)
|
|
53
61
|
- Data extraction for server-side rendering
|
|
54
62
|
|
|
55
63
|
## Related Packages
|