2022-07-19 21:51:20 +00:00
|
|
|
Extension { #name : #LeTextSnippet }
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
2022-07-26 22:25:17 +00:00
|
|
|
LeTextSnippet >> contentFrom: markdeepDiv [
|
2022-09-29 23:54:23 +00:00
|
|
|
|
|
|
|
| sanitizedStringText metadata |
|
|
|
|
metadata := STON fromString: (markdeepDiv attributes at: 'st-data').
|
|
|
|
sanitizedStringText := markdeepDiv contentString.
|
|
|
|
sanitizedStringText := sanitizedStringText allButFirst.
|
|
|
|
sanitizedStringText := sanitizedStringText allButLast.
|
|
|
|
self string: sanitizedStringText;
|
|
|
|
uid: (metadata at: 'id');
|
|
|
|
parent: (metadata at: 'parent');
|
|
|
|
createTime: (metadata at: 'created');
|
|
|
|
editTime: (metadata at: 'modified');
|
|
|
|
editEmail: (metadata at: 'modifier');
|
|
|
|
createEmail: (metadata at: 'creator')
|
2022-07-26 22:25:17 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextSnippet >> metadata [
|
|
|
|
|
|
|
|
^ self optionAt: 'metadata' ifAbsentPut: [ self metadataInit ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextSnippet >> metadataInit [
|
|
|
|
|
|
|
|
^ OrderedDictionary new
|
|
|
|
at: 'id' put: self uidString;
|
|
|
|
at: 'parent' put: self parentId;
|
|
|
|
at: 'created' put: self createTime asString;
|
|
|
|
at: 'modified' put: self latestEditTime asString;
|
|
|
|
at: 'creator' put: self createEmail asString;
|
|
|
|
at: 'modifier' put: self editEmail asString;
|
|
|
|
yourself
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextSnippet >> options [
|
|
|
|
^ options
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextSnippet >> parentId [
|
|
|
|
self parent ifNil: [ ^ self ].
|
|
|
|
^ self parent uidString.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
|
|
LeTextSnippet >> taggedWith: aString [
|
|
|
|
self metadata at: 'tags' ifPresent: [ (self metadata at: 'tags') add: aString; yourself ] ifAbsentPut: [ Set new ].
|
|
|
|
^ self metadata at: 'tags'
|
2022-07-19 21:51:20 +00:00
|
|
|
]
|