Copy of nested docs working thanks to botwhytho's LepiterBuiddingBlocs.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-10-25 06:50:15 -05:00
parent 6a3c0332b3
commit 92a686de96
2 changed files with 7 additions and 13 deletions

View File

@ -14,6 +14,7 @@ BaselineOfMiniDocs >> baseline: spec [
spec
baseline: 'Mustache' with: [ spec repository: 'github://noha/mustache' ];
baseline: 'Tealight' with: [ spec repository: 'github://astares/Tealight:main/src' ];
baseline: 'LepiterBuildingBlocs' with: [spec repository: 'github://botwhytho/LepiterBuildingBlocs:main/src'];
baseline: 'PetitParser' with: [
spec
loads: #('Minimal' 'Core' 'Tests' 'Islands');

View File

@ -2,19 +2,12 @@ Extension { #name : #LeDatabase }
{ #category : #'*MiniDocs' }
LeDatabase >> addPageCopy: aLePage [
| page |
page := LePage new.
page title: ('Copy of ', aLePage title,' (id: ', (page uid asString copyFrom: 1 to: 8), ')').
aLePage allChildrenDepthFirst do: [ :snippet | | newSnippet |
newSnippet := snippet class new.
newSnippet className = 'LeTextSnippet' ifTrue: [ newSnippet
string: snippet contentAsString ].
newSnippet className = 'LePharoSnippet' ifTrue: [ newSnippet code: snippet contentAsString ].
newSnippet uid: LeUID new.
page addSnippet: newSnippet.
newSnippet database: self.
self registerSnippet: newSnippet ].
self addPage: page.
| pageTitle timestamp shortID page |
timestamp := DateAndTime now asString.
pageTitle := 'Copy of ', aLePage title.
page := aLePage duplicatePageWithNewName: pageTitle, timestamp.
shortID := '(id: ', (page uid asString copyFrom: 1 to: 8), ')'.
page title: (page title copyReplaceAll: timestamp with: shortID).
^ page
]