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 markdeep := Markdeep new
title: self title; title: self title;
body: bodyStream contents. 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 | self metadata keysAndValuesDo: [:k :v |
markdeep header markdeep header
add: '<meta name="', k, '" content="', v,'">'; add: '<meta name="', k, '" content="', v,'">';

View File

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