diff --git a/repository/TiddlyWiki/Tiddler.class.st b/repository/TiddlyWiki/Tiddler.class.st index 2d29439..6a04ca7 100644 --- a/repository/TiddlyWiki/Tiddler.class.st +++ b/repository/TiddlyWiki/Tiddler.class.st @@ -136,6 +136,11 @@ Tiddler >> customFields [ ^ customFields ifNil: [ customFields := Dictionary new] ] +{ #category : #accessing } +Tiddler >> deleteUid [ + self customFields deleteKey: 'uid'. +] + { #category : #accessing } Tiddler >> exportJSONFile [ | jsonFile | @@ -155,7 +160,7 @@ Tiddler >> exportSTONFileInto: subfolder [ | stonFile output dashedTitle sanitized | dashedTitle := '-' join: (self title substrings collect: [ :each | each ]). sanitized := dashedTitle copyWithoutAll: #($¿ $? $! $¡ $/). - stonFile := self wiki file parent / subfolder / (sanitized, '--', self uid, '.ston'). + stonFile := self wiki file parent / subfolder / (sanitized, '--', (self uid copyFrom: 1 to: 5), '.ston'). ^ MarkupFile exportAsFileOn: stonFile containing: self asStonStringPretty ] @@ -458,13 +463,19 @@ Tiddler >> type: anObject [ { #category : #accessing } Tiddler >> uid [ + ^ self customFields at: 'uid' ifAbsentPut: [ self uidGenerator ]. + +] + +{ #category : #accessing } +Tiddler >> uidGenerator [ + | tempId | self created - ifNotNil: [ tempId := self created hash hex copyFrom: 1 to: 5. ] - ifNil: [ tempId := self class nowLocal hash hex copyFrom: 1 to: 5 ]. + ifNotNil: [ tempId := self created hash hex. ] + ifNil: [ tempId := self class nowLocal hash hex ]. self customFields at: 'uid' put: tempId . ^ tempId - ] { #category : #accessing }