Promoting document title.
This commit is contained in:
parent
e22eb1221d
commit
a51583e5fc
@ -5,7 +5,6 @@ Class {
|
||||
#name : #Markdeep,
|
||||
#superclass : #Markdown,
|
||||
#instVars : [
|
||||
'title',
|
||||
'comments',
|
||||
'tail',
|
||||
'language',
|
||||
|
@ -9,7 +9,8 @@ Class {
|
||||
#superclass : #MarkupFile,
|
||||
#instVars : [
|
||||
'metadata',
|
||||
'body'
|
||||
'body',
|
||||
'title'
|
||||
],
|
||||
#category : #'MiniDocs-Core'
|
||||
}
|
||||
@ -199,6 +200,14 @@ Markdown >> gtTextFor: aView [
|
||||
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 }
|
||||
Markdown >> lines [
|
||||
self file ifNotNil: [^ self file contents lines ].
|
||||
@ -245,7 +254,7 @@ Markdown >> populateMetadata [
|
||||
Markdown >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
aStream
|
||||
nextPutAll: '( ', (self metadata at: 'title' ifAbsent: ['untitled']), ' )'
|
||||
nextPutAll: '( ', self title , ' )'
|
||||
]
|
||||
|
||||
{ #category : #utilities }
|
||||
@ -255,6 +264,11 @@ Markdown >> startsWithYAMLMetadataDelimiter [
|
||||
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdown >> title [
|
||||
^ self metadata at: 'title' ifAbsentPut: [ self headerAsTitle]
|
||||
]
|
||||
|
||||
{ #category : #utilities }
|
||||
Markdown >> yamlMetadataClosingLineNumber [
|
||||
"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