-
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#433: Added report types Html_Light, Html_Dark and HtmlInline_AzurePi…
…pelines_Light
- Loading branch information
1 parent
6cdc048
commit 27fe53a
Showing
17 changed files
with
794 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/ReportGenerator.Core/Reporting/Builders/HtmlDarkReportBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Palmmedia.ReportGenerator.Core.Parser.Analysis; | ||
using Palmmedia.ReportGenerator.Core.Reporting.Builders.Rendering; | ||
|
||
namespace Palmmedia.ReportGenerator.Core.Reporting.Builders | ||
{ | ||
/// <summary> | ||
/// Creates report in HTML format. | ||
/// </summary> | ||
public class HtmlDarkReportBuilder : HtmlReportBuilderBase | ||
{ | ||
/// <summary> | ||
/// Defines how CSS and JavaScript are referenced. | ||
/// </summary> | ||
private readonly HtmlMode htmlMode; | ||
|
||
/// <summary> | ||
/// Dictionary containing the filenames of the class reports by class. | ||
/// </summary> | ||
private readonly IDictionary<string, string> fileNameByClass = new Dictionary<string, string>(); | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="HtmlDarkReportBuilder" /> class. | ||
/// </summary> | ||
public HtmlDarkReportBuilder() | ||
: this(true) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="HtmlDarkReportBuilder" /> class. | ||
/// </summary> | ||
/// <param name="externalCssAndJavaScriptWithQueryStringHandling">Defines how CSS and JavaScript are referenced.</param> | ||
public HtmlDarkReportBuilder(bool externalCssAndJavaScriptWithQueryStringHandling) | ||
{ | ||
this.htmlMode = externalCssAndJavaScriptWithQueryStringHandling ? HtmlMode.ExternalCssAndJavaScriptWithQueryStringHandling | ||
: HtmlMode.ExternalCssAndJavaScript; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the report type. | ||
/// </summary> | ||
/// <value> | ||
/// The report format. | ||
/// </value> | ||
public override string ReportType => "Html_Dark"; | ||
|
||
/// <summary> | ||
/// Creates a class report. | ||
/// </summary> | ||
/// <param name="class">The class.</param> | ||
/// <param name="fileAnalyses">The file analyses that correspond to the class.</param> | ||
public override void CreateClassReport(Class @class, IEnumerable<FileAnalysis> fileAnalyses) | ||
{ | ||
using (var renderer = new HtmlRenderer(this.fileNameByClass, false, this.htmlMode, "custom.css", "custom_dark.css")) | ||
{ | ||
this.CreateClassReport(renderer, @class, fileAnalyses); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Creates the summary report. | ||
/// </summary> | ||
/// <param name="summaryResult">The summary result.</param> | ||
public override void CreateSummaryReport(SummaryResult summaryResult) | ||
{ | ||
using (var renderer = new HtmlRenderer(this.fileNameByClass, false, this.htmlMode, "custom.css", "custom_dark.css")) | ||
{ | ||
this.CreateSummaryReport(renderer, summaryResult); | ||
} | ||
|
||
string targetDirectory = this.CreateTargetDirectory(); | ||
|
||
File.Copy( | ||
Path.Combine(targetDirectory, "index.html"), | ||
Path.Combine(targetDirectory, "index.htm"), | ||
true); | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/ReportGenerator.Core/Reporting/Builders/HtmlInlineAzurePipelinesLightReportBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Palmmedia.ReportGenerator.Core.Parser.Analysis; | ||
using Palmmedia.ReportGenerator.Core.Reporting.Builders.Rendering; | ||
|
||
namespace Palmmedia.ReportGenerator.Core.Reporting.Builders | ||
{ | ||
/// <summary> | ||
/// Creates report in HTML format. | ||
/// </summary> | ||
public class HtmlInlineAzurePipelinesLightReportBuilder : HtmlReportBuilderBase | ||
{ | ||
/// <summary> | ||
/// Dictionary containing the filenames of the class reports by class. | ||
/// </summary> | ||
private readonly IDictionary<string, string> fileNameByClass = new Dictionary<string, string>(); | ||
|
||
/// <summary> | ||
/// Gets the report type. | ||
/// </summary> | ||
/// <value> | ||
/// The report format. | ||
/// </value> | ||
public override string ReportType => "HtmlInline_AzurePipelines_Light"; | ||
|
||
/// <summary> | ||
/// Creates a class report. | ||
/// </summary> | ||
/// <param name="class">The class.</param> | ||
/// <param name="fileAnalyses">The file analyses that correspond to the class.</param> | ||
public override void CreateClassReport(Class @class, IEnumerable<FileAnalysis> fileAnalyses) | ||
{ | ||
using (var renderer = new HtmlRenderer(this.fileNameByClass, false, HtmlMode.InlineCssAndJavaScript, "custom-azurepipelines.css", null)) | ||
{ | ||
this.CreateClassReport(renderer, @class, fileAnalyses); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Creates the summary report. | ||
/// </summary> | ||
/// <param name="summaryResult">The summary result.</param> | ||
public override void CreateSummaryReport(SummaryResult summaryResult) | ||
{ | ||
using (var renderer = new HtmlRenderer(this.fileNameByClass, false, HtmlMode.InlineCssAndJavaScript, "custom-azurepipelines.css", null)) | ||
{ | ||
this.CreateSummaryReport(renderer, summaryResult); | ||
} | ||
|
||
string targetDirectory = this.CreateTargetDirectory(); | ||
|
||
File.Copy( | ||
Path.Combine(targetDirectory, "index.html"), | ||
Path.Combine(targetDirectory, "index.htm"), | ||
true); | ||
} | ||
} | ||
} |
Oops, something went wrong.