Support for metadata en Markdeep page exportation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-01-28 18:53:07 -05:00
parent ed6d66fb2a
commit a5e2db3869
2 changed files with 24 additions and 2 deletions

View File

@ -10,6 +10,8 @@ LePage >> asMarkdeep [
markdeep := Markdeep new
title: self title;
body: bodyStream contents.
markdeep metadata at: 'authors' put: (self metadata at: 'authors').
markdeep metadata at: 'version' put: (self metadata at: 'version').
self metadata keysAndValuesDo: [:k :v |
markdeep header
add: '<meta name="', k, '" content="', v,'">';

View File

@ -12,7 +12,8 @@ Class {
'header',
'tail',
'language',
'config'
'config',
'metadata'
],
#category : #'Grafoscopio-Utils-Core'
}
@ -22,6 +23,11 @@ Markdeep class >> fromMarkdownFile: aFileReference [
^ self new fromMarkdownFile: aFileReference.
]
{ #category : #'instance creation' }
Markdeep >> authors [
^ self metadata at: 'authors' ifAbsent: [ ^'' ]
]
{ #category : #accessing }
Markdeep >> body [
^ body
@ -89,7 +95,9 @@ Markdeep >> contents [
output := '' writeStream.
output
nextPutAll: self headerContents; lf; lf;
nextPutAll: ' **', self title, '**'; lf; lf;
nextPutAll: ' **', self title, '**'; lf;
nextPutAll: ' **', self authors, '**'; lf;
nextPutAll: ' ', self version; lf; lf;
nextPutAll: self body; lf; lf;
nextPutAll: self tail; lf; lf; lf; lf;
nextPutAll: self commentsSupport.
@ -186,6 +194,11 @@ Markdeep >> markdownFile: aFileReference [
self config at: 'markdownFile' put: aFileReference
]
{ #category : #'instance creation' }
Markdeep >> metadata [
^ metadata ifNil: [ metadata := OrderedDictionary new ]
]
{ #category : #printing }
Markdeep >> printOn: aStream [
@ -243,3 +256,10 @@ Markdeep >> tocStyle [
Markdeep >> tocStyle: anObject [
tocStyle := anObject
]
{ #category : #'instance creation' }
Markdeep >> version [
| semVer |
semVer := self metadata at: 'version' ifAbsent: [ ^'' ].
^ 'v', semVer
]