Mercurial > projects > dil
changeset 463:12b4ba9248a7
Added missing generators.
author | Jari-Matti M?kel? <jmjm@iki.fi> |
---|---|
date | Tue, 30 Oct 2007 20:54:26 +0200 |
parents | b7503e02fbe7 |
children | 325714d8aa6c |
files | trunk/src/docgen/document/htmlgenerator.d trunk/src/docgen/document/latexgenerator.d trunk/src/docgen/document/plaintextgenerator.d trunk/src/docgen/document/xmlgenerator.d |
diffstat | 4 files changed, 181 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/docgen/document/htmlgenerator.d Tue Oct 30 20:54:26 2007 +0200 @@ -0,0 +1,17 @@ +/** + * Author: Jari-Matti Mäkelä + * License: GPL3 + */ +module docgen.document.htmlgenerator; + +import docgen.document.generator; +import docgen.misc.misc; +import tango.io.stream.FileStream; +import tango.text.Util : replace; + +class HTMLDocGenerator : DefaultDocGenerator!("html") { + this(DocGeneratorOptions options, ParserDg parser) { + super(options, parser); + } + public void generate() { /* TODO */ } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/docgen/document/latexgenerator.d Tue Oct 30 20:54:26 2007 +0200 @@ -0,0 +1,130 @@ +/** + * Author: Jari-Matti Mäkelä + * License: GPL3 + */ +module docgen.document.latexgenerator; + +import docgen.document.generator; +import docgen.misc.misc; +import tango.io.stream.FileStream; +import tango.text.Util : replace; + +/** + * Main routine for LaTeX doc generation. + */ +class LaTeXDocGenerator : DefaultCachingDocGenerator!("latex") { + auto docFileName = "document.tex"; + auto depGraphTexFile = "dependencies.tex"; + auto depGraphFile = "depgraph.dot"; + auto listingFile = "files.tex"; + auto modulesFile = "modules.tex"; + auto langDefFile = "lstlang0.sty"; + auto makeFile = "make.sh"; + + this(DocGeneratorOptions options, ParserDg parser, GraphCache graphcache) { + super(options, parser, graphcache); + } + + /** + * Generates document skeleton. + */ + void generateDoc(char[] docFileName) { + auto docFile = new FileOutput(outPath(docFileName)); + docWriter = pageFactory.createPageWriter( [ docFile ], DocFormat.LaTeX ); + + docWriter.generateFirstPage(); + docWriter.generateTOC(modules); + docWriter.generateModuleSection(); + docWriter.generateListingSection(); + docWriter.generateDepGraphSection(); + docWriter.generateIndexSection(); + docWriter.generateLastPage(); + + docFile.close(); + } + + /** + * Generates D language definition file. + */ + void generateLangDef() { + auto docFile = new FileOutput(outPath(langDefFile)); + + docWriter.setOutput([docFile]); + docWriter.generateLangDef(); + + docFile.close(); + } + + /** + * Generates "makefile" for processing the .dot and .tex files. + */ + void generateMakeFile() { + auto docFile = new FileOutput(outPath(makeFile)); + + docWriter.setOutput([docFile]); + docWriter.generateMakeFile(); + + docFile.close(); + } + + /** + * Generates documentation for modules. + */ + void generateModules() { + auto docFile = new FileOutput(outPath(modulesFile)); + docFile.close(); + } + + /** + * Generates source file listings. + */ + void generateListings() { + auto docFile = new FileOutput(outPath(listingFile)); + + docWriter.setOutput([docFile]); + auto writer = listingFactory.createListingWriter(docWriter, DocFormat.LaTeX); + + foreach(mod; modules) { + auto dstFname = replace(mod.moduleFQN.dup, '.', '_') ~ ".d"; + + auto srcFile = new FileInput(mod.filePath); + auto dstFile = new FileOutput(outPath(dstFname)); + + writer.generateListing(srcFile, dstFile, mod.moduleFQN); + + srcFile.close(); + dstFile.close(); + } + + docFile.close(); + } + + /** + * Generates dependency graphs. + */ + void generateDependencies() { + auto docFile = new FileOutput(outPath(depGraphTexFile)); + + docWriter.setOutput([docFile]); + createDepGraph(depGraphFile); + + docFile.close(); + } + + /** + * Generates the documentation. + */ + public void generate() { + parseSources(); + + generateDoc(docFileName); + + if (options.listing.enableListings) + generateListings(); + + generateModules(); + generateDependencies(); + generateLangDef(); + generateMakeFile(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/docgen/document/plaintextgenerator.d Tue Oct 30 20:54:26 2007 +0200 @@ -0,0 +1,17 @@ +/** + * Author: Jari-Matti Mäkelä + * License: GPL3 + */ +module docgen.document.plaintextgenerator; + +import docgen.document.generator; +import docgen.misc.misc; +import tango.io.stream.FileStream; +import tango.text.Util : replace; + +class PlainTextDocGenerator : DefaultDocGenerator!("txt") { + this(DocGeneratorOptions options, ParserDg parser) { + super(options, parser); + } + public void generate() { /* TODO */ } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/docgen/document/xmlgenerator.d Tue Oct 30 20:54:26 2007 +0200 @@ -0,0 +1,17 @@ +/** + * Author: Jari-Matti Mäkelä + * License: GPL3 + */ +module docgen.document.xmlgenerator; + +import docgen.document.generator; +import docgen.misc.misc; +import tango.io.stream.FileStream; +import tango.text.Util : replace; + +class XMLDocGenerator : DefaultDocGenerator!("xml") { + this(DocGeneratorOptions options, ParserDg parser) { + super(options, parser); + } + public void generate() { /* TODO */ } +}