Renaming external media links.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-04-04 12:08:06 -05:00
parent 9e50d4836b
commit a2c01e251c

View File

@ -482,6 +482,23 @@ Tiddler >> removeTag: aTag [
^ self ^ 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 } { #category : #accessing }
Tiddler >> revision [ Tiddler >> revision [
^ revision ^ revision