view trunk/src/docgen/templates/htmlwriter.d @ 446:49f3afd6a0e8

Refactored writers.
author Jari-Matti M?kel? <jmjm@iki.fi>
date Wed, 17 Oct 2007 18:41:46 +0300
parents 0bda71dc9c4f
children c82b36b9cadf
line wrap: on
line source

/**
 * 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;

// TODO: this is mostly broken now

/**
 * 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.templates.title ~ ` Reference Manual</title>
      <meta name="AUTHOR" content="` ~ factory.options.templates.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.templates.title ~ ` Reference Manual</h1>
    <h2>` ~ factory.options.templates.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>`);
  }
}