From 60939fe2b861ee0cb554e956cb29f73d2c7598f8 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Tue, 26 Mar 2024 19:50:40 -0500 Subject: [PATCH] Improving HedgeDoc(s) convert/import as LePage(s). --- src/MiniDocs/HedgeDoc.class.st | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/MiniDocs/HedgeDoc.class.st b/src/MiniDocs/HedgeDoc.class.st index 8b0ce30..49b21a1 100644 --- a/src/MiniDocs/HedgeDoc.class.st +++ b/src/MiniDocs/HedgeDoc.class.st @@ -31,7 +31,7 @@ HedgeDoc class >> newDefault [ HedgeDoc >> asLePage [ | newPage snippet | snippet := LeTextSnippet new - string: self body. + string: self bodyWithoutTitleHeader. newPage := LePage new initializeTitle: self title; addSnippet: snippet; @@ -57,6 +57,15 @@ HedgeDoc >> asMarkdownTiddler [ created: Tiddler nowLocal. ] +{ #category : #accessing } +HedgeDoc >> bodyWithoutTitleHeader [ + | headerIndex | + headerIndex := self body lines + detectIndex: [ :line | line includesSubstring: self headerAsTitle ] + ifNone: [ ^ self body]. + ^ (self body lines copyWithoutIndex: headerIndex) asStringWithCr +] + { #category : #accessing } HedgeDoc >> contents [ ^ super contents