Preserving HedgeDoc importation metadata when converted to Markdeep.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-11-12 18:03:32 -05:00
parent ca3550a3f4
commit d2959856b9
4 changed files with 18 additions and 4 deletions

View File

@ -57,8 +57,8 @@ HedgeDoc >> asLePage [
splitAdmonitionSnippets. splitAdmonitionSnippets.
newPage editTime: DateAndTime now. newPage editTime: DateAndTime now.
newPage options newPage options
at: 'originalMetadata' put: self metadata; at: 'HedgeDoc' at: 'yamlFrontmatter' put: self metadata;
at: 'url' put: self url. at: 'HedgeDoc' at: 'url' put: self url.
^ newPage ^ newPage
] ]

View File

@ -21,6 +21,7 @@ LePage >> asHtmlFile [
LePage >> asMarkdeep [ LePage >> asMarkdeep [
| bodyStream markdeep | | bodyStream markdeep |
bodyStream := '' writeStream. bodyStream := '' writeStream.
bodyStream nextPutAll: self notebookMetadataSnippet asMarkdeep.
self preorderTraversal self preorderTraversal
do: [ :snippet | bodyStream nextPutAll: snippet asMarkdeep ]. do: [ :snippet | bodyStream nextPutAll: snippet asMarkdeep ].
markdeep := Markdeep new markdeep := Markdeep new
@ -231,6 +232,17 @@ LePage >> navTop [
ifTrue: [ ^ topNavFile contents ] ifTrue: [ ^ topNavFile contents ]
] ]
{ #category : #'*MiniDocs' }
LePage >> notebookMetadataSnippet [
| response |
response := LeTextSnippet new fromString: '<!-- See this snippet source code for this notebook''s metadata -->'.
response parent: self.
(self optionAt: 'HedgeDoc') ifNil: [ ^ response ].
(response extra)
at: 'HedgeDoc' put: (self optionAt: 'HedgeDoc').
^ response
]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LePage >> olderChild [ LePage >> olderChild [
"I provide the last edited child node. "I provide the last edited child node.

View File

@ -38,7 +38,9 @@ LeTextSnippet >> fromMarkdeep: markdeepDiv [
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LeTextSnippet >> fromString: aString [ LeTextSnippet >> fromString: aString [
self string: aString self
string: aString;
uid: LeUID new.
] ]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }

View File

@ -109,7 +109,7 @@ LeTextualSnippet >> metadataUpdate [
editEmailSanitized := self editEmail asString withoutXMLTagDelimiters. editEmailSanitized := self editEmail asString withoutXMLTagDelimiters.
^ OrderedDictionary new ^ OrderedDictionary new
at: 'id' put: self uidString; at: 'id' put: self uidString;
at: 'parent' put: self parent uidString; at: 'parent' put: (self parent ifNotNil: [self parent uidString]);
at: 'created' put: self createTime asString; at: 'created' put: self createTime asString;
at: 'modified' put: self latestEditTime asString; at: 'modified' put: self latestEditTime asString;
at: 'creator' put: createEmailSanitized; at: 'creator' put: createEmailSanitized;