From 0987d4520f615c0ab70797c1c279cf4bf66bebec Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Fri, 3 Nov 2023 10:25:46 -0500 Subject: [PATCH] Fixing metadata sanitization/exportation. --- src/MiniDocs/LeCodeSnippet.extension.st | 4 ++-- src/MiniDocs/LeTextualSnippet.extension.st | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/MiniDocs/LeCodeSnippet.extension.st b/src/MiniDocs/LeCodeSnippet.extension.st index f4fba87..71abad1 100644 --- a/src/MiniDocs/LeCodeSnippet.extension.st +++ b/src/MiniDocs/LeCodeSnippet.extension.st @@ -15,7 +15,7 @@ LeCodeSnippet >> metadataUpdate [ at: 'parent' put: surrogate; at: 'created' put: self createTime asString; at: 'modified' put: self latestEditTime asString; - at: 'creator' put: self createEmail asString; - at: 'modifier' put: self editEmail asString; + at: 'creator' put: self createEmail asString withoutXMLTagDelimiters; + at: 'modifier' put: self editEmail asString withoutXMLTagDelimiters; yourself ] diff --git a/src/MiniDocs/LeTextualSnippet.extension.st b/src/MiniDocs/LeTextualSnippet.extension.st index 2523f7d..a38d1b4 100644 --- a/src/MiniDocs/LeTextualSnippet.extension.st +++ b/src/MiniDocs/LeTextualSnippet.extension.st @@ -66,7 +66,7 @@ LeTextualSnippet >> markdownCustomOpener [ { #category : #'*MiniDocs' } LeTextualSnippet >> metadata [ - ^ self optionAt: 'metadata' ifAbsentPut: [ self metadataUpdate ] + ^ self metadataUpdate ] { #category : #'*MiniDocs' } @@ -76,7 +76,7 @@ LeTextualSnippet >> metadataUpdate [ editEmailSanitized := self editEmail asString withoutXMLTagDelimiters. ^ OrderedDictionary new at: 'id' put: self uidString; - at: 'parent' put: self parent uuid; + at: 'parent' put: self parent uid; at: 'created' put: self createTime asString; at: 'modified' put: self latestEditTime asString; at: 'creator' put: createEmailSanitized; @@ -91,11 +91,12 @@ LeTextualSnippet >> options [ { #category : #'*MiniDocs' } LeTextualSnippet >> sanitizeMetadata [ - self options removeKey: 'metadata'. + self options ifNil: [^ self ]. + self options removeKey: 'metadata' ifAbsent: [^ self ]. self metadata keysAndValuesDo: [:k :v | - (v includesAny: #($< $>)) + (v asString includesAny: #($< $>)) ifTrue: [ - self metadata at: k put: (v copyWithoutXMLDelimiters) + self metadata at: k put: (v asString copyWithoutXMLDelimiters) ] ] ]