diff trunk/src/docgen/document/generator.d @ 467:32f4c3cb6a41

Support for static content.
author Jari-Matti M?kel? <jmjm@iki.fi>
date Wed, 31 Oct 2007 16:03:11 +0200
parents db7e27b5c180
children e48a011e687a
line wrap: on
line diff
--- a/trunk/src/docgen/document/generator.d	Wed Oct 31 15:17:20 2007 +0200
+++ b/trunk/src/docgen/document/generator.d	Wed Oct 31 16:03:11 2007 +0200
@@ -12,7 +12,10 @@
 import docgen.config.configurator;
 import tango.io.stream.FileStream;
 import tango.io.FilePath;
+import tango.io.FileScan;
 debug import tango.io.Stdout;
+import tango.io.Stdout;
+
 
 alias void delegate(ref Module[], ref Edge[], ref Vertex[char[]]) ParserDg;
 
@@ -47,6 +50,9 @@
 
     // create output dir
     (new FilePath(options.outputDir ~ "/" ~ genDir)).create();
+
+    // copy static files
+    copyStaticContent();
   }
 
   DocGeneratorOptions *options() {
@@ -71,6 +77,18 @@
     return options.outputDir ~ "/" ~ genDir ~ "/" ~ file;
   }
 
+  void copyStaticContent() {
+    auto scan = new FileScan();
+    scan(templateDir~options.templates.templateStyle~"/"~formatDirs[docFormat]~"/static/");
+
+    foreach(filePath; scan.files) {
+      (new FilePath(outPath(filePath.file))).copy(filePath.toUtf8());
+    }
+
+    Stdout();
+    Stdout(scan.files.length)(" static files copied.\n");
+  }
+
   FileOutput outputFile(char[] fname) {
     return new FileOutput(outPath(fname));
   }