From 573c9298454fdf94af11c7a7dc37df3368baecfa Mon Sep 17 00:00:00 2001 From: Offray Date: Tue, 16 Apr 2024 14:18:41 -0500 Subject: [PATCH] Improving LeSnippet to LePage conversion. --- src/MiniDocs/LeTextSnippet.extension.st | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/MiniDocs/LeTextSnippet.extension.st b/src/MiniDocs/LeTextSnippet.extension.st index 02e62ab..5a222a6 100644 --- a/src/MiniDocs/LeTextSnippet.extension.st +++ b/src/MiniDocs/LeTextSnippet.extension.st @@ -2,9 +2,14 @@ Extension { #name : #LeTextSnippet } { #category : #'*MiniDocs' } LeTextSnippet >> asLePage [ - | page | + | page title currentSnippet | + title := self contentAsString markdownHeaders associations first value. + title := (title trimBoth: [:char | char = $# ]) trimmed. page := LePage new - initializeTitle: self contentAsString. + initializeTitle: title. + currentSnippet := LeTextSnippet new + string: self contentAsString. + page addSnippet: currentSnippet. self database addPage: page. self childrenDo: [:child | child moveToPageTitled: page title