Markdown metadata as an object itself. Separating it at creation needs to be implemented.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-03-09 10:10:55 -05:00
parent 11dc04e39f
commit 1fe6a8f548

View File

@ -9,7 +9,8 @@ Class {
#superclass : #Object,
#instVars : [
'contents',
'file'
'file',
'metadata'
],
#category : #MiniDocs
}
@ -113,6 +114,7 @@ Markdown >> fromFile: aFileReference [
{ #category : #'instance creation' }
Markdown >> fromString: markdownString [
self contents: markdownString.
self populateMetadata
]
{ #category : #accessing }
@ -130,12 +132,25 @@ Markdown >> lines [
{ #category : #accessing }
Markdown >> metadata [
^ metadata ifNil: [ metadata := Dictionary new].
]
{ #category : #accessing }
Markdown >> metadata: rawMeta [
metadata := rawMeta
]
{ #category : #accessing }
Markdown >> populateMetadata [
| rawMeta |
rawMeta := MiniDocs yamlToJson: self yamlMetadataString.
rawMeta associationsDo: [ :assoc |
assoc value = 'false' ifTrue: [ assoc value: false ].
assoc value = 'true' ifTrue: [ assoc value: true ] ].
^ rawMeta
self metadata: rawMeta
]
{ #category : #accessing }