diff options
author | Araq <rumpf_a@web.de> | 2012-02-21 21:03:36 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-02-21 21:03:36 +0100 |
commit | 96e7ee91cced216e287b9dadb6eec97147347989 (patch) | |
tree | 954ff8793e349ead3c433a2d8b3629569a8189ba | |
parent | 38eafd30ae87463a2dc844d19b23c30ba2a8cd19 (diff) | |
download | Nim-96e7ee91cced216e287b9dadb6eec97147347989.tar.gz |
added docgen.rst2html for the forum; fixed tester bug concerning removeDir
-rwxr-xr-x | compiler/docgen.nim | 54 | ||||
-rwxr-xr-x | config/nimdoc.cfg | 2 | ||||
-rwxr-xr-x | config/nimdoc.tex.cfg | 2 | ||||
-rw-r--r-- | tests/specials.nim | 8 |
4 files changed, 63 insertions, 3 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 65cd8fdd4..14a8b35c2 100755 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -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 + diff --git a/config/nimdoc.cfg b/config/nimdoc.cfg index d9a5b1ae2..d47dccb63 100755 --- a/config/nimdoc.cfg +++ b/config/nimdoc.cfg @@ -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" diff --git a/config/nimdoc.tex.cfg b/config/nimdoc.tex.cfg index ecb95fe01..8b59f2ee9 100755 --- a/config/nimdoc.tex.cfg +++ b/config/nimdoc.tex.cfg @@ -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" diff --git a/tests/specials.nim b/tests/specials.nim index d10452b98..05eda6061 100644 --- a/tests/specials.nim +++ b/tests/specials.nim @@ -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) = |