diff --git a/src/MiniDocs/LeDatabase.extension.st b/src/MiniDocs/LeDatabase.extension.st index b084682..64c6151 100644 --- a/src/MiniDocs/LeDatabase.extension.st +++ b/src/MiniDocs/LeDatabase.extension.st @@ -43,7 +43,7 @@ LeDatabase >> addPageFromMarkdeep: markdeepDocTree withRemote: externalDocLocati remoteMetadata := Markdeep new metadataFromXML: markdeepDocTree. "Ensuring remote metadata has consistent data" remoteMetadata at: 'origin' put: externalDocLocation. - remoteMetadata at: 'title' ifAbsentPut: [ page detectMarkdeepTitleFrom: markdeepDocTree ]. + remoteMetadata at: 'title' ifAbsentPut: [ markdeepDocTree detectMarkdeepTitle ]. remoteMetadata at: 'id' ifAbsentPut: [UUID new asString36]. remoteMetadata at: 'created' ifAbsentPut: [ DateAndTime now] . remoteMetadata at: 'creator' ifAbsentPut: [ 'unknown' ]. diff --git a/src/MiniDocs/LePage.extension.st b/src/MiniDocs/LePage.extension.st index 109076f..d21769f 100644 --- a/src/MiniDocs/LePage.extension.st +++ b/src/MiniDocs/LePage.extension.st @@ -99,14 +99,6 @@ LePage >> defaultPandocTemplate [ ^ FileLocator home / '.pandoc' / 'templates' / 'clean-menu-mod.html' ] -{ #category : #'*MiniDocs' } -LePage >> detectMarkdeepTitleFrom: xmlSubtree [ - | titleLine | - titleLine := (xmlSubtree nodesCollect: [:node | node contentString ]) first lines - detect: [:line | line includesSubstring: ' **'] ifNone: ['Untitled']. - ^ titleLine trimmed trimBoth: [:char | char = $* ] -] - { #category : #'*MiniDocs' } LePage >> detectParentSnippetWithUid: uidString [ uidString = self uid asString36 ifTrue: [ ^ self ]. diff --git a/src/MiniDocs/XMLDocument.extension.st b/src/MiniDocs/XMLDocument.extension.st new file mode 100644 index 0000000..d4574b6 --- /dev/null +++ b/src/MiniDocs/XMLDocument.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #XMLDocument } + +{ #category : #'*MiniDocs' } +XMLDocument >> detectMarkdeepTitle [ + | titleLine | + titleLine := (self nodesCollect: [:node | node contentString ]) first lines + detect: [:line | line includesSubstring: ' **'] ifNone: ['Untitled']. + ^ titleLine trimmed trimBoth: [:char | char = $* ] +]