diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index 9f9f6e2..03fabae 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -183,7 +183,7 @@ Markdeep >> extractYamlMetadataFrom: documentTree [ yamlComment children allButFirst allButLast do: [:each | response nextPutAll: each text; cr ]. - ^ YAML2JSON fromString: response contents + ^ {YAML2JSON fromString: response contents . yamlComment } ] { #category : #accessing } @@ -194,7 +194,7 @@ Markdeep >> file: aFileReference [ { #category : #accessing } Markdeep >> fillInContentsFrom: aFileReference [ - | docTree docTreeChildren headTree bodyLineIndex | + | docTree docTreeChildren headTree bodyStartLine bodyEndLine contentLines rawMetadata | aFileReference exists ifFalse: [ ^ self ]. docTree := (Markdown new contents: aFileReference contents) documentTree. docTreeChildren := docTree children. @@ -205,15 +205,17 @@ Markdeep >> fillInContentsFrom: aFileReference [ headTree children allButFirst allButLast do: [ :node | node className = 'PPCMHtml' ifTrue: [ self head add: node text ] ]. self head: self head asSet asOrderedCollection. - self metadata: (self extractYamlMetadataFrom: docTree). + rawMetadata := (self extractYamlMetadataFrom: docTree). + self metadata: rawMetadata first. self title: (self metadata at: 'title' ifAbsent: [self extractTitleFrom: docTree]). self title: (self title trimBoth: [ :char | char = $" ]). self metadata at: 'title' put: self title. - bodyLineIndex := docTreeChildren - detectIndex: [ :node | node text includesSubstring: self title ]. - ^ {self . - bodyLineIndex. - docTree } + contentLines := self file contents lines. + bodyStartLine := (contentLines + detectIndex: [ :line | line includesSubstring: '