Skip to content

Commit 26a3bb9

Browse files
committed
Don't give up on rendering full post if the rst rendering fails.
1 parent d0ecdf1 commit 26a3bb9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

nimforum.nimble

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ skipExt = @["nim"]
1313
# Dependencies
1414

1515
requires "nim >= 1.0.6"
16+
requires "httpbeast >= 0.4.0"
1617
requires "jester#405be2e"
1718
requires "bcrypt#440c5676ff6"
1819
requires "hmac#9c61ebe2fd134cf97"

src/forum.nim

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,12 @@ proc selectUser(userRow: seq[string], avatarSize: int=80): User =
303303
proc selectPost(postRow: seq[string], skippedPosts: seq[int],
304304
replyingTo: Option[PostLink], history: seq[PostInfo],
305305
likes: seq[User]): Post =
306+
let content =
307+
try:
308+
postRow[1].rstToHtml()
309+
except EParseError:
310+
span(class="text-error", "Couldn't render post #$1." % postRow[0])
311+
306312
return Post(
307313
id: postRow[0].parseInt,
308314
replyingTo: replyingTo,
@@ -312,7 +318,7 @@ proc selectPost(postRow: seq[string], skippedPosts: seq[int],
312318
history: history,
313319
info: PostInfo(
314320
creation: postRow[2].parseInt,
315-
content: postRow[1].rstToHtml()
321+
content: content
316322
),
317323
moreBefore: skippedPosts
318324
)

0 commit comments

Comments
 (0)