If YAML metadata is absent, then is not shown in the text view.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-11-21 17:54:29 -05:00
parent f85ed1803b
commit af064db451

View File

@ -29,7 +29,6 @@ Markdown >> asMarkdeep [
{ #category : #accessing } { #category : #accessing }
Markdown >> asMarkdownTiddler [ Markdown >> asMarkdownTiddler [
^ Tiddler new ^ Tiddler new
title: self title; title: self title;
text: self contents; text: self contents;
@ -67,12 +66,13 @@ Markdown >> containsYAMLMetadataClosing [
{ #category : #accessing } { #category : #accessing }
Markdown >> contents [ Markdown >> contents [
| response | | response metadataString |
response := WriteStream on: ''. response := WriteStream on: ''.
metadataString := self metadataAsYAML
ifEmpty: [ '' ]
ifNotEmpty: [ '---', String cr, self metadataAsYAML, String cr, '---', String cr ].
response response
nextPutAll: '---'; cr; nextPutAll: metadataString;
nextPutAll: self metadataAsYAML; cr;
nextPutAll: '---'; cr;
nextPutAll: (self body ifNil: [ '' ]). nextPutAll: (self body ifNil: [ '' ]).
^ response contents withInternetLineEndings ^ response contents withInternetLineEndings
] ]