Renaming external media links.
This commit is contained in:
parent
9e50d4836b
commit
a2c01e251c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user