diff --git a/repository/TiddlyWiki/Tiddler.class.st b/repository/TiddlyWiki/Tiddler.class.st index c8d7fce..0ce89a9 100644 --- a/repository/TiddlyWiki/Tiddler.class.st +++ b/repository/TiddlyWiki/Tiddler.class.st @@ -482,6 +482,23 @@ Tiddler >> removeTag: aTag [ ^ self ] +{ #category : #accessing } +Tiddler >> renameExternalMediaLinksInto: relativePath [ + "This first implementation only renames external media links in custom fields. + Further development should offer the possibility to rename also the external media + appearing in the tiddler's text." + self customFieldsWithMediaLinks keysAndValuesDo: [:customField :oldLink | | link name | + link := oldLink asUrl. + link hasScheme ifFalse: [^ self ]. + name := link segments last copyWithoutAll: '-'. + name := name asDashedLowercase. + name := (relativePath, '/', NanoID generate, '--', name). + self customFields + at: customField, '--original' put: oldLink; + at: customField put: name +]. +] + { #category : #accessing } Tiddler >> revision [ ^ revision