Improving splitting of admonition snippets.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-11-04 03:28:49 -05:00
parent 5ccff44fc9
commit babbd48934
3 changed files with 19 additions and 1 deletions

View File

@ -30,7 +30,7 @@ ByteString >> admonitionEndingPosition [
response > 0 ifTrue: [ response := response + 1 ].
(line trimBoth = ':::')
ifFalse: [ response := response + line size ]
ifTrue: [ response := response + line size. ]
ifTrue: [ ^ response := response + line size. ]
].
^ response
]
@ -75,5 +75,6 @@ ByteString >> markdownSplitted [
{ #category : #'*MiniDocs' }
ByteString >> startsWithMarkdownAdmonition [
self lines ifEmpty: [ ^ false ].
^ self admonitionBorders includes: self lines first trimBoth
]

View File

@ -42,6 +42,7 @@ HedgeDoc >> asLePage [
yourself
].
newPage incomingLinks.
newPage splitAdmonitionSnippets.
newPage options
at: 'originalMetadata' put: self metadata;
at: 'url' put: self url.

View File

@ -290,6 +290,22 @@ LePage >> sharedVariablesBindings [
^ shared asDictionary
]
{ #category : #'*MiniDocs' }
LePage >> splitAdmonitionSnippets [
"I'm used to clean after importing from HedgeDoc to ensure that a snippet contains only admonitions and extra content is put in a new cell."
(self children select: [:node | node string startsWithMarkdownAdmonition ])
do: [:node | | nodeContent |
node ifNotNil: [
nodeContent := node string.
nodeContent startsWithMarkdownAdmonition
ifTrue: [ | snippetCommand |
snippetCommand := node splitSnippetCommandAtPosition: nodeContent admonitionEndingPosition.
snippetCommand execute
]
]
]
]
{ #category : #'*MiniDocs' }
LePage >> storage [
| current |