Fixing metadata retention between HedgeDoc and Lepiter.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-10-22 13:35:24 -05:00
parent 02403b5ae3
commit 58ec9eed76
2 changed files with 8 additions and 3 deletions

View File

@ -37,7 +37,9 @@ HedgeDoc >> asLePage [
addSnippet: snippet; addSnippet: snippet;
yourself. yourself.
newPage incomingLinks. newPage incomingLinks.
newPage metadata addAll: self metadata. newPage options
at: 'originalMetadata' put: self metadata;
at: 'url' put: self url.
^ newPage ^ newPage
] ]
@ -162,7 +164,6 @@ HedgeDoc >> url: anObject [
(html xpath: '//head/meta[@name="application-name"][@content = "HedgeDoc - Ideas grow better together"]') isEmpty (html xpath: '//head/meta[@name="application-name"][@content = "HedgeDoc - Ideas grow better together"]') isEmpty
ifTrue: [ self inform: 'Not a hedgedoc url'. ifTrue: [ self inform: 'Not a hedgedoc url'.
url := nil ]. url := nil ].
self metadata at: 'title' put: tempUrl firstPathSegment.
server := tempUrl host. server := tempUrl host.
url := anObject url := anObject
] ]

View File

@ -160,7 +160,10 @@ Markdown >> fromFile: aFileReference [
{ #category : #'instance creation' } { #category : #'instance creation' }
Markdown >> fromString: markdownString [ Markdown >> fromString: markdownString [
markdownString yamlMetadata markdownString yamlMetadata
ifNotNil: [(self metadata) at: 'original' put: markdownString yamlMetadata]. ifNotNil: [
self metadata
ifEmpty: [self metadata: markdownString yamlMetadata]
ifNotEmpty: [self metadata at: 'original' put: markdownString yamlMetadata]].
self body: markdownString contentsWithoutYAMLMetadata self body: markdownString contentsWithoutYAMLMetadata
] ]
@ -190,6 +193,7 @@ Markdown >> lines [
Markdown >> metadata [ Markdown >> metadata [
^ metadata ifNil: [ metadata := Dictionary new]. ^ metadata ifNil: [ metadata := Dictionary new].
] ]