55 lines
1.6 KiB
Smalltalk
55 lines
1.6 KiB
Smalltalk
Extension { #name : #LeTextSnippet }
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
LeTextSnippet >> contentFrom: markdeepDiv [
|
|
|
|
| sanitizedStringText metadata |
|
|
metadata := STON fromString: (markdeepDiv attributes at: 'st-data').
|
|
sanitizedStringText := markdeepDiv contentString.
|
|
sanitizedStringText := sanitizedStringText allButFirst.
|
|
sanitizedStringText := sanitizedStringText allButLast.
|
|
self string: sanitizedStringText;
|
|
uid: (LeUID new uidString: (metadata at: 'id'));
|
|
parent: (metadata at: 'parent');
|
|
createTime: (LeTime new time: ((metadata at: 'created')asDateAndTime));
|
|
editTime: (LeTime new time: ((metadata at: 'modified') asDateAndTime));
|
|
editEmail: (metadata at: 'modifier');
|
|
createEmail: (metadata at: 'creator')
|
|
]
|
|
|
|
{ #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'
|
|
]
|