Merge a51583e5fc
This commit is contained in:
commit
b7fdbb731c
@ -5,7 +5,6 @@ Class {
|
|||||||
#name : #Markdeep,
|
#name : #Markdeep,
|
||||||
#superclass : #Markdown,
|
#superclass : #Markdown,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'title',
|
|
||||||
'comments',
|
'comments',
|
||||||
'tail',
|
'tail',
|
||||||
'language',
|
'language',
|
||||||
|
@ -9,7 +9,8 @@ Class {
|
|||||||
#superclass : #MarkupFile,
|
#superclass : #MarkupFile,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'metadata',
|
'metadata',
|
||||||
'body'
|
'body',
|
||||||
|
'title'
|
||||||
],
|
],
|
||||||
#category : #'MiniDocs-Core'
|
#category : #'MiniDocs-Core'
|
||||||
}
|
}
|
||||||
@ -65,6 +66,9 @@ Markdown >> contents [
|
|||||||
| response |
|
| response |
|
||||||
response := WriteStream on: ''.
|
response := WriteStream on: ''.
|
||||||
response
|
response
|
||||||
|
nextPutAll: '---'; cr;
|
||||||
|
nextPutAll: self metadataAsYAML; cr;
|
||||||
|
nextPutAll: '---'; cr;
|
||||||
nextPutAll: self body.
|
nextPutAll: self body.
|
||||||
^ response contents
|
^ response contents
|
||||||
]
|
]
|
||||||
@ -177,7 +181,8 @@ Markdown >> file: aFileReference [
|
|||||||
Markdown >> fromFile: aFileReference [
|
Markdown >> fromFile: aFileReference [
|
||||||
self contents: aFileReference contents.
|
self contents: aFileReference contents.
|
||||||
self file: aFileReference.
|
self file: aFileReference.
|
||||||
self populateMetadata
|
self populateMetadata.
|
||||||
|
self body: self contentsWithoutYAMLMetadata
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
@ -195,6 +200,14 @@ Markdown >> gtTextFor: aView [
|
|||||||
text: [ self contents ]
|
text: [ self contents ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
Markdown >> headerAsTitle [
|
||||||
|
| headerNode |
|
||||||
|
headerNode := self documentTree children
|
||||||
|
detect: [ :node | node className = 'PPCMHeader' and: [ node level = 1 ] ] ifNone: [ ^ nil ].
|
||||||
|
^ headerNode text
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #utilities }
|
{ #category : #utilities }
|
||||||
Markdown >> lines [
|
Markdown >> lines [
|
||||||
self file ifNotNil: [^ self file contents lines ].
|
self file ifNotNil: [^ self file contents lines ].
|
||||||
@ -241,7 +254,7 @@ Markdown >> populateMetadata [
|
|||||||
Markdown >> printOn: aStream [
|
Markdown >> printOn: aStream [
|
||||||
super printOn: aStream.
|
super printOn: aStream.
|
||||||
aStream
|
aStream
|
||||||
nextPutAll: '( ', (self metadata at: 'title' ifAbsent: ['untitled']), ' )'
|
nextPutAll: '( ', self title , ' )'
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #utilities }
|
{ #category : #utilities }
|
||||||
@ -251,6 +264,11 @@ Markdown >> startsWithYAMLMetadataDelimiter [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
Markdown >> title [
|
||||||
|
^ self metadata at: 'title' ifAbsentPut: [ self headerAsTitle]
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #utilities }
|
{ #category : #utilities }
|
||||||
Markdown >> yamlMetadataClosingLineNumber [
|
Markdown >> yamlMetadataClosingLineNumber [
|
||||||
"I return the line where the closing of the YAML metadata occurs or 0 if no closing is found."
|
"I return the line where the closing of the YAML metadata occurs or 0 if no closing is found."
|
||||||
|
Loading…
Reference in New Issue
Block a user