Mercurial > projects > dil
diff src/docgen/sourcelisting/htmlwriter.d @ 806:bcb74c9b895c
Moved out files in the trunk folder to the root.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sun, 09 Mar 2008 00:12:19 +0100 |
parents | trunk/src/docgen/sourcelisting/htmlwriter.d@db7e27b5c180 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/docgen/sourcelisting/htmlwriter.d Sun Mar 09 00:12:19 2008 +0100 @@ -0,0 +1,39 @@ +/** + * Author: Jari-Matti Mäkelä + * License: GPL3 + */ +module docgen.sourcelisting.htmlwriter; + +import docgen.sourcelisting.writer; +import docgen.misc.textutils; +//import dil.Parser; +import tango.io.stream.FileStream; + + +/** + * TODO + */ +class HTMLWriter : AbstractWriter!(ListingWriterFactory), ListingWriter { + PageWriter writer; + + this(ListingWriterFactory factory, PageWriter writer) { + super(factory); + this.writer = writer; + } + + //void generateListing(Parser parser) { /* TODO */ } + + void generateListing(InputStream input, OutputStream output, char[] moduleName) { + auto inputStream = cast(FileInput)input; + auto content = new char[inputStream.length]; + auto bytesRead = inputStream.read (content); + + assert(bytesRead == inputStream.length, "Error reading source file"); + assert(output == null); + + writer.addListing( + moduleName, + xml_escape(content) + ); + } +}