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,13 +33,24 @@ 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 snippet := LeTextSnippet new
string: lines asStringWithCr; string: lines asStringWithCr;
uid: LeUID new. uid: LeUID new.
newPage newPage
addSnippet: snippet; addSnippet: snippet;
yourself yourself
]
].
sanitizedMarkdown class = ByteString ifTrue: [ | snippet |
snippet := LeTextSnippet new
string: sanitizedMarkdown;
uid: LeUID new.
newPage
addSnippet: snippet;
yourself
]. ].
newPage incomingLinks. newPage incomingLinks.
newPage splitAdmonitionSnippets. newPage splitAdmonitionSnippets.
@ -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,8 +293,10 @@ 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 ].
admonitionSnippets ifEmpty: [ ^ self ].
admonitionSnippets do: [:node | | nodeContent |
node ifNotNil: [ node ifNotNil: [
nodeContent := node string. nodeContent := node string.
nodeContent startsWithMarkdownAdmonition nodeContent startsWithMarkdownAdmonition