changeset 444:0bda71dc9c4f

More document template and source listing code.
author Jari-Matti M?kel? <jmjm@iki.fi>
date Wed, 17 Oct 2007 03:12:46 +0300
parents 87c36c5ed434
children 294353fe2514 49f3afd6a0e8
files trunk/src/docgen/docgen.d trunk/src/docgen/graphutils/dotwriter.d trunk/src/docgen/graphutils/modulenamewriter.d trunk/src/docgen/graphutils/modulepathwriter.d trunk/src/docgen/graphutils/writers.d trunk/src/docgen/misc/misc.d trunk/src/docgen/modulegraph/writer.d trunk/src/docgen/sourcelisting/htmlwriter.d trunk/src/docgen/sourcelisting/latexwriter.d trunk/src/docgen/sourcelisting/plaintextwriter.d trunk/src/docgen/sourcelisting/writer.d trunk/src/docgen/sourcelisting/writers.d trunk/src/docgen/sourcelisting/xmlwriter.d trunk/src/docgen/templates/htmlwriter.d trunk/src/docgen/templates/latexwriter.d trunk/src/docgen/templates/plaintextwriter.d trunk/src/docgen/templates/writer.d trunk/src/docgen/templates/writers.d trunk/src/docgen/templates/xmlwriter.d trunk/src/docgen/tests/doctemplate.d trunk/src/docgen/testsuite.d
diffstat 21 files changed, 472 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/docgen/docgen.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/docgen.d	Wed Oct 17 03:12:46 2007 +0300
@@ -5,10 +5,14 @@
 module docgen.docgen;
 
 import docgen.modulegraph.writer;
+import docgen.sourcelisting.writer;
+import docgen.templates.writer;
+import docgen.graphutils.writer;
 
 struct DocGeneratorOptions {
-  GraphWriterOptions graph;
-  ListingsOptions listings;
+  GraphOptions graph;
+  ListingOptions listings;
+  TemplateOptions templates;
   CommentFormat commentFormat;
 }
 
--- a/trunk/src/docgen/graphutils/dotwriter.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/graphutils/dotwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -5,7 +5,6 @@
 module docgen.graphutils.dotwriter;
 import docgen.graphutils.writer;
 
-import tango.io.protocol.Writer : Writer;
 import tango.io.FileConduit : FileConduit;
 import tango.io.Print: Print;
 import tango.text.convert.Layout : Layout;
--- a/trunk/src/docgen/graphutils/modulenamewriter.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/graphutils/modulenamewriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -5,7 +5,6 @@
 module docgen.graphutils.modulenamewriter;
 import docgen.graphutils.writer;
 
-import tango.io.protocol.Writer : Writer;
 import tango.io.FileConduit : FileConduit;
 import tango.io.Print: Print;
 import tango.text.convert.Layout : Layout;
@@ -21,7 +20,7 @@
   }
 
   void generateGraph(Vertex[] vertices, Edge[] edges) {
-    auto output = new Writer(outputs[0]);
+    auto output = new Print!(char)(new Layout!(char), outputs[0]);
 
     void doList(Vertex[] v, uint level, char[] indent = "") {
       if (!level) return;
--- a/trunk/src/docgen/graphutils/modulepathwriter.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/graphutils/modulepathwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -5,7 +5,6 @@
 module docgen.graphutils.modulepathwriter;
 import docgen.graphutils.writer;
 
-import tango.io.protocol.Writer : Writer;
 import tango.io.FileConduit : FileConduit;
 import tango.io.Print: Print;
 import tango.text.convert.Layout : Layout;
@@ -20,7 +19,7 @@
   }
 
   void generateGraph(Vertex[] vertices, Edge[] edges) {
-    auto output = new Writer(outputs[0]);
+    auto output = new Print!(char)(new Layout!(char), outputs[0]);
 
     void doPaths(Vertex[] v, uint level, char[] indent = "") {
       if (!level) return;
--- a/trunk/src/docgen/graphutils/writers.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/graphutils/writers.d	Wed Oct 17 03:12:46 2007 +0300
@@ -22,6 +22,8 @@
         return &((new ModuleNameWriter(this, outputs)).generateGraph);
       case GraphFormat.ModulePaths:
         return &((new ModulePathWriter(this, outputs)).generateGraph);
+      default:
+        throw new Exception("Graph writer type does not exist!");
     }
   }
 }
