From 8894a61b12bdb662e99da95f88d376f6e76e22a4 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Wed, 6 Oct 2021 16:17:59 -0500 Subject: [PATCH] Improved listed tiddlers. --- repository/TiddlyWiki/Tiddler.class.st | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/repository/TiddlyWiki/Tiddler.class.st b/repository/TiddlyWiki/Tiddler.class.st index 5e54421..f08a3eb 100644 --- a/repository/TiddlyWiki/Tiddler.class.st +++ b/repository/TiddlyWiki/Tiddler.class.st @@ -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' }