From 3f792e84a78c9e17eb78e01c3266fe15231fbc89 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Mon, 8 Aug 2022 19:59:12 -0500 Subject: [PATCH] NanoID as default uid in tiddlers metadata and name. --- repository/TiddlyWiki/Tiddler.class.st | 7 +++---- repository/TiddlyWiki/TiddlyWiki.class.st | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/repository/TiddlyWiki/Tiddler.class.st b/repository/TiddlyWiki/Tiddler.class.st index b70577f..f437f46 100644 --- a/repository/TiddlyWiki/Tiddler.class.st +++ b/repository/TiddlyWiki/Tiddler.class.st @@ -213,7 +213,7 @@ Tiddler >> fileName [ | dashedTitle sanitized | dashedTitle := '-' join: (self title substrings collect: [ :each | each ]). sanitized := dashedTitle copyWithoutAll: #($¿ $? $! $¡ $/). - ^ sanitized , '--', (self uid copyFrom: 1 to: 5), '.ston'. + ^ sanitized , '--', (self uid copyFrom: 1 to: 12), '.ston'. ] { #category : #accessing } @@ -234,7 +234,7 @@ Tiddler >> fromDictionary: aDictionary [ revision: (aDictionary at: 'revision' ifAbsentPut: [ nil ]). customKeys := aDictionary keys copyWithoutAll: (self class instanceVariables collect: [ :each | each name ]). - customKeys ifEmpty: [ ^ self ]. + customKeys ifEmpty: [ self uidGenerator ]. customKeys do: [:key | | valueTemp | valueTemp := aDictionary at: key. valueTemp class = Array @@ -539,8 +539,7 @@ Tiddler >> uid [ { #category : #accessing } Tiddler >> uidGenerator [ - self created ifNil: [ self created: self class nowLocal ]. - ^ self customFields at: 'uid' put: self createdReversableEncoded. + ^ self customFields at: 'uid' put: NanoID generate. ] diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index 21011e3..06fee98 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -155,8 +155,9 @@ TiddlyWiki >> exportCommonTiddlers [ | content | content := self commonTiddlers. - ^ content do: [ :each | + content do: [ :each | each exportSTONFileOptimized ]. + ^ self tiddlersFolder ] { #category : #accessing }