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