From 11dc04e39f0c6408559ac500f63fc40574dd16f4 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Thu, 9 Mar 2023 09:45:47 -0500 Subject: [PATCH] Improving creation and printing. Replacing old dependencies. --- src/MiniDocs/Markdown.class.st | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/MiniDocs/Markdown.class.st b/src/MiniDocs/Markdown.class.st index e9124ca..67cc94c 100644 --- a/src/MiniDocs/Markdown.class.st +++ b/src/MiniDocs/Markdown.class.st @@ -110,6 +110,11 @@ Markdown >> fromFile: aFileReference [ self file: aFileReference. ] +{ #category : #'instance creation' } +Markdown >> fromString: markdownString [ + self contents: markdownString. +] + { #category : #accessing } Markdown >> gtTextFor: aView [ @@ -126,7 +131,7 @@ Markdown >> lines [ { #category : #accessing } Markdown >> metadata [ | rawMeta | - rawMeta := PPYAMLGrammar new parse: self yamlMetadataString. + rawMeta := MiniDocs yamlToJson: self yamlMetadataString. rawMeta associationsDo: [ :assoc | assoc value = 'false' ifTrue: [ assoc value: false ]. assoc value = 'true' ifTrue: [ assoc value: true ] ]. @@ -137,7 +142,7 @@ Markdown >> metadata [ Markdown >> printOn: aStream [ super printOn: aStream. aStream - nextPutAll: '( ', (self metadata at: 'title'), ' )' + nextPutAll: '( ', (self metadata at: 'title' ifAbsent: ['untitled']), ' )' ] { #category : #utilities }