Mercurial > projects > dil
annotate 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 |
rev | line source |
---|---|
444
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
1 /** |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
2 * Author: Jari-Matti Mäkelä |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
3 * License: GPL3 |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
4 */ |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
5 module docgen.sourcelisting.htmlwriter; |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
6 |
453
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
451
diff
changeset
|
7 import docgen.sourcelisting.writer; |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
8 import docgen.misc.textutils; |
453
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
451
diff
changeset
|
9 //import dil.Parser; |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
10 import tango.io.stream.FileStream; |
444
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
11 |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
12 |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
13 /** |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
14 * TODO |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
15 */ |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
16 class HTMLWriter : AbstractWriter!(ListingWriterFactory), ListingWriter { |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
17 PageWriter writer; |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
18 |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
19 this(ListingWriterFactory factory, PageWriter writer) { |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
20 super(factory); |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
21 this.writer = writer; |
444
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
22 } |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
23 |
453
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
451
diff
changeset
|
24 //void generateListing(Parser parser) { /* TODO */ } |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
25 |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
26 void generateListing(InputStream input, OutputStream output, char[] moduleName) { |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
27 auto inputStream = cast(FileInput)input; |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
28 auto content = new char[inputStream.length]; |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
29 auto bytesRead = inputStream.read (content); |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
30 |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
31 assert(bytesRead == inputStream.length, "Error reading source file"); |
466
db7e27b5c180
Fixed parts of HTML output, some reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
32 assert(output == null); |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
33 |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
34 writer.addListing( |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
35 moduleName, |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
36 xml_escape(content) |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
37 ); |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
38 } |
453
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
451
diff
changeset
|
39 } |