summary refs log tree commit diff stats
path: root/tools/nimweb.nim
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2016-06-04 22:30:59 +0100
committerDominik Picheta <dominikpicheta@gmail.com>2016-06-04 22:30:59 +0100
commite0f6d0cd10e7bd174b9b8a2132a6bcdc9c19bd50 (patch)
tree3012ba42cfe5213108191f89f85e9d76ba83815d /tools/nimweb.nim
parente62b55054aff7e708416d075aade371233f39136 (diff)
downloadNim-e0f6d0cd10e7bd174b9b8a2132a6bcdc9c19bd50.tar.gz
Fixes website page titles.
Diffstat (limited to 'tools/nimweb.nim')
-rw-r--r--tools/nimweb.nim11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/nimweb.nim b/tools/nimweb.nim
index 8da58ff4d..82bb88e5f 100644
--- a/tools/nimweb.nim
+++ b/tools/nimweb.nim
@@ -436,7 +436,7 @@ proc buildSponsors(c: var TConfigData, sponsorsFile: string, outputDir: string)
   let outFile = outputDir / "sponsors.html"
   var f: File
   if open(f, outFile, fmWrite):
-    writeLine(f, generateHtmlPage(c, "Our Sponsors", sponsors, ""))
+    writeLine(f, generateHtmlPage(c, "", "Our Sponsors", sponsors, ""))
     close(f)
   else:
     quit("[Error] Cannot write file: " & outFile)
@@ -444,7 +444,7 @@ proc buildSponsors(c: var TConfigData, sponsorsFile: string, outputDir: string)
 const
   cmdRst2Html = "nim rst2html --compileonly $1 -o:web/$2.temp web/$2.rst"
 
-proc buildPage(c: var TConfigData, file, rss: string, assetDir = "") =
+proc buildPage(c: var TConfigData, file, title, rss: string, assetDir = "") =
   exec(cmdRst2Html % [c.nimArgs, file])
   var temp = "web" / changeFileExt(file, "temp")
   var content: string
@@ -457,7 +457,7 @@ proc buildPage(c: var TConfigData, file, rss: string, assetDir = "") =
   if not existsDir(outfile.splitFile.dir):
     createDir(outfile.splitFile.dir)
   if open(f, outfile, fmWrite):
-    writeLine(f, generateHTMLPage(c, file, content, rss, assetDir))
+    writeLine(f, generateHTMLPage(c, file, title, content, rss, assetDir))
     close(f)
   else:
     quit("[Error] cannot write file: " & outfile)
@@ -467,7 +467,8 @@ proc buildNews(c: var TConfigData, newsDir: string, outputDir: string) =
   for kind, path in walkDir(newsDir):
     let (dir, name, ext) = path.splitFile
     if ext == ".rst":
-      buildPage(c, tailDir(dir) / name, "", "../")
+      let title = readFile(path).splitLines()[0]
+      buildPage(c, tailDir(dir) / name, title, "", "../")
     else:
       echo("Skipping file in news directory: ", path)
 
@@ -482,7 +483,7 @@ proc buildWebsite(c: var TConfigData) =
     var file = c.tabs[i].val
     let rss = if file in ["news", "index"]: extractFilename(rssUrl) else: ""
     if '.' in file: continue
-    buildPage(c, file, rss)
+    buildPage(c, file, if file == "question": "FAQ" else: file, rss)
   copyDir("web/assets", "web/upload/assets")
   buildNewsRss(c, "web/upload")
   buildSponsors(c, sponsors, "web/upload")
1294871734fb5e7d41f464d75a3b'>^
e6dcceae6 ^
c5d7f6d2b ^
e6dcceae6 ^

19befb5c9 ^



e6dcceae6 ^
19befb5c9 ^
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