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: self extractYAMLMetadata.
|
||||||
newContents nextPutAll: String cr.
|
newContents nextPutAll: String cr.
|
||||||
newContents nextPutAll: '-->'; crlf.
|
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 ].
|
newContents nextPutAll: line; crlf ].
|
||||||
self contents: newContents contents.
|
self contents: newContents contents.
|
||||||
^ self contents
|
^ self contents
|
||||||
@ -42,7 +42,7 @@ Markdown >> commentYAMLMetadata [
|
|||||||
|
|
||||||
{ #category : #utilities }
|
{ #category : #utilities }
|
||||||
Markdown >> containsYAMLMetadataClosing [
|
Markdown >> containsYAMLMetadataClosing [
|
||||||
^ self locateYAMLMetadataClosing > 0
|
^ self yamlMetadataClosingLineNumber > 0
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -98,7 +98,7 @@ Markdown >> exportMetadataAsYaml [
|
|||||||
Markdown >> extractYAMLMetadata [
|
Markdown >> extractYAMLMetadata [
|
||||||
| output yamlLines |
|
| output yamlLines |
|
||||||
self detectYAMLMetadata ifFalse: [ ^ nil ].
|
self detectYAMLMetadata ifFalse: [ ^ nil ].
|
||||||
yamlLines := self lines copyFrom: 2 to: (self locateYAMLMetadataClosing).
|
yamlLines := self lines copyFrom: 2 to: (self yamlMetadataClosingLineNumber).
|
||||||
output := '' writeStream.
|
output := '' writeStream.
|
||||||
yamlLines do: [ :line |
|
yamlLines do: [ :line |
|
||||||
output
|
output
|
||||||
@ -129,18 +129,6 @@ Markdown >> lines [
|
|||||||
^ self contents 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 }
|
{ #category : #accessing }
|
||||||
Markdown >> metadata [
|
Markdown >> metadata [
|
||||||
| rawMeta |
|
| rawMeta |
|
||||||
@ -167,3 +155,12 @@ Markdown >> yamlMetadataAsString [
|
|||||||
output nextPutAll: self class yamlMetadataDelimiter; cr.
|
output nextPutAll: self class yamlMetadataDelimiter; cr.
|
||||||
^ output contents.
|
^ 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