Using other YAML prepackaged parsers.
This commit is contained in:
parent
d822926612
commit
738697bc63
@ -159,12 +159,18 @@ Markdown >> fromFile: aFileReference [
|
||||
|
||||
{ #category : #'instance creation' }
|
||||
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: [
|
||||
self metadata
|
||||
ifEmpty: [self metadata: markdownString yamlMetadata]
|
||||
ifNotEmpty: [self metadata at: 'original' put: markdownString yamlMetadata]].
|
||||
self body: markdownString contentsWithoutYAMLMetadata
|
||||
ifEmpty: [ self metadata: yamlMetadataRaw ]
|
||||
ifNotEmpty: [ self metadata at: 'hedgeDoc' put: yamlMetadataRaw ]].
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@ -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' }
|
||||
OrderedDictionary >> treeView [
|
||||
| view |
|
||||
|
Loading…
Reference in New Issue
Block a user