\ No newline at end of file
--- a/trunk/src/docgen/misc/misc.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/misc/misc.d	Wed Oct 17 03:12:46 2007 +0300
@@ -4,6 +4,8 @@
  */
 module docgen.misc.misc;
 
+char[] docgen_version = "Dil document generator 0.1";
+
 enum DocFormat {
   LaTeX,
   XML,
--- a/trunk/src/docgen/modulegraph/writer.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/modulegraph/writer.d	Wed Oct 17 03:12:46 2007 +0300
@@ -29,11 +29,12 @@
 
     Edge[] edges;
     Vertex[] vertices;
-
+    /*
     loadModules(null, null, null,
       gwf.options.IncludeUnlocatableModules,
       vertices, edges);
 
     writer(vertices, edges);
+    */
   }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/sourcelisting/htmlwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,26 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.sourcelisting.htmlwriter;
+
+public import docgen.sourcelisting.writer;
+import dil.Parser;
+import tango.io.protocol.Writer : Writer;
+import tango.io.FileConduit : FileConduit;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+
+/**
+ * TODO
+ */
+class HTMLWriter : AbstractListingWriter {
+  this(ListingWriterFactory factory, OutputStream[] outputs) {
+    super(factory, outputs);
+    assert(outputs.length == 2, "Wrong number of outputs");
+  }
+
+  void generateListing(Parser parser) { /* TODO */ }
+  void generateListing(InputStream input) { /* TODO */ }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/sourcelisting/latexwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,42 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.sourcelisting.latexwriter;
+
+public import docgen.sourcelisting.writer;
+import dil.Parser;
+import tango.io.protocol.Writer : Writer;
+import tango.io.FileConduit : FileConduit;
+import tango.io.Buffer : Buffer;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+/**
+ * Adds a code listing section for the given file. 
+ */
+class LaTeXWriter : AbstractListingWriter {
+  this(ListingWriterFactory factory, OutputStream[] outputs) {
+    super(factory, outputs);
+    assert(outputs.length == 2, "Wrong number of outputs");
+  }
+
+  void generateListing(Parser parser) {
+    auto output2 = new Print!(char)(new Layout!(char), outputs[0]);
+    auto output = new Print!(char)(new Layout!(char), outputs[1]);
+    /* TODO */
+  }
+  
+  void generateListing(InputStream input) {
+    auto output2 = new Print!(char)(new Layout!(char), outputs[0]);
+
+    if (cast(FileConduit)outputs[1]) {
+      char[] fn = (cast(FileConduit)outputs[1]).toUtf8();
+      output2.format("\\lstinputlisting[language=d]{{{0}}", fn);
+    }
+    
+    auto buf = new Buffer(256);
+    buf.output = outputs[1];
+    buf.copy(input);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/sourcelisting/plaintextwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,25 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.sourcelisting.plaintextwriter;
+
+public import docgen.sourcelisting.writer;
+import dil.Parser;
+import tango.io.protocol.Writer : Writer;
+import tango.io.FileConduit : FileConduit;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+/**
+ * TODO
+ */
+class PlainTextWriter : AbstractListingWriter {
+  this(ListingWriterFactory factory, OutputStream[] outputs) {
+    super(factory, outputs);
+    assert(outputs.length == 2, "Wrong number of outputs");
+  }
+
+  void generateListing(Parser parser) { /* TODO */ }
+  void generateListing(InputStream input) { /* TODO */ }
+}
\ No newline at end of file
--- a/trunk/src/docgen/sourcelisting/writer.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/sourcelisting/writer.d	Wed Oct 17 03:12:46 2007 +0300
@@ -10,6 +10,7 @@
 
 struct ListingOptions {
   DocFormat docFormat;
+  bool enableListings;
 }
 
 interface ListingWriter {
--- a/trunk/src/docgen/sourcelisting/writers.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/sourcelisting/writers.d	Wed Oct 17 03:12:46 2007 +0300
@@ -5,7 +5,10 @@
 module docgen.sourcelisting.writers;
 
 public import docgen.sourcelisting.writer;
-import dil.Parser;
+import docgen.sourcelisting.latexwriter;
+import docgen.sourcelisting.htmlwriter;
+import docgen.sourcelisting.xmlwriter;
+import docgen.sourcelisting.plaintextwriter;
 
 class DefaultListingWriterFactory : AbstractListingWriterFactory {
   this(ListingOptions options) {
@@ -22,62 +25,8 @@
         return new HTMLWriter(this, outputs);
       case DocFormat.PlainText:
         return new PlainTextWriter(this, outputs);
+      default:
+        throw new Exception("Listing writer type does not exist!");
     }
   }
-}
-
-
-/**
- * TODO
- */
-class LaTeXWriter : AbstractListingWriter {
-  this(ListingWriterFactory factory, OutputStream[] outputs) {
-    super(factory, outputs);
-    assert(outputs.length == 2, "Wrong number of outputs");
-  }
-
-  void generateListing(Parser parser) { /* TODO */ }
-  void generateListing(InputStream input) { /* TODO */ }
-}
-
-
-/**
- * TODO
- */
-class XMLWriter : AbstractListingWriter {
-  this(ListingWriterFactory factory, OutputStream[] outputs) {
-    super(factory, outputs);
-    assert(outputs.length == 2, "Wrong number of outputs");
-  }
-
-  void generateListing(Parser parser) { /* TODO */ }
-  void generateListing(InputStream input) { /* TODO */ }
-}
-
-
-/**
- * TODO: add support for html/xml/latex?
- */
-class HTMLWriter : AbstractListingWriter {
-  this(ListingWriterFactory factory, OutputStream[] outputs) {
-    super(factory, outputs);
-    assert(outputs.length == 2, "Wrong number of outputs");
-  }
-
-  void generateListing(Parser parser) { /* TODO */ }
-  void generateListing(InputStream input) { /* TODO */ }
-}
-
-
-/**
- * TODO
- */
-class PlainTextWriter : AbstractListingWriter {
-  this(ListingWriterFactory factory, OutputStream[] outputs) {
-    super(factory, outputs);
-    assert(outputs.length == 2, "Wrong number of outputs");
-  }
-
-  void generateListing(Parser parser) { /* TODO */ }
-  void generateListing(InputStream input) { /* TODO */ }
 }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/sourcelisting/xmlwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,25 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.sourcelisting.xmlwriter;
+
+public import docgen.sourcelisting.writer;
+import dil.Parser;
+import tango.io.protocol.Writer : Writer;
+import tango.io.FileConduit : FileConduit;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+/**
+ * TODO
+ */
+class XMLWriter : AbstractListingWriter {
+  this(ListingWriterFactory factory, OutputStream[] outputs) {
+    super(factory, outputs);
+    assert(outputs.length == 2, "Wrong number of outputs");
+  }
+
+  void generateListing(Parser parser) { /* TODO */ }
+  void generateListing(InputStream input) { /* TODO */ }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/templates/htmlwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,50 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.templates.htmlwriter;
+
+import docgen.templates.writer;
+import tango.io.FileConduit : FileConduit;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+/**
+ * Writes a HTML document skeleton.
+ */
+class HTMLWriter : AbstractTemplateWriter {
+  this(TemplateWriterFactory factory, OutputStream[] outputs) {
+    super(factory, outputs);
+    assert(outputs.length == 1, "Wrong number of outputs");
+  }
+
+  void generateTemplate() {
+    auto output = new Print!(char)(new Layout!(char), outputs[0]);
+    
+    output(`
+    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+    <html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+      <title>` ~ factory.options.title ~ ` Reference Manual</title>
+      <meta name="AUTHOR" content="` ~ factory.options.copyright ~ `" />
+      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+      <link rel="stylesheet" href="style.css" media="all" title="default" />
+      <link rel="stylesheet" href="print.css" media="print" />
+    </head>
+    <body>
+    <h1>` ~ factory.options.title ~ ` Reference Manual</h1>
+    <h2>` ~ factory.options.versionString ~ `</h2>
+    <h2>Generated by ` ~ docgen_version ~ `</h2>
+    <h3>` ~ timeNow() ~ `</h3>
+    <hr />
+    <h2>Table of Contents</h2>
+    <hr />
+    <h2>Module documentation</h2>
+    <hr />
+    <h2>File listings</h2>
+    <hr />
+    <h2>Dependency diagram</h2>
+    </body>
+    </html>`);
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/templates/latexwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,95 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.templates.latexwriter;
+
+import docgen.templates.writer;
+import tango.io.FileConduit : FileConduit;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+/**
+ * Writes a LaTeX document skeleton.
+ */
+class LaTeXWriter : AbstractTemplateWriter {
+  this(TemplateWriterFactory factory, OutputStream[] outputs) {
+    super(factory, outputs);
+    assert(outputs.length == 1, "Wrong number of outputs");
+  }
+
+  void generateTemplate() {
+    auto output = new Print!(char)(new Layout!(char), outputs[0]);
+    
+    output(`
+    \documentclass[` ~ factory.options.paperSize ~ `]{book}
+    \usepackage{a4wide}
+    \usepackage{makeidx}
+    \usepackage{fancyhdr}
+    \usepackage{graphicx}
+    \usepackage{multicol}
+    \usepackage{float}
+    \usepackage{textcomp}
+    \usepackage{alltt}
+    \usepackage[utf8]{inputenc}
+    \usepackage{listings}
+    \lstnewenvironment{dcode}
+    { \lstset{language=d} }
+    {}
+    \lstset{` ~
+      (factory.options.literateStyle ? ` 
+      literate=
+               {<=}{{$\leq$}}1
+               {>=}{{$\geq$}}1
+               {!=}{{$\neq$}}1
+               {...}{{$\dots$}}1
+               {~}{{$\sim$}}1,` : ``) ~ `
+      stringstyle=\ttfamily,
+      inputencoding=utf8,
+      extendedchars=false,
+      columns=fixed,
+      basicstyle=\small
+    }
+    \makeindex
+    \setcounter{tocdepth}{1}
+    \newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}}
+    \def\thechapter{\Roman{chapter}}
+    % \renewcommand{\footrulewidth}{0.4pt}
+
+    \begin{document}
+
+    \begin{titlepage}
+    \vspace*{7cm}
+    \begin{center}
+    {\Large ` ~ factory.options.title ~ ` Reference Manual\\[1ex]\large ` ~
+        factory.options.versionString ~ ` }\\
+    \vspace*{1cm}
+    {\large Generated by ` ~ docgen_version ~ `}\\
+    \vspace*{0.5cm}
+    {\small ` ~ timeNow() ~ `}\\
+    \end{center}
+    \end{titlepage}
+
+    \clearemptydoublepage
+
+    \tableofcontents
+    \thispagestyle{empty}
+
+    \clearemptydoublepage
+
+    \setcounter{page}{1}
+    \chapter{Module documentation}
+    \input{modules}
+
+    \chapter{File listings}
+    \input{files}
+
+    \chapter{Dependency diagram}
+    \input{dependencies}
+
+    \printindex
+
+    \end{document}
+    `);
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/templates/plaintextwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,46 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.templates.plaintextwriter;
+
+import docgen.templates.writer;
+import tango.io.FileConduit : FileConduit;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+
+/**
+ * Writes a plain text document skeleton.
+ */
+class PlainTextWriter : AbstractTemplateWriter {
+  this(TemplateWriterFactory factory, OutputStream[] outputs) {
+    super(factory, outputs);
+    assert(outputs.length == 1, "Wrong number of outputs");
+  }
+
+  void generateTemplate() {
+    auto output = new Print!(char)(new Layout!(char), outputs[0]);
+    
+    char[] line, line2;
+    line.length = line2.length = 80;
+    line[] = "=";
+    line2[] = "-";
+    
+    char[] h(char[] s) {
+      return s ~ \n ~ line[0..s.length] ~ \n;
+    }
+    
+    output(
+      h(factory.options.title ~ " Reference Manual") ~ \n ~
+      factory.options.versionString ~ \n ~
+      "Generated by " ~ docgen_version ~ \n ~
+      timeNow() ~ \n \n \n ~
+      line2 ~ \n \n \n ~
+      h("Table of Contents") ~ \n \n ~
+      h("Module documentation") ~ \n \n ~
+      h("File listings") ~ \n \n ~
+      h("Dependency diagram") ~ \n \n
+    );
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/templates/writer.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,58 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.templates.writer;
+
+public import docgen.misc.misc;
+import tango.io.model.IConduit : OutputStream, InputStream;
+import tango.util.time.Date;
+import tango.util.time.Clock;
+import tango.text.convert.Sprint;
+
+struct TemplateOptions {
+  DocFormat docFormat;
+  char[] title = "Test project";
+  char[] versionString = "1.0";
+  char[] copyright;
+  char[] paperSize = "a4paper";
+  bool literateStyle = true;
+}
+
+interface TemplateWriter {
+  void generateTemplate();
+}
+
+abstract class AbstractTemplateWriter : TemplateWriter {
+  protected TemplateWriterFactory factory;
+  protected OutputStream[] outputs;
+
+  this(TemplateWriterFactory factory, OutputStream[] outputs) {
+    this.factory = factory;
+    this.outputs = outputs;
+  }
+  
+  protected static char[] timeNow() {
+    auto date = Clock.toDate;
+    auto sprint = new Sprint!(char);
+    return sprint.format("{0} {1} {2} {3}",
+      date.asDay(),
+      date.asMonth(),
+      date.day,
+      date.year).dup;
+  }
+}
+
+interface TemplateWriterFactory {
+  TemplateOptions *options();
+  TemplateWriter createTemplateWriter(OutputStream[] outputs);
+}
+
+abstract class AbstractTemplateWriterFactory : TemplateWriterFactory {
+  protected TemplateOptions m_options;
+
+  public TemplateOptions *options() {
+    return &m_options;
+  }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/templates/writers.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,32 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.templates.writers;
+
+public import docgen.templates.writer;
+import docgen.templates.htmlwriter;
+import docgen.templates.xmlwriter;
+import docgen.templates.plaintextwriter;
+import docgen.templates.latexwriter;
+
+class DefaultTemplateWriterFactory : AbstractTemplateWriterFactory {
+  this(TemplateOptions options) {
+    m_options = options;
+  }
+
+  TemplateWriter createTemplateWriter(OutputStream[] outputs) {
+    switch (m_options.docFormat) {
+      case DocFormat.LaTeX:
+        return new LaTeXWriter(this, outputs);
+      case DocFormat.XML:
+        return new XMLWriter(this, outputs);
+      case DocFormat.HTML:
+        return new HTMLWriter(this, outputs);
+      case DocFormat.PlainText:
+        return new PlainTextWriter(this, outputs);
+      default:
+        throw new Exception("Template writer type does not exist!");
+    }
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/templates/xmlwriter.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,22 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.templates.xmlwriter;
+
+import docgen.templates.writer;
+import tango.io.FileConduit : FileConduit;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+/**
+ * TODO
+ */
+class XMLWriter : AbstractTemplateWriter {
+  this(TemplateWriterFactory factory, OutputStream[] outputs) {
+    super(factory, outputs);
+    assert(outputs.length == 1, "Wrong number of outputs");
+  }
+
+  void generateTemplate() { /* TODO */ }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/tests/doctemplate.d	Wed Oct 17 03:12:46 2007 +0300
@@ -0,0 +1,27 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.tests.doctemplate;
+
+import docgen.templates.writers;
+import tango.io.Stdout;
+import tango.io.FileConduit;
+import tango.io.protocol.Writer : Writer;
+
+
+// doc template
+//@unittest
+void doctemplate1() {
+  TemplateOptions test;
+  test.docFormat = DocFormat.LaTeX;
+  auto fname = "doctemplate.tex";
+  
+  auto gwf = new DefaultTemplateWriterFactory(test);
+  auto file = new FileConduit("docgen/teststuff/" ~ fname, FileConduit.WriteCreate);
+  auto writer = gwf.createTemplateWriter( [ file ] );
+  
+  writer.generateTemplate();
+  
+  file.close();
+}
\ No newline at end of file
--- a/trunk/src/docgen/testsuite.d	Tue Oct 16 22:20:37 2007 +0200
+++ b/trunk/src/docgen/testsuite.d	Wed Oct 17 03:12:46 2007 +0300
@@ -6,6 +6,7 @@
 
 import docgen.tests.graphs;
 import docgen.tests.parse;
+import docgen.tests.doctemplate;
 import tango.io.Stdout;
 
 /**
@@ -21,5 +22,7 @@
   graph4();
   parse1();
   parse2();
+  doctemplate1();
+  
   Stdout("done.\n");
 }