Fixing Markdown importation for simple cases.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-11-04 06:33:55 -05:00
parent babbd48934
commit d470dd533c
2 changed files with 24 additions and 11 deletions

View File

@ -33,9 +33,20 @@ HedgeDoc >> asLePage [
sanitizedMarkdown := self bodyWithoutTitleHeader promoteMarkdownHeaders. sanitizedMarkdown := self bodyWithoutTitleHeader promoteMarkdownHeaders.
newPage := LePage new newPage := LePage new
initializeTitle: self title. initializeTitle: self title.
sanitizedMarkdown markdownSplitted do: [:lines | | snippet | sanitizedMarkdown := sanitizedMarkdown markdownSplitted.
sanitizedMarkdown class = OrderedCollection ifTrue: [
sanitizedMarkdown do: [:lines | | snippet |
snippet := LeTextSnippet new
string: lines asStringWithCr;
uid: LeUID new.
newPage
addSnippet: snippet;
yourself
]
].
sanitizedMarkdown class = ByteString ifTrue: [ | snippet |
snippet := LeTextSnippet new snippet := LeTextSnippet new
string: lines asStringWithCr; string: sanitizedMarkdown;
uid: LeUID new. uid: LeUID new.
newPage newPage
addSnippet: snippet; addSnippet: snippet;
@ -159,7 +170,7 @@ HedgeDoc >> server: aUrlString [
{ #category : #accessing } { #category : #accessing }
HedgeDoc >> url [ HedgeDoc >> url [
^ url asUrl url ifNotNil: [ ^ url asUrl ]
] ]
{ #category : #accessing } { #category : #accessing }

View File

@ -293,17 +293,19 @@ LePage >> sharedVariablesBindings [
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LePage >> splitAdmonitionSnippets [ 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." "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 ]) | admonitionSnippets |
do: [:node | | nodeContent | admonitionSnippets := self children select: [:node | node string startsWithMarkdownAdmonition ].
node ifNotNil: [ admonitionSnippets ifEmpty: [ ^ self ].
nodeContent := node string. admonitionSnippets do: [:node | | nodeContent |
nodeContent startsWithMarkdownAdmonition node ifNotNil: [
ifTrue: [ | snippetCommand | nodeContent := node string.
nodeContent startsWithMarkdownAdmonition
ifTrue: [ | snippetCommand |
snippetCommand := node splitSnippetCommandAtPosition: nodeContent admonitionEndingPosition. snippetCommand := node splitSnippetCommandAtPosition: nodeContent admonitionEndingPosition.
snippetCommand execute snippetCommand execute
]
] ]
] ]
]
] ]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }