Lorebooks2MediaWiki: Difference between revisions
No edit summary |
No edit summary |
||
| Line 9: | Line 9: | ||
== TL;DR demo == | == TL;DR demo == | ||
# Visit the example world page [[Farlandia]] and a concept such as [[Slime]]. | # Visit the example world page [[Farlandia]] and a concept such as [[Slime]]. | ||
# Run {{#invoke:Lorebook|inject|world=Farlandia|context=Slime in Mossford}} | # Run <pre>{{#invoke:Lorebook|inject|world=Farlandia|context=Slime in Mossford}}</pre> | ||
# You get context like: | # You get context like: | ||
| Line 20: | Line 20: | ||
* SMW properties index every chunk for queries and recursion. | * SMW properties index every chunk for queries and recursion. | ||
* The Scribunto module reads those annotations, applies key logic, and emits prompt text or JSON. | * The Scribunto module reads those annotations, applies key logic, and emits prompt text or JSON. | ||
== | == Why it works == | ||
=== Template === | |||
MediaWiki allows users to create custom templates, which is easily reusable. We created two templates [[Template:World]] and [[Template:Concept]] to mimic actual lorebooks. Here are some example pages using these templates: [[Farlandia]], [[Farlandia:Monsters]], [[Slime]], [[Mossford]]. The custom styles also renders them beautifully. | |||
=== Semantic MediaWiki === | === Semantic MediaWiki === | ||
SMW stores each lore snippet as property triples (world ownership, keys, recursion hints). Queries can list all concepts in a world, filter by keys, or export structured JSON. | SMW stores each lore snippet as property triples (world ownership, keys, recursion hints). Queries can list all concepts in a world, filter by keys, or export structured JSON. | ||
=== Scribunto === | === Scribunto === | ||
The module mirrors Lorebook matching rules: ANY/AND/NOT key logic, constant/conditional entries, and recursive parent/child traversal. It can output prompt text or JSON for downstream tools. | The module mirrors Lorebook matching rules: ANY/AND/NOT key logic, constant/conditional entries, and recursive parent/child traversal. It can output prompt text or JSON for downstream tools. Here is the vibe coded script used in this example [[Module:Lorebook]] | ||