changeset 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 7f7b2232a9eb
files trunk/src/docgen/document/generator.d trunk/src/docgen/page/writer.d trunk/src/docgen/templates/default/html/pagetemplate.tpl trunk/src/docgen/templates/default/html/static/tab_b.gif trunk/src/docgen/templates/default/html/static/tab_l.gif trunk/src/docgen/templates/default/html/static/tab_r.gif trunk/src/docgen/templates/default/html/static/tabs.css trunk/src/docgen/templates/default/html/stylesheet.tpl
diffstat 8 files changed, 134 insertions(+), 1 deletions(-) [+]
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));
   }
--- a/trunk/src/docgen/page/writer.d	Wed Oct 31 15:17:20 2007 +0200
+++ b/trunk/src/docgen/page/writer.d	Wed Oct 31 16:03:11 2007 +0200
@@ -19,6 +19,8 @@
 
 const templateDir = "docgen/templates/";
 
+const formatDirs = [ "latex"[], "xml"[], "html"[], "plaintext"[] ];
+
 /**
  * Writes the logical subcomponents of a document,
  * e.g. sections, embedded graphics, lists
--- a/trunk/src/docgen/templates/default/html/pagetemplate.tpl	Wed Oct 31 15:17:20 2007 +0200
+++ b/trunk/src/docgen/templates/default/html/pagetemplate.tpl	Wed Oct 31 16:03:11 2007 +0200
@@ -7,6 +7,15 @@
   <link rel="stylesheet" href="{0}" media="all" title="default" />
 </head>
 <body>
+<div class="tabs">
+  <ul>
+    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
+    <li><a href="classes.html"><span>Classes</span></a></li>
+    <li><a href="modules.html"><span>Modules</span></a></li>
+    <li><a href="files.html"><span>Files</span></a></li>
+    <li><a href="depgraph.html"><span>Dependencies</span></a></li>
+  </ul>
+</div>
 <h1>{1}</h1>
 {2}
 <hr />
Binary file trunk/src/docgen/templates/default/html/static/tab_b.gif has changed
Binary file trunk/src/docgen/templates/default/html/static/tab_l.gif has changed
Binary file trunk/src/docgen/templates/default/html/static/tab_r.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/templates/default/html/static/tabs.css	Wed Oct 31 16:03:11 2007 +0200
@@ -0,0 +1,102 @@
+/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */
+
+DIV.tabs
+{
+   float            : left;
+   width            : 100%;
+   background       : url("tab_b.gif") repeat-x bottom;
+   margin-bottom    : 4px;
+}
+
+DIV.tabs UL
+{
+   margin           : 0px;
+   padding-left     : 10px;
+   list-style       : none;
+}
+
+DIV.tabs LI, DIV.tabs FORM
+{
+   display          : inline;
+   margin           : 0px;
+   padding          : 0px;
+}
+
+DIV.tabs FORM
+{
+   float            : right;
+}
+
+DIV.tabs A
+{
+   float            : left;
+   background       : url("tab_r.gif") no-repeat right top;
+   border-bottom    : 1px solid #84B0C7;
+   font-size        : x-small;
+   font-weight      : bold;
+   text-decoration  : none;
+}
+
+DIV.tabs A:hover
+{
+   background-position: 100% -150px;
+}
+
+DIV.tabs A:link, DIV.tabs A:visited,
+DIV.tabs A:active, DIV.tabs A:hover
+{
+       color: #1A419D;
+}
+
+DIV.tabs SPAN
+{
+   float            : left;
+   display          : block;
+   background       : url("tab_l.gif") no-repeat left top;
+   padding          : 5px 9px;
+   white-space      : nowrap;
+}
+
+DIV.tabs INPUT
+{
+   float            : right;
+   display          : inline;
+   font-size        : 1em;
+}
+
+DIV.tabs TD
+{
+   font-size        : x-small;
+   font-weight      : bold;
+   text-decoration  : none;
+}
+
+
+
+/* Commented Backslash Hack hides rule from IE5-Mac \*/
+DIV.tabs SPAN {float : none;}
+/* End IE5-Mac hack */
+
+DIV.tabs A:hover SPAN
+{
+   background-position: 0% -150px;
+}
+
+DIV.tabs LI.current A
+{
+   background-position: 100% -150px;
+   border-width     : 0px;
+}
+
+DIV.tabs LI.current SPAN
+{
+   background-position: 0% -150px;
+   padding-bottom   : 6px;
+}
+
+DIV.nav
+{
+   background       : none;
+   border           : none;
+   border-bottom    : 1px solid #84B0C7;
+}
--- a/trunk/src/docgen/templates/default/html/stylesheet.tpl	Wed Oct 31 15:17:20 2007 +0200
+++ b/trunk/src/docgen/templates/default/html/stylesheet.tpl	Wed Oct 31 16:03:11 2007 +0200
@@ -1,3 +1,5 @@
+@import "tabs.css";
+
 body {{
-background: #ccc;
+background: #fff;
 }