view trunk/src/docgen/page/htmlwriter.d @ 457:33a4cb255fcc

Cached images, small fixes, reorganizing.
author Jari-Matti M?kel? <jmjm@iki.fi>
date Tue, 30 Oct 2007 15:41:30 +0200
parents
children db7e27b5c180
line wrap: on
line source

/**
 * Author: Jari-Matti Mäkelä
 * License: GPL3
 */
module docgen.page.htmlwriter;

import docgen.page.writer;
import docgen.misc.textutils;
import tango.io.FileConduit : FileConduit;

// TODO: this is mostly broken now

/**
 * Writes a HTML document skeleton.
 */
class HTMLWriter : AbstractPageWriter!(2, "html") {
  this(PageWriterFactory factory, OutputStream[] outputs) {
    super(factory, outputs);
  }

  void generateTOC(Module[] modules) {
    // TODO
    print.format(templates["toc"]);
  }

  void generateModuleSection() {
    // TODO
    print.format(templates["modules"]);
  }

  void generateListingSection() {
    // TODO
    print.format(templates["listings"]);
  }

  void generateDepGraphSection() {
    // TODO
    print.format(templates["dependencies"]);
  }

  void generateIndexSection() { }

  void generateLastPage() { }

  void generateFirstPage() {
    print.format(
      templates["firstpage"],
      factory.options.templates.title,
      factory.options.templates.copyright,
      factory.options.templates.versionString,
      docgen_version
    );
  }

  void addList(char[][] contents, bool ordered) {
    foreach(item; contents) {
      switch(item) {
        case "(": print(ordered ? "<ol>" : "<ul>"); continue;
        case ")": print(ordered ? "</ol>" : "</ul>"); continue;
        default: print("<li>")(xml_escape(item))("</li>");
      }
    }
  }
}