Implementing readability of LePictureSnippets from Markdeep.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-10-31 14:03:39 -05:00
parent 056dad228a
commit eda63bfc3a
3 changed files with 15 additions and 7 deletions

View File

@ -256,7 +256,9 @@ LeDatabase >> sanitizeMarkdeepSnippets: divSnippets withMetadata: remoteMetadata
snippetData := markdeepDiv asSnippetDictionary. snippetData := markdeepDiv asSnippetDictionary.
creationTime := snippetData at: 'created'. creationTime := snippetData at: 'created'.
modificationTime := snippetData at: 'modified'. modificationTime := snippetData at: 'modified'.
timestampWarning := [:timestamp | 'Modified timestamps: ', timestamp ,' date and time was replaced instead of nil value. See "origin" metadata for more historical traceability information.']. timestampWarning := [:timestamp |
'Modified timestamps: ', timestamp ,' date and time was replaced instead of nil value. See "origin" metadata for more historical traceability information.'
].
(creationTime = 'nil' and: [ modificationTime ~= 'nil' ]) (creationTime = 'nil' and: [ modificationTime ~= 'nil' ])
ifTrue: [ ifTrue: [
snippetData redefineTimestampsBefore: modificationTime. snippetData redefineTimestampsBefore: modificationTime.

View File

@ -19,6 +19,11 @@ OrderedDictionary >> asLepiterSnippet [
response := LePharoSnippet new. response := LePharoSnippet new.
response code: (self at: 'content') response code: (self at: 'content')
]. ].
(self at: 'className') = 'LePictureSnippet'
ifTrue: [
response := LePictureSnippet new.
"response code: (self at: 'content')"
].
response response
uid: (LeUID new uidString: (self at: 'id')); uid: (LeUID new uidString: (self at: 'id'));
parent: (self at: 'parent'); parent: (self at: 'parent');

View File

@ -13,11 +13,12 @@ XMLElement >> asSnippetDictionary [
XMLElement >> sanitizedContent [ XMLElement >> sanitizedContent [
| className sanitizedText | | className sanitizedText |
className := self attributes at: 'st-class'. className := self attributes at: 'st-class'.
(className = 'LeTextSnippet') ifTrue: [ ((className = 'LeTextSnippet') or: [className = 'LePictureSnippet'])
sanitizedText := self contentString. ifTrue: [
sanitizedText := sanitizedText allButFirst. sanitizedText := self contentString.
sanitizedText := sanitizedText allButLast. sanitizedText := sanitizedText allButFirst.
]. sanitizedText := sanitizedText allButLast.
].
(className = 'LePharoSnippet') ifTrue: [ | joinedText | (className = 'LePharoSnippet') ifTrue: [ | joinedText |
sanitizedText := self contentString lines. sanitizedText := self contentString lines.
sanitizedText := sanitizedText copyFrom: 4 to: sanitizedText size -2. sanitizedText := sanitizedText copyFrom: 4 to: sanitizedText size -2.