NanoID as default uid in tiddlers metadata and name.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-08-08 19:59:12 -05:00
parent 70ed99691e
commit 3f792e84a7
2 changed files with 5 additions and 5 deletions

View File

@ -213,7 +213,7 @@ Tiddler >> fileName [
| dashedTitle sanitized | | dashedTitle sanitized |
dashedTitle := '-' join: (self title substrings collect: [ :each | each ]). dashedTitle := '-' join: (self title substrings collect: [ :each | each ]).
sanitized := dashedTitle copyWithoutAll: #($¿ $? $! $/). sanitized := dashedTitle copyWithoutAll: #($¿ $? $! $/).
^ sanitized , '--', (self uid copyFrom: 1 to: 5), '.ston'. ^ sanitized , '--', (self uid copyFrom: 1 to: 12), '.ston'.
] ]
{ #category : #accessing } { #category : #accessing }
@ -234,7 +234,7 @@ Tiddler >> fromDictionary: aDictionary [
revision: (aDictionary at: 'revision' ifAbsentPut: [ nil ]). revision: (aDictionary at: 'revision' ifAbsentPut: [ nil ]).
customKeys := aDictionary keys customKeys := aDictionary keys
copyWithoutAll: (self class instanceVariables collect: [ :each | each name ]). copyWithoutAll: (self class instanceVariables collect: [ :each | each name ]).
customKeys ifEmpty: [ ^ self ]. customKeys ifEmpty: [ self uidGenerator ].
customKeys do: [:key | | valueTemp | customKeys do: [:key | | valueTemp |
valueTemp := aDictionary at: key. valueTemp := aDictionary at: key.
valueTemp class = Array valueTemp class = Array
@ -539,8 +539,7 @@ Tiddler >> uid [
{ #category : #accessing } { #category : #accessing }
Tiddler >> uidGenerator [ Tiddler >> uidGenerator [
self created ifNil: [ self created: self class nowLocal ]. ^ self customFields at: 'uid' put: NanoID generate.
^ self customFields at: 'uid' put: self createdReversableEncoded.
] ]

View File

@ -155,8 +155,9 @@ TiddlyWiki >> exportCommonTiddlers [
| content | | content |
content := self commonTiddlers. content := self commonTiddlers.
^ content do: [ :each | content do: [ :each |
each exportSTONFileOptimized ]. each exportSTONFileOptimized ].
^ self tiddlersFolder
] ]
{ #category : #accessing } { #category : #accessing }