private static void OutputHtml(Project project, XmlOutputter xmlOutputter, Options options) { StageStopwatch.Restart(); Report.NewStatus("Generating htmls... "); var reader = CreateSourceXml(project, options); var preProcess = new XsltRunner(Path.Combine(EnvVar.ExecPath, "themes", options.ThemeName, "main_pre.xslt")); var preProcessResult = preProcess.Run(xmlOutputter.XDocument, Path.GetFullPath(options.OutputDirectory)); if (options.SaveXmls) { preProcessResult.Save(EnvVar.XmlOutputPath(options.OutputDirectory, "documentation_file.xml")); } var htmlOutputter = new XsltRunner(Path.Combine(EnvVar.ExecPath, "themes", options.ThemeName, "main.xslt")); htmlOutputter.Run( preProcessResult.ToXDocument(), Path.GetFullPath(options.OutputDirectory) + EnvVar.Slash, new KeyValuePair <string, object>("verbose", Report.Verbose), new KeyValuePair <string, object>("source", reader)); SaveTiming("html-output", StageStopwatch.ElapsedMilliseconds); Report.ContinueStatus("Done"); }
public static int Main(string[] args) { #if DEBUG Report.SetDebugProfile(); #endif #if !DEBUG AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper; Report.SetReleaseProfile(); #endif TotalStopwatch.Restart(); StageStopwatch.Restart(); var options = new Options(); GetCommandLineOptions(args, options); GetOptions(options.ProjectFilePath ?? EnvVar.DefaultInfoPath, options); Report.Verbose = options.Verbose; SaveTiming("options-parsing", StageStopwatch.ElapsedMilliseconds); var project = GetProject(options.SourceFilePaths, options.RunInSerial); var xmlOutputter = GetXmlOutputter(project, new XElement("Information", options.XmlInformation)); if (options.SaveXmls) { xmlOutputter.SaveToDisk(EnvVar.XmlOutputPath(options.OutputDirectory, "project.xml")); } if (options.NoOutput) { return(0); } OutputTheme(options); OutputHtml(project, xmlOutputter, options); SaveTiming("total", TotalStopwatch.ElapsedMilliseconds); if (options.TimeOutput) { Directory.CreateDirectory(EnvVar.XmlOutputPath(options.OutputDirectory)); TimingXml.Save(EnvVar.XmlOutputPath(options.OutputDirectory, "timings.xml")); } Report.NewStatus($@"Documentation can be found at '{Path.GetFullPath(options.OutputDirectory)}'"); Report.NewStatus("Documentation generation complete.\n"); return(0); }
private static XmlReader CreateSourceXml(Project project, Options options) { var xElements = from source in project.Sources let highlighter = DocumentationManager.TryGetDefinitionByIdentifier(source.Language) select new XElement( "File", new XElement("Identifier", source.Identifier), highlighter.HighlightLines(source.OriginalLines)); var reader = new XDocument(new XElement("Source", xElements)).CreateReader(); if (options.SaveXmls) { new XDocument(new XElement("Source", xElements)).Save(EnvVar.XmlOutputPath(options.OutputDirectory, "source.xml")); } return(reader); }