Using other YAML prepackaged parsers.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-12-14 17:07:55 -05:00
parent d822926612
commit 738697bc63
2 changed files with 20 additions and 4 deletions

View File

@ -159,12 +159,18 @@ Markdown >> fromFile: aFileReference [
{ #category : #'instance creation' } { #category : #'instance creation' }
Markdown >> fromString: markdownString [ Markdown >> fromString: markdownString [
markdownString yamlMetadata | yamlMetadataRaw bodyTemp |
yamlMetadataRaw := (YamlHeaderParser parse: markdownString).
bodyTemp := '' writeStream.
(yamlMetadataRaw removeKey: 'body') do: [:paragraph |
bodyTemp nextPutAll: paragraph; cr; cr
].
self body: bodyTemp contents withInternetLineEndings.
yamlMetadataRaw
ifNotNil: [ ifNotNil: [
self metadata self metadata
ifEmpty: [self metadata: markdownString yamlMetadata] ifEmpty: [ self metadata: yamlMetadataRaw ]
ifNotEmpty: [self metadata at: 'original' put: markdownString yamlMetadata]]. ifNotEmpty: [ self metadata at: 'hedgeDoc' put: yamlMetadataRaw ]].
self body: markdownString contentsWithoutYAMLMetadata
] ]
{ #category : #accessing } { #category : #accessing }

View File

@ -62,6 +62,16 @@ OrderedDictionary >> replaceWithUniqueNilsAndBooleansStartingAt: anInteger [
] ]
] ]
{ #category : #'*MiniDocs' }
OrderedDictionary >> sanitizeMultilineValuesWith: aString [
| toSanitize |
toSanitize := OrderedCollection new.
self keysAndValuesDo: [:k :v |
(v isString and: [v lines size > 1]) ifTrue: [ toSanitize add: k ]
].
^ toSanitize
]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
OrderedDictionary >> treeView [ OrderedDictionary >> treeView [
| view | | view |