summary refs log tree commit diff stats
path: root/tools/nimweb.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-07-18 17:17:58 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-07-19 14:13:23 +0200
commitecae779956f5e31ec73c33f2e96da8ef61a6c05d (patch)
treeda47ea4292b12c7ecd9c59964961478ca2210cfd /tools/nimweb.nim
parent358f582939ed09ccb43ce9f00d4e14741606cb36 (diff)
downloadNim-ecae779956f5e31ec73c33f2e96da8ef61a6c05d.tar.gz
koch knows about json2
Diffstat (limited to 'tools/nimweb.nim')
-rw-r--r--tools/nimweb.nim20
1 files changed, 17 insertions, 3 deletions
diff --git a/tools/nimweb.nim b/tools/nimweb.nim
index 7cb4b5ab4..4cf7020c2 100644
--- a/tools/nimweb.nim
+++ b/tools/nimweb.nim
@@ -29,7 +29,7 @@ type
   TRssItem = object
     year, month, day, title, url, content: string
   TAction = enum
-    actAll, actOnlyWebsite, actPdf
+    actAll, actOnlyWebsite, actPdf, actJson2
 
   Sponsor = object
     logo: string
@@ -157,6 +157,7 @@ proc parseCmdLine(c: var TConfigData) =
         c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
       of "website": action = actOnlyWebsite
       of "pdf": action = actPdf
+      of "json2": action = actJson2
       of "googleanalytics":
         c.gaId = val
         c.nimArgs.add("--doc.googleAnalytics:" & val & " ")
@@ -379,7 +380,7 @@ proc genNewsLink(title: string): string =
   result = title
   result.insert("Z")
   for i in 1..len(result)-1:
-    let letter = result[i].toLower()
+    let letter = result[i].toLowerAscii()
     if letter in validAnchorCharacters:
       result[i] = letter
     else:
@@ -487,7 +488,6 @@ proc buildNews(c: var TConfigData, newsDir: string, outputDir: string) =
       echo("Skipping file in news directory: ", path)
 
 proc buildWebsite(c: var TConfigData) =
-
   if c.ticker.len > 0:
     try:
       c.ticker = readFile("web" / c.ticker)
@@ -512,6 +512,19 @@ proc main(c: var TConfigData) =
   buildDocSamples(c, "doc")
   buildDoc(c, "doc")
 
+proc json2(c: var TConfigData) =
+  const destPath = "web/json2"
+  var commands = newSeq[string](c.srcdoc2.len)
+  var i = 0
+  for d in items(c.srcdoc2):
+    createDir(destPath / splitFile(d).dir)
+    commands[i] = findNim() & " jsondoc2 $# --docSeeSrcUrl:$#/$#/$# -o:$# --index:on $#" %
+      [c.nimArgs, c.gitRepo, c.gitCommit, d.pathPart,
+      destPath / changeFileExt(d, "json"), d]
+    i.inc
+
+  mexec(commands, c.numProcessors)
+
 var c: TConfigData
 initConfigData(c)
 parseCmdLine(c)
@@ -520,3 +533,4 @@ case action
 of actOnlyWebsite: buildWebsite(c)
 of actPdf: buildPdfDoc(c, "doc")
 of actAll: main(c)
+of actJson2: json2(c)