Improving HedgeDoc objects reading from web links.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-03-25 16:23:14 -05:00
parent 80afb07c77
commit 27a20e83b0
2 changed files with 12 additions and 6 deletions

View File

@ -42,7 +42,7 @@ HedgeDoc >> asMarkdownTiddler [
{ #category : #accessing }
HedgeDoc >> contents [
^ body
^ super contents
]
{ #category : #accessing }
@ -55,6 +55,12 @@ HedgeDoc >> defaultServer [
self server: 'https://docutopia.tupale.co'.
]
{ #category : #accessing }
HedgeDoc >> fromLink: aString [
self url: aString.
self retrieveContents
]
{ #category : #'as yet unclassified' }
HedgeDoc >> htmlUrl [
| link |
@ -81,7 +87,7 @@ HedgeDoc >> pad: anObject [
{ #category : #accessing }
HedgeDoc >> retrieveContents [
self url ifNil: [ ^ self ].
self contents: (self url addPathSegment: 'download') retrieveContents.
self fromString: (self url addPathSegment: 'download') retrieveContents.
^ self.
]

View File

@ -62,7 +62,7 @@ Markdown >> contents [
response
nextPutAll: '---'; cr;
nextPutAll: self metadataAsYAML; cr;
nextPutAll: '---'; cr; cr;
nextPutAll: '---'; cr;
nextPutAll: self body.
^ response contents
]
@ -76,7 +76,7 @@ Markdown >> contents: aString [
Markdown >> documentTree [
| parser|
self contents ifNil: [^ nil].
parser := PPCommonMarkBlockParser new parse: self contents.
parser := PPCommonMarkBlockParser new parse: self body.
^ parser accept: CMBlockVisitor new
]
@ -191,7 +191,7 @@ Markdown >> metadata: rawMeta [
{ #category : #accessing }
Markdown >> metadataAsYAML [
self metadata isEmptyOrNil ifTrue: [ ^ '' ].
^ YQ jsonToYaml: self metadata
^ (YQ jsonToYaml: self metadata) accentedCharactersCorrection
]
{ #category : #persistence }