annotate src/docgen/page/plaintextwriter.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/page/plaintextwriter.d@e48a011e687a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
457
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
1 /**
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
2 * Author: Jari-Matti Mäkelä
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
3 * License: GPL3
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
4 */
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
5 module docgen.page.plaintextwriter;
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
6
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
7 import docgen.page.writer;
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
8 import docgen.misc.textutils;
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
9 import tango.io.FileConduit : FileConduit;
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
10
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
11 /**
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
12 * Writes a plain text document skeleton.
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
13 */
466
db7e27b5c180 Fixed parts of HTML output, some reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 457
diff changeset
14 class PlainTextWriter : AbstractPageWriter!("plaintext") {
457
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
15 this(PageWriterFactory factory, OutputStream[] outputs) {
470
e48a011e687a Initial plain text output support.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 466
diff changeset
16 super(factory);
457
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
17 }
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
18
470
e48a011e687a Initial plain text output support.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 466
diff changeset
19 override void generateTOC(Module[] modules) {
466
db7e27b5c180 Fixed parts of HTML output, some reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 457
diff changeset
20 print.format(getTemplate("toc"));
457
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
21 }
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
22
470
e48a011e687a Initial plain text output support.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 466
diff changeset
23 override void generateModuleSection(Module[] modules) {
466
db7e27b5c180 Fixed parts of HTML output, some reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 457
diff changeset
24 print.format(getTemplate("modules"));
457
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
25 }
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
26
470
e48a011e687a Initial plain text output support.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 466
diff changeset
27 override void generateListingSection(Module[] modules) {
466
db7e27b5c180 Fixed parts of HTML output, some reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 457
diff changeset
28 print.format(getTemplate("listings"));
457
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
29 }
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
30
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
31 void generateDepGraphSection() {
466
db7e27b5c180 Fixed parts of HTML output, some reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 457
diff changeset
32 print.format(getTemplate("dependencies"));
457
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
33 }
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
34
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
35 void generateFirstPage() {
470
e48a011e687a Initial plain text output support.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 466
diff changeset
36 print.format(getTemplate("firstpage"),
e48a011e687a Initial plain text output support.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 466
diff changeset
37 plainTextHeading(factory.options.templates.title ~ " Reference Manual"),
e48a011e687a Initial plain text output support.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 466
diff changeset
38 factory.options.templates.versionString,
e48a011e687a Initial plain text output support.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 466
diff changeset
39 docgen_version,
e48a011e687a Initial plain text output support.
Jari-Matti M?kel? <jmjm@iki.fi>
parents: 466
diff changeset
40 timeNow()
457
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
41 );
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
42 }
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
43
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
44 void addList(char[][] contents, bool ordered) {
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
45 uint[] counters;
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
46 foreach(item; contents) {
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
47 switch(item) {
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
48 case "(": counters ~= 1; continue;
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
49 case ")": counters.length = counters.length - 1; continue;
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
50 default:
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
51 if (counters.length>0)
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
52 for (int i=0; i <= counters.length; i++)
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
53 print(" ");
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
54 if (ordered)
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
55 print(++counters[$-1])(". ")(item)(\n);
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
56 else
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
57 print("* ")(item)(\n);
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
58 }
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
59 }
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
60 }
33a4cb255fcc Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff changeset
61 }