Fixing metadata sanitization/exportation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-11-03 10:25:46 -05:00
parent bb75994dd0
commit 0987d4520f
2 changed files with 8 additions and 7 deletions

View File

@ -15,7 +15,7 @@ LeCodeSnippet >> metadataUpdate [
at: 'parent' put: surrogate; at: 'parent' put: surrogate;
at: 'created' put: self createTime asString; at: 'created' put: self createTime asString;
at: 'modified' put: self latestEditTime asString; at: 'modified' put: self latestEditTime asString;
at: 'creator' put: self createEmail asString; at: 'creator' put: self createEmail asString withoutXMLTagDelimiters;
at: 'modifier' put: self editEmail asString; at: 'modifier' put: self editEmail asString withoutXMLTagDelimiters;
yourself yourself
] ]

View File

@ -66,7 +66,7 @@ LeTextualSnippet >> markdownCustomOpener [
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LeTextualSnippet >> metadata [ LeTextualSnippet >> metadata [
^ self optionAt: 'metadata' ifAbsentPut: [ self metadataUpdate ] ^ self metadataUpdate
] ]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
@ -76,7 +76,7 @@ LeTextualSnippet >> metadataUpdate [
editEmailSanitized := self editEmail asString withoutXMLTagDelimiters. editEmailSanitized := self editEmail asString withoutXMLTagDelimiters.
^ OrderedDictionary new ^ OrderedDictionary new
at: 'id' put: self uidString; at: 'id' put: self uidString;
at: 'parent' put: self parent uuid; at: 'parent' put: self parent uid;
at: 'created' put: self createTime asString; at: 'created' put: self createTime asString;
at: 'modified' put: self latestEditTime asString; at: 'modified' put: self latestEditTime asString;
at: 'creator' put: createEmailSanitized; at: 'creator' put: createEmailSanitized;
@ -91,11 +91,12 @@ LeTextualSnippet >> options [
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LeTextualSnippet >> sanitizeMetadata [ LeTextualSnippet >> sanitizeMetadata [
self options removeKey: 'metadata'. self options ifNil: [^ self ].
self options removeKey: 'metadata' ifAbsent: [^ self ].
self metadata keysAndValuesDo: [:k :v | self metadata keysAndValuesDo: [:k :v |
(v includesAny: #($< $>)) (v asString includesAny: #($< $>))
ifTrue: [ ifTrue: [
self metadata at: k put: (v copyWithoutXMLDelimiters) self metadata at: k put: (v asString copyWithoutXMLDelimiters)
] ]
] ]
] ]