Adding exporting options.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-05-30 21:46:52 -05:00
parent f1d39f2fc6
commit 7fcc13e450
7 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,3 @@
accessing
asJson
^ STONJSON toStringPretty: (self asTiddlers collect: [:each | each asDictionary]) asArray

View File

@ -0,0 +1,23 @@
accessing
asTiddlers
| tiddlers transcluderText transcluder |
tiddlers := OrderedCollection new.
transcluderText := '' writeStream.
self options doWithIndex: [:opt :i | | tiddler |
tiddler := Tiddler new
title: self name, 'Option', i asString;
text: opt asWikiText;
created: DateAndTime now asString.
transcluderText nextPutAll: '{{', tiddler title, '}}'; cr; cr.
tiddlers add: tiddler.
].
transcluderText
nextPutAll: '----'; cr;
nextPutAll: '👤 ', self character.
transcluder := Tiddler new
title: self name;
tags: 'Starforged Truths';
text: transcluderText contents;
created: DateAndTime now asString.
tiddlers add: transcluder.
^ tiddlers

View File

@ -0,0 +1,3 @@
accessing
character
^ character

View File

@ -0,0 +1,19 @@
accessing
asWikiText
| stream |
stream := '' writeStream.
stream
nextPutAll: '<b>';
nextPutAll: self chance first asString, '-', self chance last asString;
nextPutAll: ' | ', self brief;
nextPutAll: '</b>'; cr;
nextPutAll: String cr;
nextPutAll: self details;
nextPutAll: String cr;
nextPutAll: self subtableAsWikiText.
stream
nextPutAll: String cr;
nextPutAll: '<$details summary="Quest Starter">'; cr;
nextPutAll: '//', self questStarter, '//'; cr;
nextPutAll: '</$details>'.
^ stream contents

View File

@ -0,0 +1,3 @@
accessing
details
^ details

View File

@ -0,0 +1,3 @@
accessing
questStarter
^ questStarter

View File

@ -0,0 +1,10 @@
accessing
subtableAsWikiText
| stream chances |
stream := '' writeStream.
self subtable ifEmpty: [ ^ stream contents ].
chances := self subtable collect: [ :each | each at: 'Chance' ].
chances doWithIndex: [:ch :i |
stream nextPutAll: '| ', ch asString, ' |', ((self subtable at: i) at: 'Description'), ' |' ; cr
].
^ stream contents