Improved listed tiddlers.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-10-06 16:17:59 -05:00
parent ddd6820255
commit 8894a61b12

View File

@ -230,13 +230,24 @@ Tiddler >> list: anObject [
{ #category : 'accessing' }
Tiddler >> listedTiddlers [
"I only include the so called 'pureLinks' or manual links (see [1]) i.e. those which are enclosed in '[[' and ']]'
An improved future version of me should include all links with CamelCase
[1] https://tiddlywiki.com/static/Linking%2520in%2520WikiText.html"
| listedTiddlersTitles |
"I export all tiddlers in the list field as an alphabetic collection.
Future versions should preserve the order in the list."
| remainList remainListArray listedTiddlers |
self list ifNil: [^ nil ].
listedTiddlersTitles := WikiTextGrammar new linkSea star parse: self list.
^ self wiki tiddlers select: [:tiddler | listedTiddlersTitles includes: tiddler title ]
remainList := self list copy.
self manualLinksList do: [:manualLink |
remainList := remainList copyReplaceAll: manualLink with: ''
].
remainListArray := (remainList copyReplaceAll: '[[]]' with: '') withBlanksCondensed splitOn: Character space.
listedTiddlers := self manualLinksList, remainListArray.
^ self wiki tiddlers select: [:tiddler | listedTiddlers includes: tiddler title ].
]
{ #category : 'accessing' }
Tiddler >> manualLinksList [
self list ifNil: [^ nil].
^ WikiTextGrammar new linkSea star parse: self list.
]
{ #category : 'utilities' }