Cleaning Markdeep metadata exportation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-03-25 18:42:24 -05:00
parent 50a8595aa7
commit cd47d22480

View File

@ -21,32 +21,21 @@ LePage >> asHtmlFile [
LePage >> asMarkdeep [
| bodyStream markdeep |
bodyStream := '' writeStream.
self preorderTraversal do: [:snippet |
bodyStream nextPutAll: snippet asMarkdeep
].
self preorderTraversal
do: [ :snippet | bodyStream nextPutAll: snippet asMarkdeep ].
markdeep := Markdeep new
title: self title;
body: bodyStream contents;
file: self storage / self markdeepFileName;
navTop: self navTop.
markdeep head
add: '<meta title="', self title,'">'.
self metadata keysAndValuesDo: [:k :v |
k = 'lang'
ifTrue: [
markdeep head
add: '<meta lang="', v,'">';
yourself.
]
ifFalse: [
markdeep head
add: '<meta name="', k, '" content="', v,'">';
yourself.
]
].
self metadata at: 'authors' ifPresent: [:author | markdeep metadata at: 'authors' put: author ].
self metadata at: 'version' ifPresent: [:version | markdeep metadata at: 'version' put: version ].
^ markdeep.
title: self title;
body: bodyStream contents;
file: self storage / self markdeepFileName;
navTop: self navTop.
"self exportMetadataToHead: markdeep."
self metadata
at: 'authors'
ifPresent: [ :author | markdeep metadata at: 'authors' put: author ].
self metadata
at: 'version'
ifPresent: [ :version | markdeep metadata at: 'version' put: version ].
^ markdeep
]
{ #category : #'*MiniDocs' }
@ -102,6 +91,19 @@ LePage >> detectParentSnippetWithUid: uidString [
^ self preorderTraversal detect: [ :snippet | snippet uidString = uidString ]
]
{ #category : #'*MiniDocs' }
LePage >> exportMetadataToHead: markdeep [
self metadata
keysAndValuesDo: [ :k :v |
k = 'lang'
ifTrue: [ markdeep head
add: '<meta lang="' , v , '">';
yourself ]
ifFalse: [ markdeep head
add: '<meta name="' , k , '" content="' , v , '">';
yourself ] ]
]
{ #category : #'*MiniDocs' }
LePage >> exportedFileName [
| sanitized |