Minor change used to test commit from Pharo 9.x
This commit is contained in:
parent
5d68e79c2b
commit
92047f7d23
@ -34,7 +34,7 @@ Markdown >> commentYAMLMetadata [
|
||||
newContents nextPutAll: self extractYAMLMetadata.
|
||||
newContents nextPutAll: String cr.
|
||||
newContents nextPutAll: '-->'; crlf.
|
||||
(self lines copyFrom: self locateYAMLMetadataClosing + 2 to: self lines size) do: [ :line |
|
||||
(self lines copyFrom: self yamlMetadataClosingLineNumber + 2 to: self lines size) do: [ :line |
|
||||
newContents nextPutAll: line; crlf ].
|
||||
self contents: newContents contents.
|
||||
^ self contents
|
||||
@ -42,7 +42,7 @@ Markdown >> commentYAMLMetadata [
|
||||
|
||||
{ #category : #utilities }
|
||||
Markdown >> containsYAMLMetadataClosing [
|
||||
^ self locateYAMLMetadataClosing > 0
|
||||
^ self yamlMetadataClosingLineNumber > 0
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
@ -98,7 +98,7 @@ Markdown >> exportMetadataAsYaml [
|
||||
Markdown >> extractYAMLMetadata [
|
||||
| output yamlLines |
|
||||
self detectYAMLMetadata ifFalse: [ ^ nil ].
|
||||
yamlLines := self lines copyFrom: 2 to: (self locateYAMLMetadataClosing).
|
||||
yamlLines := self lines copyFrom: 2 to: (self yamlMetadataClosingLineNumber).
|
||||
output := '' writeStream.
|
||||
yamlLines do: [ :line |
|
||||
output
|
||||
@ -129,18 +129,6 @@ Markdown >> lines [
|
||||
^ self contents lines.
|
||||
]
|
||||
|
||||
{ #category : #utilities }
|
||||
Markdown >> locateYAMLMetadataClosing [
|
||||
"I return the line where the closing of the YAML metadata occurs or 0 if no closing is found."
|
||||
| result |
|
||||
self startsWithYAMLMetadataDelimiter ifFalse: [ ^ self ].
|
||||
result := 0.
|
||||
self lines allButFirst doWithIndex: [ :currentLine :i |
|
||||
(currentLine beginsWith: self class yamlMetadataDelimiter) ifTrue: [ result := i ]].
|
||||
^ result
|
||||
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdown >> metadata [
|
||||
| rawMeta |
|
||||
@ -167,3 +155,12 @@ Markdown >> yamlMetadataAsString [
|
||||
output nextPutAll: self class yamlMetadataDelimiter; cr.
|
||||
^ output contents.
|
||||
]
|
||||
|
||||
{ #category : #utilities }
|
||||
Markdown >> yamlMetadataClosingLineNumber [
|
||||
"I return the line where the closing of the YAML metadata occurs or 0 if no closing is found."
|
||||
self startsWithYAMLMetadataDelimiter ifFalse: [ ^ self ].
|
||||
self lines allButFirst doWithIndex: [ :currentLine :i |
|
||||
(currentLine beginsWith: self class yamlMetadataDelimiter) ifTrue: [ ^ i + 1 ]]
|
||||
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user