From af064db451db983592c68b4864f5f8bf3c4e8749 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Thu, 21 Nov 2024 17:54:29 -0500 Subject: [PATCH] If YAML metadata is absent, then is not shown in the text view. --- src/MiniDocs/Markdown.class.st | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/MiniDocs/Markdown.class.st b/src/MiniDocs/Markdown.class.st index 6ed9e62..804ed0d 100644 --- a/src/MiniDocs/Markdown.class.st +++ b/src/MiniDocs/Markdown.class.st @@ -29,7 +29,6 @@ Markdown >> asMarkdeep [ { #category : #accessing } Markdown >> asMarkdownTiddler [ - ^ Tiddler new title: self title; text: self contents; @@ -67,12 +66,13 @@ Markdown >> containsYAMLMetadataClosing [ { #category : #accessing } Markdown >> contents [ - | response | + | response metadataString | response := WriteStream on: ''. + metadataString := self metadataAsYAML + ifEmpty: [ '' ] + ifNotEmpty: [ '---', String cr, self metadataAsYAML, String cr, '---', String cr ]. response - nextPutAll: '---'; cr; - nextPutAll: self metadataAsYAML; cr; - nextPutAll: '---'; cr; + nextPutAll: metadataString; nextPutAll: (self body ifNil: [ '' ]). ^ response contents withInternetLineEndings ]