summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-02-21 21:03:36 +0100
committerAraq <rumpf_a@web.de>2012-02-21 21:03:36 +0100
commit96e7ee91cced216e287b9dadb6eec97147347989 (patch)
tree954ff8793e349ead3c433a2d8b3629569a8189ba /compiler
parent38eafd30ae87463a2dc844d19b23c30ba2a8cd19 (diff)
downloadNim-96e7ee91cced216e287b9dadb6eec97147347989.tar.gz
added docgen.rst2html for the forum; fixed tester bug concerning removeDir
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/docgen.nim54
1 files changed, 54 insertions, 0 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
+
/pre>
f2f16f645 ^









f04b502cf ^

fc68a7d88 ^
f04b502cf ^



1b1bb284d ^
b77ae66e8 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44