Markdown metadata as an object itself. Separating it at creation needs to be implemented.
This commit is contained in:
parent
11dc04e39f
commit
1fe6a8f548
@ -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 }
|
||||
|
Loading…
Reference in New Issue
Block a user