Fixing pharo snippet parsing for importer.

This commit is contained in:
ruidajo 2022-10-10 09:09:05 -05:00
parent 9371ddfef6
commit a833a6245b

View File

@ -11,11 +11,13 @@ LePharoSnippet >> contentAsStringCustomized [
{ #category : #'*MiniDocs' }
LePharoSnippet >> contentFrom: markdeepDiv [
| sanitizedStringText metadata |
| sanitizedStringText metadata joinedText |
metadata := STON fromString: (markdeepDiv attributes at: 'st-data').
sanitizedStringText := markdeepDiv contentString lines reject: [ :line | line beginsWith: '~~~' ].
sanitizedStringText := "(Character cr asString)" '' join: sanitizedStringText.
self code: sanitizedStringText;
sanitizedStringText := markdeepDiv contentString lines.
sanitizedStringText := sanitizedStringText copyFrom: 4 to: sanitizedStringText size -2.
joinedText := '' writeStream.
sanitizedStringText do: [ :line | joinedText nextPutAll: line; nextPut: Character lf ].
self code: joinedText contents allButLast;
uid: (LeUID new uidString: (metadata at: 'id'));
parent: (metadata at: 'parent');
createTime: (LeTime new time: ((metadata at: 'created')asDateAndTime));