Collecting oracles from template wiki.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-11-29 11:24:01 -05:00
parent 6815aa9158
commit 29a8d52f0f
4 changed files with 22 additions and 7 deletions

View File

@ -0,0 +1,18 @@
accessing
loadOraclesFromWikiTemplate
| oraclesTiddler rows |
oraclesTiddler := self wiki templateWiki tiddlers
detect: [:tiddler | (tiddler title) = 'Tablas Generadoras' ].
rows := oraclesTiddler text lines allButFirst collect: [:each | each splitOn: '|'].
^ rows collect: [:row | | tempDice |
tempDice := (row second splitOn: '"') second.
tempDice := tempDice splitOn: Character space.
tempDice := { tempDice first asNumber . tempDice second asNumber }.
OrderedDictionary new
at: 'dice' put: tempDice;
at: 'region' put: row third;
at: 'theme' put: row fourth;
at: 'event' put: row fifth;
at: 'past' put: row sixth;
yourself.
]

View File

@ -0,0 +1,3 @@
accessing
oracles: aDictionary
oracles := aDictionary

View File

@ -1,3 +1,3 @@
accessing accessing
oracles oracles
^ oracles ifNil: [ oracles := self populateOracles] ^ oracles ifNil: [ oracles := self loadOraclesFromWikiTemplate]

View File

@ -1,6 +0,0 @@
accessing
populateOracles
| oraclesTiddler |
oraclesTiddler := self wiki templateWiki tiddlers
detect: [:tiddler | (tiddler title) = 'Tablas Generadoras' ].
^ oraclesTiddler text lines allButFirst collect: [:each | each splitOn: '|']