comparison trunk/src/cmd/DDoc.d @ 740:f3dead0310ce

Added '-v' (verbose) option to command 'ddoc'.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 09 Feb 2008 15:10:13 +0100
parents 49fe21aa387c
children 35184354a502
comparison
equal deleted inserted replaced
739:49fe21aa387c 740:f3dead0310ce
29 import tango.text.Ascii : toUpper; 29 import tango.text.Ascii : toUpper;
30 import tango.io.File; 30 import tango.io.File;
31 import tango.io.FilePath; 31 import tango.io.FilePath;
32 32
33 void execute(string[] filePaths, string destDir, string[] macroPaths, 33 void execute(string[] filePaths, string destDir, string[] macroPaths,
34 bool incUndoc, InfoManager infoMan) 34 bool incUndoc, bool verbose, InfoManager infoMan)
35 { 35 {
36 // Parse macro files. 36 // Parse macro files.
37 MacroTable mtable; 37 MacroTable mtable;
38 MacroParser mparser; 38 MacroParser mparser;
39 foreach (macroPath; macroPaths) 39 foreach (macroPath; macroPaths)
58 auto pass1 = new SemanticPass1(mod); 58 auto pass1 = new SemanticPass1(mod);
59 pass1.start(); 59 pass1.start();
60 60
61 // Generate documentation. 61 // Generate documentation.
62 auto dest = new FilePath(destDir); 62 auto dest = new FilePath(destDir);
63 generateDocumentation(dest, mod, mtable, incUndoc); 63 generateDocumentation(dest, mod, mtable, incUndoc, verbose);
64 } 64 }
65 } 65 }
66 66
67 void generateDocumentation(FilePath dest, Module mod, MacroTable mtable, bool incUndoc) 67 void generateDocumentation(FilePath dest, Module mod, MacroTable mtable,
68 bool incUndoc, bool verbose)
68 { 69 {
69 // Create a macro environment for this module. 70 // Create a macro environment for this module.
70 mtable = new MacroTable(mtable); 71 mtable = new MacroTable(mtable);
71 // Define runtime macros. 72 // Define runtime macros.
72 mtable.insert("TITLE", mod.getFQN()); 73 mtable.insert("TITLE", mod.getFQN());
85 mtable.insert("BODY", doc.text); 86 mtable.insert("BODY", doc.text);
86 // Do the macro expansion pass. 87 // Do the macro expansion pass.
87 auto fileText = expandMacros(mtable, "$(DDOC)"); 88 auto fileText = expandMacros(mtable, "$(DDOC)");
88 // Finally write the file out to the harddisk. 89 // Finally write the file out to the harddisk.
89 dest.append(mod.getFQN() ~ ".html"); 90 dest.append(mod.getFQN() ~ ".html");
91 if (verbose)
92 Stdout.formatln("{} > {}", mod.filePath, dest);
90 auto file = new File(dest); 93 auto file = new File(dest);
91 file.write(fileText); 94 file.write(fileText);
92 } 95 }
93 96
94 string loadMacroFile(string filePath) 97 string loadMacroFile(string filePath)