Skip to content

Commit 407a7f6

Browse files
committed
fix(PDTable): support table with newlines to separate the block
1 parent 74f1df6 commit 407a7f6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/pd2norg.nim

+3-2
Original file line numberDiff line numberDiff line change
@@ -542,17 +542,18 @@ proc toStr*(self: PDBlockTable, indent: int = 0): string =
542542
var rowCount = 0
543543
defer:
544544
if captionString.len() > 0:
545-
result = ["|caption " & captionString, result.strip(), "|end"].join("\n")
545+
result = &"\n|caption {captionString}\n{result.strip()}\n|end\n\n"
546546
var accumulator = newSeq[string]()
547547
var headCounts = newSeq[int]()
548+
result.add("\n")
548549
result.add(tableShortColSpec(col))
549550
accumulator.add(fillTable(head[1], colCount, rowCount).map(bootstrapCell).join("\n"))
550551
rowCount += head[1].len()
551552
for tbody in body:
552553
accumulator.add(tbody.parseTableBody(colCount, rowCount))
553554
rowCount += tbody[2].len() + tbody[3].len()
554555
defer:
555-
result = result & "\n" & accumulator.join("\n+hline2\n")
556+
result = result & "\n" & accumulator.join("\n+hline2\n") & "\n\n"
556557

557558
proc toStr*(self: PDBlock, indent: int = 0): string =
558559
case self.t:

0 commit comments

Comments
 (0)