Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with --gc:arc #41

Merged
merged 1 commit into from
Dec 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/markdown.nim
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
##

import re
from sequtils import map, keepIf
from sequtils import map, keepIf, anyIt
from sugar import `->`, `=>`
from strformat import fmt, `&`
from uri import encodeUrl
Expand Down Expand Up @@ -735,12 +735,11 @@ method parse*(this: UlParser, doc: string, start: int): ParseResult =
if itemSize == -1:
break

var listItem = Li(
listItems.add Li(
doc: listItemDoc.strip(chars={'\n'}),
verbatim: listItemDoc,
marker: marker
)
listItems.add(listItem)

pos += itemSize

Expand Down Expand Up @@ -775,12 +774,11 @@ method parse*(this: OlParser, doc: string, start: int): ParseResult =
startIndex = index
found = true

var listItem = Li(
listItems.add Li(
doc: listItemDoc.strip(chars={'\n'}),
verbatim: listItemDoc,
marker: marker
)
listItems.add(listItem)

pos += itemSize

Expand Down Expand Up @@ -1491,11 +1489,12 @@ method parse*(this: ParagraphParser, doc: string, start: int): ParseResult =
p &= line

size = p.len
let trailing = doc[start ..< start+size].findAll(re"\n*$")
return ParseResult(
token: Paragraph(
doc: doc[start ..< start+size].replace(re"\n\s*", "\n").strip,
loose: true,
trailing: doc[start ..< start+size].findAll(re"\n*$").join(""),
trailing: if trailing.anyIt(it.len > 0): trailing.join() else: trailing[0]
),
pos: start+size
)
Expand Down