Improving management of empty YAML metadata.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-08-02 12:35:21 -05:00
parent 554fb9000e
commit fb64d5c1ae
2 changed files with 3 additions and 1 deletions

View File

@ -159,7 +159,8 @@ Markdown >> fromFile: aFileReference [
{ #category : #'instance creation' }
Markdown >> fromString: markdownString [
(self metadata) at: 'original' put: markdownString yamlMetadata.
markdownString yamlMetadata
ifNotNil: [(self metadata) at: 'original' put: markdownString yamlMetadata].
self body: markdownString contentsWithoutYAMLMetadata
]

View File

@ -118,6 +118,7 @@ String >> withoutXMLTagDelimiters [
{ #category : #'*MiniDocs' }
String >> yamlMetadata [
self yamlMetadataString ifNil: [^ nil ].
^ (YAML2JSON fromString: self yamlMetadataString)
]