Improving exportation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-07-22 19:24:56 -05:00
parent 882f33859c
commit 78f1b1474f
3 changed files with 30 additions and 3 deletions

View File

@ -1,5 +1,20 @@
Extension { #name : #LeTextCoderSnippetElement } Extension { #name : #LeTextCoderSnippetElement }
{ #category : #'*MiniDocs' }
LeTextCoderSnippetElement >> asLePage [
| currentSnippet newPage |
currentSnippet := self snippet.
newPage := LePage new.
newPage
title: (currentSnippet text asString trimLeft: [:char | char = $# ]) trim.
self page database
addPage: newPage.
currentSnippet allChildrenBreadthFirstDo: [:child |
child moveToPageTitled: newPage title.
].
^ newPage
]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LeTextCoderSnippetElement >> moveToPageTitled: pageName [ LeTextCoderSnippetElement >> moveToPageTitled: pageName [
| db origin destination | | db origin destination |

View File

@ -64,3 +64,15 @@ LeTextSnippet >> taggedWith: aString [
self metadata at: 'tags' ifPresent: [ (self metadata at: 'tags') add: aString; yourself ] ifAbsentPut: [ Set new ]. self metadata at: 'tags' ifPresent: [ (self metadata at: 'tags') add: aString; yourself ] ifAbsentPut: [ Set new ].
^ self metadata at: 'tags' ^ self metadata at: 'tags'
] ]
{ #category : #'*MiniDocs' }
LeTextSnippet >> withFollowingSnippets [
"I'm the same method implemented for PharoSnippets,
but present also here as a way to improve moving prose snippets from pages.
"
| snippets stop start |
snippets := self parent children asArray.
start := snippets indexOf: self.
stop := snippets size.
^ snippets copyFrom: start to: stop
]