Mercurial > projects > dil
annotate trunk/src/docgen/sourcelisting/latexwriter.d @ 451:3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
author | Jari-Matti M?kel? <jmjm@iki.fi> |
---|---|
date | Wed, 24 Oct 2007 17:25:52 +0300 |
parents | 757bd048482c |
children | 4e5b35df3060 |
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.latexwriter; |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
6 |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
7 public import docgen.sourcelisting.writer; |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
8 import dil.Parser; |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
9 import tango.io.protocol.Writer : Writer; |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
10 import tango.io.FileConduit : FileConduit; |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
11 import tango.io.Print: Print; |
449
757bd048482c
Depgraph test + minor modifications.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
448
diff
changeset
|
12 import tango.io.FilePath; |
444
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
13 import tango.text.convert.Layout : Layout; |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
14 |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
15 /** |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
16 * Adds a code listing section for the given file. |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
17 */ |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
18 class LaTeXWriter : AbstractWriter!(ListingWriterFactory), ListingWriter { |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
19 DocumentWriter writer; |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
20 |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
21 this(ListingWriterFactory factory, DocumentWriter writer) { |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
22 super(factory); |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
23 this.writer = writer; |
444
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
24 } |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
25 |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
26 void generateListing(Parser parser) { /* TODO */ } |
444
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
27 |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
28 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
|
29 output.copy(input); |
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 writer.addListing( |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
32 moduleName, |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
33 FilePath((cast(FileConduit)output.conduit).toUtf8()).file |
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
34 ); |
444
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
35 } |
0bda71dc9c4f
More document template and source listing code.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
36 } |