From 2bcf67a132b2a478aa8c401f1eaff225ca233cc3 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 29 Jan 2023 14:21:29 -0500 Subject: [PATCH] Converting snippet subrees to Lepiter pages. --- src/MiniDocs/LeSnippet.extension.st | 4 ++-- src/MiniDocs/LeTextCoderSnippetElement.extension.st | 2 +- src/MiniDocs/LeTextSnippet.extension.st | 12 ++++++++++++ src/MiniDocs/MiniDocs.class.st | 2 +- src/MiniDocs/NanoID.class.st | 2 +- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/MiniDocs/LeSnippet.extension.st b/src/MiniDocs/LeSnippet.extension.st index 3c69862..2914947 100644 --- a/src/MiniDocs/LeSnippet.extension.st +++ b/src/MiniDocs/LeSnippet.extension.st @@ -12,9 +12,9 @@ LeSnippet class >> fromMetaMarkdeep: div [ ] { #category : #'*MiniDocs' } -LeSnippet >> moveTo: pageName [ +LeSnippet >> moveToPageTitled: pageName [ | db origin destination thisSnippet | - thisSnippet := self snippetModel. + thisSnippet := self. db := self page database. destination := db pageNamed: pageName. origin := db pageNamed: thisSnippet page title. diff --git a/src/MiniDocs/LeTextCoderSnippetElement.extension.st b/src/MiniDocs/LeTextCoderSnippetElement.extension.st index aebc06a..f0739d8 100644 --- a/src/MiniDocs/LeTextCoderSnippetElement.extension.st +++ b/src/MiniDocs/LeTextCoderSnippetElement.extension.st @@ -1,7 +1,7 @@ Extension { #name : #LeTextCoderSnippetElement } { #category : #'*MiniDocs' } -LeTextCoderSnippetElement >> moveTo: pageName [ +LeTextCoderSnippetElement >> moveToPageTitled: pageName [ | db origin destination | db := self page database. destination := db pageNamed: pageName. diff --git a/src/MiniDocs/LeTextSnippet.extension.st b/src/MiniDocs/LeTextSnippet.extension.st index 589ed25..943713c 100644 --- a/src/MiniDocs/LeTextSnippet.extension.st +++ b/src/MiniDocs/LeTextSnippet.extension.st @@ -1,5 +1,17 @@ Extension { #name : #LeTextSnippet } +{ #category : #'*MiniDocs' } +LeTextSnippet >> asLePage [ + | page | + page := LePage new + initializeTitle: self contentAsString. + self database addPage: page. + self childrenDo: [:child | + child moveToPageTitled: page title + ]. + ^ page. +] + { #category : #'*MiniDocs' } LeTextSnippet >> contentFrom: markdeepDiv [ diff --git a/src/MiniDocs/MiniDocs.class.st b/src/MiniDocs/MiniDocs.class.st index e92adf4..b695e69 100644 --- a/src/MiniDocs/MiniDocs.class.st +++ b/src/MiniDocs/MiniDocs.class.st @@ -65,7 +65,7 @@ MiniDocs class >> installYamlToJson [ command: 'nim'; arguments: {'c'. self yamlToJsonSourceCode fullName}; runAndWaitOnExitDo: [ :process :outString | - (self yamlToJsonSourceCode parent / self yamlToJsonSourceCode basenameWithoutExtension) moveTo: MiniDocs appFolder asFileReference. + (self yamlToJsonSourceCode parent / self yamlToJsonSourceCode basenameWithoutExtension) moveToPageTitled: MiniDocs appFolder asFileReference. ^ MiniDocs appFolder ] ] diff --git a/src/MiniDocs/NanoID.class.st b/src/MiniDocs/NanoID.class.st index 4740b2f..525af1c 100644 --- a/src/MiniDocs/NanoID.class.st +++ b/src/MiniDocs/NanoID.class.st @@ -43,7 +43,7 @@ NanoID class >> install [ command: 'nim'; arguments: {'c'. self scriptSourceCode fullName}; runAndWaitOnExitDo: [ :process :outString | - (self scriptSourceCode parent / (self scriptSourceCode) basenameWithoutExtension) moveTo: MiniDocs appFolder asFileReference. + (self scriptSourceCode parent / (self scriptSourceCode) basenameWithoutExtension) moveToPageTitled: MiniDocs appFolder asFileReference. ^ MiniDocs appFolder ] ]