some bugfixes

This commit is contained in:
Araq 2012-05-09 23:49:59 +02:00
commit ecbd49d2a0
2 changed files with 60 additions and 38 deletions

View file

@ -691,13 +691,10 @@ when not defined(writeStatusContent):
c.send("Status: " & status & "\r\L" & strHeaders & "\r\L") c.send("Status: " & status & "\r\L" & strHeaders & "\r\L")
c.send(content) c.send(content)
proc main() = proc mainLoop() =
docConfig = rstgen.defaultConfig() try:
math.randomize()
db = Open(connection="nimforum.db", user="postgres", password="", db = Open(connection="nimforum.db", user="postgres", password="",
database="nimforum") database="nimforum")
open(s, 9000.TPort) open(s, 9000.TPort)
while next(s): while next(s):
var r: TRequest var r: TRequest
@ -727,15 +724,20 @@ proc main() =
let (status, resp, headers) = processRequest(r) let (status, resp, headers) = processRequest(r)
s.client.writeStatusContent(status, resp, headers) s.client.writeStatusContent(status, resp, headers)
s.client.close() s.client.close()
finally:
close(s) close(s)
close(db) close(db)
proc mainWrapper() = proc main() =
docConfig = rstgen.defaultConfig()
math.randomize()
for i in 0..10: for i in 0..10:
try: try:
main() mainLoop()
except: except:
echo "FATAL: ", getCurrentExceptionMsg() echo "FATAL: ", getCurrentExceptionMsg()
os.sleep(1000)
mainWrapper() main()

20
rst.txt
View file

@ -10,6 +10,7 @@ See also the
or the `quick reference <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ or the `quick reference <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_
for further information. for further information.
Elements of **markdown** are also supported.
Inline elements Inline elements
@ -36,6 +37,10 @@ this::
`Nimrod <http://nimrod-code.org>`_ `Nimrod <http://nimrod-code.org>`_
Or like this::
`<http://nimrod-code.org>`_
Code blocks Code blocks
=========== ===========
@ -59,6 +64,21 @@ Is rendered as:
Except Nimrod, the programming languages C, C++, Java and C# have highlighting Except Nimrod, the programming languages C, C++, Java and C# have highlighting
support. support.
An alternative github-like syntax is also supported. This has the advantage
that no excessive indentation is needed::
```nimrod
if x == "abc":
echo "xyz"```
Is rendered as:
.. code-block:: nimrod
if x == "abc":
echo "xyz"
Literal blocks Literal blocks
============== ==============