Permalink
Browse files

use new docutils package

  • Loading branch information...
1 parent 690e66e commit 4c05ca33523a4cb3f965eab84a7753630af7bef9 @Araq Araq committed May 9, 2012
Showing with 19 additions and 18 deletions.
  1. +7 −3 forms.tmpl
  2. +11 −5 forum.nim
  3. +1 −10 nimrod.cfg
View
@@ -61,8 +61,8 @@
</td>
<td class="content">
#try:
- ${content.rstToHtml({roSupportSmilies})}
- #except ERecoverableError, EParseError:
+ ${content.rstToHtml}
+ #except EParseError:
# c.errorMsg = getCurrentExceptionMsg()
#end
</td>
@@ -102,7 +102,11 @@
#end if
</td>
<td class="content">
- ${(%postContent).rstToHtml({roSupportSmilies})}
+ #try:
+ ${(%postContent).rstToHtml}
+ #except EParseError:
+ # c.errorMsg = getCurrentExceptionMsg()
+ #end
</td>
</tr>
</table>
View
@@ -8,7 +8,7 @@
import
os, strutils, times, md5, strtabs, cgi, math, db_sqlite, matchers,
- rst, docgen, msgs, captchas, sockets, scgi, cookies
+ rst, rstgen, captchas, sockets, scgi, cookies
const
unselectedThread = -1
@@ -64,6 +64,7 @@ type
var
db: TDbConn
+ docConfig: PStringTable
proc init(c: var TForumData) =
c.userPass = ""
@@ -135,7 +136,6 @@ proc UrlButton(c: var TForumData, text: string,
c.genQuery(nextAction, target), text]
proc genButtons(c: var TForumData, btns: seq[TStyledButton]): string =
- result = ""
if btns.len == 1:
var anchor = ""
if btns[0].action == actionReplyForm:
@@ -144,6 +144,7 @@ proc genButtons(c: var TForumData, btns: seq[TStyledButton]): string =
result = ("""<a class="active button" href="$1$3">$2</a>""") % [
c.genQuery(btns[0].action, btns[0].tid), btns[0].text, anchor]
else:
+ result = ""
for i, btn in pairs(btns):
var anchor = ""
if btns[i].action == actionReplyForm:
@@ -311,11 +312,15 @@ proc isPreview(c: TForumData): bool =
proc isDelete(c: TForumData): bool =
result = c.cgiData["delete"].len > 0
+proc rstToHtml(content: string): string =
+ result = rstgen.rstToHtml(content, {roSupportSmilies, roSupportMarkdown},
+ docConfig)
+
proc validateRst(c: var TForumData, content: string): bool =
result = true
try:
- discard content.rstToHtml({roSupportSmilies})
- except ERecoverableError, EParseError:
+ discard rstToHtml(content)
+ except EParseError:
result = setError(c, "", getCurrentExceptionMsg())
proc crud(c: TCrud, table: string, data: openArray[string]): TSqlQuery =
@@ -687,7 +692,8 @@ when not defined(writeStatusContent):
c.send(content)
proc main() =
- docgen.setupConfig()
+ docConfig = rstgen.defaultConfig()
+
math.randomize()
db = Open(connection="nimforum.db", user="postgres", password="",
database="nimforum")
View
@@ -1,14 +1,5 @@
# we need the documentation generator of the compiler:
-
---path:"/home/nimrod/Nimrod"
---path:"/home/nimrod/Nimrod/compiler"
-
---path:"/home/dominik/code/outside/git/Nimrod"
---path:"/home/dominik/code/outside/git/Nimrod/compiler"
-
---path:"../nimrod"
---path:"../nimrod/compiler"
-
--path:"$nimrod/packages/docutils"
+--path:"$nimrod"

0 comments on commit 4c05ca3

Please sign in to comment.