added docgen.rst2html for the forum; fixed tester bug concerning removeDir

This commit is contained in:
Araq
2012-02-21 21:03:36 +01:00
parent 38eafd30ae
commit 96e7ee91cc
4 changed files with 63 additions and 3 deletions

View File

@@ -881,3 +881,57 @@ proc CommandRst2TeX =
splitter = "\\-"
CommandRstAux(gProjectFull, TexExt)
# ---------- forum ---------------------------------------------------------
proc setupConfig*() =
setConfigVar("split.item.toc", "20")
setConfigVar("doc.section", """
<div class="section" id="$sectionID">
<h1><a class="toc-backref" href="#$sectionTitleID">$sectionTitle</a></h1>
<dl class="item">
$content
</dl></div>
""")
setConfigVar("doc.section.toc", """
<li>
<a class="reference" href="#$sectionID" id="$sectionTitleID">$sectionTitle</a>
<ul class="simple">
$content
</ul>
</li>
""")
setConfigVar("doc.item", """
<dt id="$itemID"><pre>$header</pre></dt>
<dd>
$desc
</dd>
""")
setConfigVar("doc.item.toc", """
<li><a class="reference" href="#$itemID">$name</a></li>
""")
setConfigVar("doc.toc", """
<div class="navigation" id="navigation">
<ul class="simple">
$content
</ul>
</div>""")
setConfigVar("doc.body_toc", """
$tableofcontents
<div class="content" id="content">
$moduledesc
$content
</div>
""")
setConfigVar("doc.body_no_toc", "$moduledesc $content")
setConfigVar("doc.file", "$content")
proc rstToHtml*(s: string): string =
## exported for *nimforum*.
const filen = "input"
var d = newDocumentor(filen)
var dummyHasToc = false
var rst = rstParse(s, false, filen, 0, 1, dummyHasToc)
d.modDesc = renderRstToOut(d, rst)
let res = genOutFile(d)
result = res.ropeToStr

View File

@@ -1,5 +1,5 @@
# This is the config file for the documentation generator.
# (c) 2011 Andreas Rumpf
# (c) 2012 Andreas Rumpf
# Feel free to edit the templates as you need.
split.item.toc = "20"

View File

@@ -1,6 +1,6 @@
# This is the config file for the documentation generator that produces TeX
# output.
# (c) 2011 Andreas Rumpf
# (c) 2012 Andreas Rumpf
# Feel free to edit the templates as you need.
split.item.toc = "20"

View File

@@ -15,7 +15,13 @@
const
rodfilesDir = "tests/rodfiles"
proc delNimCache() = removeDir(rodfilesDir / "nimcache")
proc delNimCache() =
let dir = rodfilesDir / "nimcache"
try:
removeDir(dir)
except EOS:
echo "[Warning] could not delete: ", dir
proc plusCache(options: string): string = return options & " --symbolFiles:on"
proc runRodFiles(r: var TResults, options: string) =