summary refs log blame commit diff stats
path: root/tests/template/ttempl.nim
blob: 5f1341990ce1fdd65c81292a8cabf3ab754f259b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                             
                        

                  
                                                         

                                                                           
               


                                                 
# Test the new template file mechanism

import
  os, times

include "sunset.tmpl"

const
  tabs = [["home", "index"],
          ["news", "news"],
          ["documentation", "documentation"],
          ["download", "download"],
          ["FAQ", "question"],
          ["links", "links"]]


var i = 0
for item in items(tabs):
  var content = $i
  var file: TFile
  if open(file, changeFileExt(item[1], "html"), fmWrite):
    write(file, sunsetTemplate(current=item[1], ticker="", content=content,
                               tabs=tabs))
    close(file)
  else:
    write(stdout, "cannot open file for writing")
  inc(i)