diff --git a/AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1 b/AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1
index a5b46fb..52ead84 100644
--- a/AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1
+++ b/AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1
@@ -12,7 +12,7 @@
RootModule = 'AsBuiltReport.Diagram.psm1'
# Version number of this module.
- ModuleVersion = '1.0.6'
+ ModuleVersion = '1.0.7'
# Supported PSEditions
# CompatiblePSEditions = @()
diff --git a/AsBuiltReport.Diagram/Src/Private/Add-HtmlLabel.ps1 b/AsBuiltReport.Diagram/Src/Private/Add-HtmlLabel.ps1
index f0fc39a..7d0308d 100644
--- a/AsBuiltReport.Diagram/Src/Private/Add-HtmlLabel.ps1
+++ b/AsBuiltReport.Diagram/Src/Private/Add-HtmlLabel.ps1
@@ -281,71 +281,80 @@ function Add-HtmlLabel {
[string] $Port = 'EdgeDot'
)
- if ($IconType -eq 'NoIcon') {
- $ICON = 'NoIcon'
- } elseif ($ImagesObj[$IconType]) {
- $ICON = $ImagesObj[$IconType]
- } else { $ICON = 'no_icon.png' }
+ $ICON = if ($IconType -eq 'NoIcon') { 'NoIcon' }
+ elseif ($ImagesObj[$IconType]) { $ImagesObj[$IconType] }
+ else { 'no_icon.png' }
- if ($ImageSizePercent -lt 100) {
+ $CalculatedImageSize = $null
+ if ($ImageSizePercent -lt 100 -and $ICON -ne 'NoIcon') {
if (-not $IconPath) {
throw 'IconPath is required when ImageSizePercent is less than 100.'
}
$CalculatedImageSize = Get-ImagePercent -ImageInput (Join-Path -Path $IconPath -Child $ICON) -Percent $ImageSizePercent
}
- $FormattedLabel = Format-HtmlFontProperty -Text $Label -FontSize $FontSize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName -FontSubscript:$FontSubscript -FontSuperscript:$FontSuperscript -FontStrikeThrough:$FontStrikeThrough -FontOverline:$FontOverline
-
- if (-not $SubgraphLabel) {
-
- if ($IconDebug) {
- $TRContent = '
| {1} Logo |
| {5} |
| DraftMode ON |
' -f $Align, $ICON, $FontName, $FontColor, $FontSize, $Label
-
- Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent -CellBorder $CellBorder
- } elseif ($ICON -ne 'NoIcon') {
- if ($IconWidth -and $IconHeight) {
- $TRContent = ' |
| {5} |
' -f $Align, $CellBackgroundColor, $IconWidth, $IconHeight, $ICON, $FormattedLabel
-
- Format-HtmlTable -Port $Port -TableBackgroundColor $TableBackgroundColor -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent -CellBorder $CellBorder
- } elseif ($CalculatedImageSize) {
- $TRContent = ' |
| {5} |
' -f $Align, $CellBackgroundColor, $CalculatedImageSize.Width, $CalculatedImageSize.Height, $ICON, $FormattedLabel
-
- Format-HtmlTable -Port $Port -TableBackgroundColor $TableBackgroundColor -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent -CellBorder $CellBorder
- } else {
- $TRContent = ' |
| {3} |
' -f $Align, $CellBackgroundColor, $ICON, $FormattedLabel
-
- Format-HtmlTable -Port $Port -TableBackgroundColor $TableBackgroundColor -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent -CellBorder $CellBorder
- }
- } else {
- $TRContent = '| {2} |
' -f $Align, $CellBackgroundColor, $FormattedLabel
-
- Format-HtmlTable -Port $Port -TableBackgroundColor $TableBackgroundColor -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent -CellBorder $CellBorder
- }
+ $fontParams = @{
+ FontSize = $FontSize
+ FontColor = $FontColor
+ FontBold = $FontBold
+ FontItalic = $FontItalic
+ FontUnderline = $FontUnderline
+ FontName = $FontName
+ FontSubscript = $FontSubscript
+ FontSuperscript = $FontSuperscript
+ FontStrikeThrough = $FontStrikeThrough
+ FontOverline = $FontOverline
+ }
+ $FormattedLabel = Format-HtmlFontProperty -Text $Label @fontParams
+
+ $effectiveCellSpacing = if ($SubgraphLabel) { $SubgraphCellSpacing } else { $CellSpacing }
+ $effectiveCellPadding = if ($SubgraphLabel) { $SubgraphCellPadding } else { $CellPadding }
+
+ # Base table params shared by all branches; TableBackgroundColor is added for non-debug branches only.
+ $baseTableParams = @{
+ Port = $Port
+ TableStyle = $TableStyle
+ TableBorder = $TableBorder
+ CellBorder = $CellBorder
+ CellSpacing = $effectiveCellSpacing
+ CellPadding = $effectiveCellPadding
}
- if ($SubgraphLabel) {
- if ($IconDebug) {
+ if ($IconDebug) {
+ if ($SubgraphLabel) {
$TRContent = '| {1} Logo | {2} |
' -f $Align, $ICON, $FormattedLabel
-
- Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $SubgraphCellSpacing -CellPadding $SubgraphCellPadding -TableRowContent $TRContent -CellBorder $CellBorder
- } elseif ($ICON -ne 'NoIcon') {
+ } else {
+ $TRContent = '| {1} Logo |
| {5} |
| DraftMode ON |
' -f $Align, $ICON, $FontName, $FontColor, $FontSize, $Label
+ }
+ Format-HtmlTable @baseTableParams -TableRowContent $TRContent
+ } elseif ($ICON -ne 'NoIcon') {
+ if ($SubgraphLabel) {
+ # Side-by-side layout: icon cell | label cell in same TR. Uses uppercase
.
if ($IconWidth -and $IconHeight) {
$TRContent = ' | {5} |
' -f $Align, $CellBackgroundColor, $IconWidth, $IconHeight, $ICON, $FormattedLabel
-
- Format-HtmlTable -Port $Port -TableBackgroundColor $TableBackgroundColor -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $SubgraphCellSpacing -CellPadding $SubgraphCellPadding -TableRowContent $TRContent -CellBorder $CellBorder
} elseif ($CalculatedImageSize) {
$TRContent = ' | {5} |
' -f $Align, $CellBackgroundColor, $CalculatedImageSize.Width, $CalculatedImageSize.Height, $ICON, $FormattedLabel
-
- Format-HtmlTable -Port $Port -TableBackgroundColor $TableBackgroundColor -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $SubgraphCellSpacing -CellPadding $SubgraphCellPadding -TableRowContent $TRContent -CellBorder $CellBorder
} else {
$TRContent = ' | {3} |
' -f $Align, $CellBackgroundColor, $ICON, $FormattedLabel
-
- Format-HtmlTable -Port $Port -TableBackgroundColor $TableBackgroundColor -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $SubgraphCellSpacing -CellPadding $SubgraphCellPadding -TableRowContent $TRContent -CellBorder $CellBorder
}
} else {
+ # Stacked layout: icon TR on top, label TR below. Uses lowercase
.
+ if ($IconWidth -and $IconHeight) {
+ $TRContent = ' |
| {5} |
' -f $Align, $CellBackgroundColor, $IconWidth, $IconHeight, $ICON, $FormattedLabel
+ } elseif ($CalculatedImageSize) {
+ $TRContent = ' |
| {5} |
' -f $Align, $CellBackgroundColor, $CalculatedImageSize.Width, $CalculatedImageSize.Height, $ICON, $FormattedLabel
+ } else {
+ $TRContent = ' |
| {3} |
' -f $Align, $CellBackgroundColor, $ICON, $FormattedLabel
+ }
+ }
+ Format-HtmlTable @baseTableParams -TableBackgroundColor $TableBackgroundColor -TableRowContent $TRContent
+ } else {
+ # NoIcon: attribute order differs intentionally between layouts (preserved from original).
+ if ($SubgraphLabel) {
$TRContent = '| {2} |
' -f $Align, $CellBackgroundColor, $FormattedLabel
-
- Format-HtmlTable -Port $Port -TableBackgroundColor $TableBackgroundColor -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $SubgraphCellSpacing -CellPadding $SubgraphCellPadding -TableRowContent $TRContent -CellBorder $CellBorder
+ } else {
+ $TRContent = '| {2} |
' -f $CellBackgroundColor, $Align, $FormattedLabel
}
+ Format-HtmlTable @baseTableParams -TableBackgroundColor $TableBackgroundColor -TableRowContent $TRContent
}
}
\ No newline at end of file
diff --git a/AsBuiltReport.Diagram/Src/Private/Add-HtmlNodeTable.ps1 b/AsBuiltReport.Diagram/Src/Private/Add-HtmlNodeTable.ps1
index 5b36f4f..5215f85 100644
--- a/AsBuiltReport.Diagram/Src/Private/Add-HtmlNodeTable.ps1
+++ b/AsBuiltReport.Diagram/Src/Private/Add-HtmlNodeTable.ps1
@@ -445,76 +445,22 @@ function Add-HtmlNodeTable {
}
if ($AditionalInfo) {
- switch ($AditionalInfo.GetType().Name) {
- 'Hashtable' {
- if ($AditionalInfo) {
- $Filter = $AditionalInfo.keys | Select-Object -Unique
- $RowsGroupHTs = @()
-
- foreach ($RepoObj in ($Filter)) {
- $RowsGroupHTs += @{
- $RepoObj = $AditionalInfo.$RepoObj
- }
- }
- }
- }
-
- 'OrderedDictionary' {
- if ($AditionalInfo) {
- $Filter = $AditionalInfo.keys | Select-Object -Unique
- $RowsGroupHTs = @()
-
- foreach ($RepoObj in ($Filter)) {
- $RowsGroupHTs += @{
- $RepoObj = $AditionalInfo.$RepoObj
- }
- }
- }
- }
-
- 'Object[]' {
- if ($AditionalInfo[0].GetType().Name -eq 'PSCustomObject') {
- $Filter = $AditionalInfo | ForEach-Object { $_.PSObject.Properties.name } | Select-Object -Unique
- $RowsGroupHTs = @()
+ $RowsGroupHTs = @()
+ $isPSCustomObj = $AditionalInfo.GetType().Name -eq 'PSCustomObject' -or
+ ($AditionalInfo.GetType().Name -eq 'Object[]' -and $AditionalInfo[0].GetType().Name -eq 'PSCustomObject')
- foreach ($RepoObj in ($Filter)) {
- $RowsGroupHTs += @{
- $RepoObj = $AditionalInfo.$RepoObj
- }
- }
- } else {
- $Filter = $AditionalInfo.keys | Select-Object -Unique
- $RowsGroupHTs = @()
-
- foreach ($RepoObj in ($Filter)) {
- $RowsGroupHTs += @{
- $RepoObj = $AditionalInfo.$RepoObj
- }
- }
- }
- }
-
- 'PSCustomObject' {
- if ($AditionalInfo) {
- $Filter = $AditionalInfo | ForEach-Object { $_.PSObject.Properties.name } | Select-Object -Unique
- $RowsGroupHTs = @()
+ $Filter = if ($isPSCustomObj) {
+ $AditionalInfo | ForEach-Object { $_.PSObject.Properties.name } | Select-Object -Unique
+ } else {
+ $AditionalInfo.keys | Select-Object -Unique
+ }
- foreach ($RepoObj in ($Filter)) {
- $RowsGroupHTs += @{
- $RepoObj = $AditionalInfo.$RepoObj
- }
- }
- }
- }
+ foreach ($RepoObj in $Filter) {
+ $RowsGroupHTs += @{ $RepoObj = $AditionalInfo.$RepoObj }
}
}
- # Determine FontBold based on NoFontBold switch
- if ($NoFontBold) {
- $FontBold = $false
- } else {
- $FontBold = $true
- }
+ $FontBold = $true
if ($ImagesObj) {
if ($iconType.Count -gt 1) {
@@ -528,10 +474,9 @@ function Add-HtmlNodeTable {
}
$iconGroup = Split-ArrayElement -inArray $Icon -size $columnSize
} else {
- # $iconGroup = $iconType
if ($ImagesObj[$iconType[0]]) {
$Icon = $ImagesObj[$iconType[0]]
- } else { $Icon = $false }
+ } else { $Icon = $null }
$iconGroup = $Icon
}
}
@@ -539,7 +484,20 @@ function Add-HtmlNodeTable {
if ($SubgraphIconType) {
if ($ImagesObj[$SubgraphIconType]) {
$SubgraphIcon = $ImagesObj[$SubgraphIconType]
- } else { $SubgraphIcon = $false }
+ } else { $SubgraphIcon = $null }
+ }
+
+ $fontParams = @{
+ FontSize = $FontSize
+ FontColor = $FontColor
+ FontBold = $FontBold
+ FontItalic = $FontItalic
+ FontUnderline = $FontUnderline
+ FontName = $FontName
+ FontSubscript = $FontSubscript
+ FontSuperscript = $FontSuperscript
+ FontStrikeThrough = $FontStrikeThrough
+ FontOverline = $FontOverline
}
$Number = 0
@@ -560,14 +518,14 @@ function Add-HtmlNodeTable {
$TDICON = ''
foreach ($Element in $Group[$Number]) {
- $FormattedName = Format-HtmlFontProperty -Text $Element -FontSize $FontSize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName -FontSubscript:$FontSubscript -FontSuperscript:$FontSuperscript -FontStrikeThrough:$FontStrikeThrough -FontOverline:$FontOverline
+ $FormattedName = Format-HtmlFontProperty @fontParams -Text $Element
$TDName += '{2} | ' -f $Element, $Align, $FormattedName
}
$TR += '{0}
' -f $TDName
$TDName = ''
- if ($AditionalInfo -or $AditionalInfoOrdered) {
+ if ($AditionalInfo) {
if (($RowsGroupHTs.Keys.Count -le 1 ) -and ($RowsGroupHTs.Values.Count -le 1) -and ($inputObject.Count -le 1)) {
# $RowsGroupHT is Single key with Single Values
# Keys: Path - Values: C:\Backup
@@ -624,7 +582,7 @@ function Add-HtmlNodeTable {
while ($Number -ne $Group.Count) {
foreach ($Element in $Group[$Number]) {
- $FormattedName = Format-HtmlFontProperty -Text $Element -FontSize $FontSize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName -FontSubscript:$FontSubscript -FontSuperscript:$FontSuperscript -FontStrikeThrough:$FontStrikeThrough -FontOverline:$FontOverline
+ $FormattedName = Format-HtmlFontProperty @fontParams -Text $Element
$TDName += '{2} | ' -f $Element, $Align, $FormattedName
}
@@ -633,7 +591,7 @@ function Add-HtmlNodeTable {
$TDName = ''
- if ($AditionalInfo -or $AditionalInfoOrdered) {
+ if ($AditionalInfo) {
if (($RowsGroupHTs.Keys.Count -le 1 ) -and ($RowsGroupHTs.Values.Count -le 1) -and ($inputObject.Count -le 1)) {
# $RowsGroupHT is Single key with Single Values
# Keys: Path - Values: C:\Backup
@@ -693,7 +651,7 @@ function Add-HtmlNodeTable {
foreach ($Element in $Group[$Number]) {
# Format the name with the specified font properties
- $FormattedName = Format-HtmlFontProperty -Text $Element -FontSize $FontSize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName -FontSubscript:$FontSubscript -FontSuperscript:$FontSuperscript -FontStrikeThrough:$FontStrikeThrough -FontOverline:$FontOverline
+ $FormattedName = Format-HtmlFontProperty @fontParams -Text $Element
if ($CellBackgroundColor) {
$TDName += '{3} | ' -f $CellBackgroundColor, $Element, $Align, $FormattedName
@@ -704,7 +662,7 @@ function Add-HtmlNodeTable {
$TR += '{0}
' -f $TDName
$TDName = ''
- if ($AditionalInfo -or $AditionalInfoOrdered) {
+ if ($AditionalInfo) {
if (($RowsGroupHTs.Keys.Count -le 1 ) -and ($RowsGroupHTs.Values.Count -le 1) -and ($inputObject.Count -le 1)) {
# $RowsGroupHT is Single key with Single Values
# Keys: Path - Values: C:\Backup
@@ -757,7 +715,7 @@ function Add-HtmlNodeTable {
while ($Number -ne $Group.Count) {
foreach ($Element in $Group[$Number]) {
# Format the name with the specified font properties
- $FormattedName = Format-HtmlFontProperty -Text $Element -FontSize $FontSize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName -FontSubscript:$FontSubscript -FontSuperscript:$FontSuperscript -FontStrikeThrough:$FontStrikeThrough -FontOverline:$FontOverline
+ $FormattedName = Format-HtmlFontProperty @fontParams -Text $Element
if ($CellBackgroundColor) {
$TDName += '{3} | ' -f $CellBackgroundColor, $Element, $Align, $FormattedName
@@ -768,7 +726,7 @@ function Add-HtmlNodeTable {
$TR += '{0}
' -f $TDName
$TDName = ''
- if ($AditionalInfo -or $AditionalInfoOrdered) {
+ if ($AditionalInfo) {
if (($RowsGroupHTs.Keys.Count -le 1 ) -and ($RowsGroupHTs.Values.Count -le 1) -and ($inputObject.Count -le 1)) {
# $RowsGroupHT is Single key with Single Values
# Keys: Path - Values: C:\Backup
@@ -777,7 +735,7 @@ function Add-HtmlNodeTable {
$TDInfo += '{2}: {3} | ' -f $Align, $FontSize, [string]$Element.Keys, [string]$Element.values
}
- $TR += '{0}
' -f $TDInfobgcolor
+ $TR += '{0}
' -f $TDInfo
$TDInfo = ''
} elseif (($RowsGroupHTs.Keys.Count -gt 1) -and ($RowsGroupHTs.Values.Count -gt 1) -and ($inputObject.Count -le 1)) {
# $RowsGroupHT is Multiple key and each key have a Single Values
@@ -819,75 +777,53 @@ function Add-HtmlNodeTable {
# This part set the capability to emulate Graphviz Subgraph
if ($Subgraph) {
- $FormattedSubGraphLabel = Format-HtmlFontProperty -Text $SubGraphLabel -FontSize $SubgraphLabelFontSize -FontColor $SubgraphLabelFontColor -FontBold:$SubgraphFontBold -FontItalic:$SubgraphFontItalic -FontUnderline:$SubgraphFontUnderline -FontName $SubgraphFontName -FontSubscript:$SubgraphFontSubscript -FontSuperscript:$SubgraphFontSuperscript -FontStrikeThrough:$SubgraphFontStrikeThrough -FontOverline:$SubgraphFontOverline
+ $subgraphFontParams = @{
+ FontSize = $SubgraphLabelFontSize
+ FontColor = $SubgraphLabelFontColor
+ FontBold = $SubgraphFontBold
+ FontItalic = $SubgraphFontItalic
+ FontUnderline = $SubgraphFontUnderline
+ FontName = $SubgraphFontName
+ FontSubscript = $SubgraphFontSubscript
+ FontSuperscript = $SubgraphFontSuperscript
+ FontStrikeThrough = $SubgraphFontStrikeThrough
+ FontOverline = $SubgraphFontOverline
+ }
+ $FormattedSubGraphLabel = Format-HtmlFontProperty @subgraphFontParams -Text $SubGraphLabel
if ($SubgraphIcon) {
if ($IconDebug) {
$TDSubgraphIcon = '{6} | ' -f $SubgraphPort, $Align, $columnSize, $FontName, $FontColor, $SubgraphLabelFontSize, $SubGraphIcon
-
- $TDSubgraph = '{2} | ' -f $Align, $columnSize, $FormattedSubGraphLabel
-
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraphIcon
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp += '{0}
' -f $TDSubgraphIcon
- $TRTemp += '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
+ } elseif ($SubgraphIconWidth -and $SubgraphIconHeight) {
+ $TDSubgraphIcon = ' | ' -f $SubgraphPort, $Align, $columnSize, $SubGraphIconWidth, $SubGraphIconHeight, $SubGraphIcon
} else {
- if ($SubgraphIconWidth -and $SubgraphIconHeight) {
- $TDSubgraphIcon = ' | ' -f $SubgraphPort, $Align, $columnSize, $SubGraphIconWidth, $SubGraphIconHeight, $SubGraphIcon
-
- $TDSubgraph = '{2} | ' -f $Align, $columnSize, $FormattedSubGraphLabel
-
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraphIcon
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp += '{0}
' -f $TDSubgraphIcon
- $TRTemp += '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
- } else {
- $TDSubgraphIcon = ' | ' -f $SubgraphPort, $Align, $columnSize, $SubGraphIcon
+ $TDSubgraphIcon = ' | ' -f $SubgraphPort, $Align, $columnSize, $SubGraphIcon
+ }
- $TDSubgraph = '{2} | ' -f $Align, $columnSize, $FormattedSubGraphLabel
+ $TDSubgraph = '{2} | ' -f $Align, $columnSize, $FormattedSubGraphLabel
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraphIcon
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp += '{0}
' -f $TDSubgraphIcon
- $TRTemp += '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
- }
+ if ($SubgraphLabelPos -eq 'down') {
+ $TR += '{0}
' -f $TDSubgraphIcon
+ $TR += '{0}
' -f $TDSubgraph
+ } else {
+ $TRTemp += '{0}
' -f $TDSubgraphIcon
+ $TRTemp += '{0}
' -f $TDSubgraph
+ $TRTemp += $TR
+ $TR = $TRTemp
}
} else {
if ($IconDebug) {
$TDSubgraph = '{6} | ' -f $SubgraphPort, $Align, $columnSize, $FontName, $SubgraphLabelFontSize, $FontColor, [string]$SubgraphLabel
-
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp = '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
} else {
$TDSubgraph = '{3} | ' -f $SubgraphPort, $Align, $columnSize, $FormattedSubGraphLabel
+ }
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp = '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
+ if ($SubgraphLabelPos -eq 'down') {
+ $TR += '{0}
' -f $TDSubgraph
+ } else {
+ $TRTemp = '{0}
' -f $TDSubgraph
+ $TRTemp += $TR
+ $TR = $TRTemp
}
}
}
diff --git a/AsBuiltReport.Diagram/Src/Private/Add-HtmlSignatureTable.ps1 b/AsBuiltReport.Diagram/Src/Private/Add-HtmlSignatureTable.ps1
index 63e6ca4..d4191a3 100644
--- a/AsBuiltReport.Diagram/Src/Private/Add-HtmlSignatureTable.ps1
+++ b/AsBuiltReport.Diagram/Src/Private/Add-HtmlSignatureTable.ps1
@@ -222,6 +222,18 @@ function Add-HtmlSignatureTable {
)]
[string]$TableBorderColor = '#000000',
+ [Parameter(
+ Mandatory = $false,
+ HelpMessage = 'Allow to set a table background color'
+ )]
+ [string] $TableBackgroundColor = '#FFFFFF',
+
+ [Parameter(
+ Mandatory = $false,
+ HelpMessage = 'Allow to set a cell background color'
+ )]
+ [string] $CellBackgroundColor = '#FFFFFF',
+
[Parameter(
Mandatory = $false,
HelpMessage = 'Used inside Graphviz to modify the head or tail of an edge, so that the end attaches directly to the object'
@@ -229,54 +241,62 @@ function Add-HtmlSignatureTable {
[string] $Port = 'EdgeDot'
)
- if ($ImagesObj[$Logo]) {
- $ICON = $ImagesObj[$Logo]
- } else { $ICON = $false }
+ $ICON = if ($ImagesObj[$Logo]) { $ImagesObj[$Logo] } else { $null }
+ $ImageSize = $null
if ($ImageSizePercent -lt 100) {
if (-not $IconPath) {
throw 'IconPath is required when ImageSizePercent is less than 100.'
}
+ if (-not $ICON) {
+ throw 'A valid Logo must be resolved from ImagesObj when ImageSizePercent is less than 100.'
+ }
$ImageSize = Get-ImagePercent -ImageInput (Join-Path -Path $IconPath -Child $ICON) -Percent $ImageSizePercent
}
- $TR = ''
- foreach ($Row in $Rows) {
- $FormattedRow = Format-HtmlFontProperty -Text $Row -FontSize $FontSize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName -FontSubscript:$FontSubscript -FontSuperscript:$FontSuperscript -FontStrikeThrough:$FontStrikeThrough -FontOverline:$FontOverline
+ $effectiveFontBold = if ($NoFontBold) { $false } else { $FontBold }
+
+ $fontParams = @{
+ FontSize = $FontSize
+ FontColor = $FontColor
+ FontBold = $effectiveFontBold
+ FontItalic = $FontItalic
+ FontUnderline = $FontUnderline
+ FontName = $FontName
+ FontSubscript = $FontSubscript
+ FontSuperscript = $FontSuperscript
+ FontStrikeThrough = $FontStrikeThrough
+ FontOverline = $FontOverline
+ }
- if ($NoFontBold) {
- $TR += '| {1} |
' -f $Align, $FormattedRow
- } else {
- $TR += '| {1} |
' -f $Align, $FormattedRow
- }
+ $tableParams = @{
+ Port = $Port
+ TableStyle = $TableStyle
+ TableBackgroundColor = $TableBackgroundColor
+ TableBorderColor = $TableBorderColor
+ TableBorder = $TableBorder
+ CellBorder = $CellBorder
+ CellSpacing = $CellSpacing
+ CellPadding = $CellPadding
}
+ $TR = ($Rows | ForEach-Object {
+ $FormattedRow = Format-HtmlFontProperty -Text $_ @fontParams
+ '| {2} |
' -f $CellBackgroundColor, $Align, $FormattedRow
+ }) -join ''
+
if ($ICON) {
if ($IconDebug) {
$TRContent = '| {1} |
{2}' -f $Align, $ICON, $TR
-
- Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorder $TableBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent -CellBorder $CellBorder
+ Format-HtmlTable @tableParams -TableRowContent $TRContent
+ } elseif ($ImageSize) {
+ $TRContent = ' |
{4}' -f $Align, $ImageSize.Width, $ImageSize.Height, $ICON, $TR
+ Format-HtmlTable @tableParams -TableRowContent $TRContent
} else {
- if ($ImageSize) {
- $TRContent = ' |
{4}' -f $Align, $ImageSize.Width, $ImageSize.Height, $ICON, $TR
-
- Format-HtmlTable -TableStyle $TableBorderStyle -TableBorder $TableBorder -TableBorderColor $TableBorderColor -CellBorder 0 -TableRowContent $TRContent
-
- } else {
- $TRContent = ' |
{2}' -f $Align, $ICON, $TR
-
- Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorderColor $TableBorderColor -TableBorder $TableBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent -CellBorder $CellBorder
- }
+ $TRContent = ' |
{2}' -f $Align, $ICON, $TR
+ Format-HtmlTable @tableParams -TableRowContent $TRContent
}
} else {
- if ($IconDebug) {
- $TRContent = $TR
-
- Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorderColor $TableBorderColor -TableBorder $TableBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent -CellBorder $CellBorder
- } else {
- $TRContent = $TR
-
- Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorderColor $TableBorderColor -TableBorder $TableBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent -CellBorder $CellBorder
- }
+ Format-HtmlTable @tableParams -TableRowContent $TR
}
}
\ No newline at end of file
diff --git a/AsBuiltReport.Diagram/Src/Private/Add-HtmlSubGraph.ps1 b/AsBuiltReport.Diagram/Src/Private/Add-HtmlSubGraph.ps1
index 93a6dc2..ed79799 100644
--- a/AsBuiltReport.Diagram/Src/Private/Add-HtmlSubGraph.ps1
+++ b/AsBuiltReport.Diagram/Src/Private/Add-HtmlSubGraph.ps1
@@ -275,6 +275,12 @@ function Add-HtmlSubGraph {
)]
[int] $IconHeight = 40,
+ [Parameter(
+ Mandatory = $false,
+ HelpMessage = 'Path to the directory containing icon image files'
+ )]
+ [string] $IconPath,
+
[Parameter(
Mandatory,
HelpMessage = 'Specifies the name of the node.'
@@ -303,15 +309,14 @@ function Add-HtmlSubGraph {
if ($ImagesObj -and $ImagesObj[$IconType]) {
$Icon = $ImagesObj[$IconType]
- } else { $Icon = $false }
+ } else { $Icon = $null }
# Set the image size if ImageSizePercent is less than 100
- if ($ImageSizePercent -lt 100) {
+ if ($Icon -and $ImageSizePercent -lt 100) {
if (-not $IconPath) {
throw 'IconPath is required when ImageSizePercent is less than 100.'
}
$ImageSize = Get-ImagePercent -ImageInput (Join-Path -Path $IconPath -Child $Icon) -Percent $ImageSizePercent
-
$IconWidth = $ImageSize.Width
$IconHeight = $ImageSize.Height
}
@@ -323,7 +328,6 @@ function Add-HtmlSubGraph {
}
$Number = 0
-
$TD = ''
$TR = ''
while ($Number -ne $Group.Count) {
@@ -335,71 +339,66 @@ function Add-HtmlSubGraph {
$Number++
}
- # Format the name with the specified font properties
- $FormattedLabel = Format-HtmlFontProperty -Text $Label -FontSize $FontSize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName -FontSubscript:$FontSubscript -FontSuperscript:$FontSuperscript -FontStrikeThrough:$FontStrikeThrough -FontOverline:$FontOverline
+ $fontParams = @{
+ FontSize = $FontSize
+ FontColor = $FontColor
+ FontBold = $FontBold
+ FontItalic = $FontItalic
+ FontUnderline = $FontUnderline
+ FontName = $FontName
+ FontSubscript = $FontSubscript
+ FontSuperscript = $FontSuperscript
+ FontStrikeThrough = $FontStrikeThrough
+ FontOverline = $FontOverline
+ }
+ $FormattedLabel = Format-HtmlFontProperty @fontParams -Text $Label
- # This part set the capability to emulate Graphviz Subgraph
- if ($IconDebug) {
- if ($Icon) {
+ # Build subgraph icon/label rows and prepend or append based on LabelPos
+ $TRTemp = ''
+ if ($Icon) {
+ if ($IconDebug) {
$TDSubgraphIcon = '{5} | ' -f $Align, $columnSize, $fontName, $fontColor, $fontSize, $Icon
$TDSubgraph = '{2} | ' -f $Align, $columnSize, $FormattedLabel
-
- if ($LabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraphIcon
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp += '{0}
' -f $TDSubgraphIcon
- $TRTemp += '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
} else {
- $TDSubgraph = '{2} | ' -f $Align, $columnSize, $FormattedLabel
- if ($LabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp = '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
- }
- } else {
- if ($Icon) {
$TDSubgraphIcon = ' | ' -f $Align, $columnSize, $Icon, $IconWidth, $IconHeight
$TDSubgraph = '{2} | ' -f $Align, $columnSize, $FormattedLabel
-
- if ($LabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraphIcon
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp += '{0}
' -f $TDSubgraphIcon
- $TRTemp += '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
+ }
+ if ($LabelPos -eq 'down') {
+ $TR += '{0}
' -f $TDSubgraphIcon
+ $TR += '{0}
' -f $TDSubgraph
} else {
- $TDSubgraph = '{2} | ' -f $Align, $columnSize, $FormattedLabel
- if ($LabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp = '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
+ $TRTemp += '{0}
' -f $TDSubgraphIcon
+ $TRTemp += '{0}
' -f $TDSubgraph
+ $TRTemp += $TR
+ $TR = $TRTemp
+ }
+ } else {
+ $TDSubgraph = '{2} | ' -f $Align, $columnSize, $FormattedLabel
+ if ($LabelPos -eq 'down') {
+ $TR += '{0}
' -f $TDSubgraph
+ } else {
+ $TRTemp = '{0}
' -f $TDSubgraph
+ $TRTemp += $TR
+ $TR = $TRTemp
}
}
+ $tableParams = @{
+ TableStyle = $TableStyle
+ TableBackgroundColor = $TableBackgroundColor
+ CellSpacing = $CellSpacing
+ CellPadding = $CellPadding
+ TableRowContent = $TR
+ }
if ($IconDebug) {
-
- $HTML = Format-HtmlTable -TableStyle $TableStyle -TableBackgroundColor $TableBackgroundColor -TableBorderColor 'red' -CellBorder 1 -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TR
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
-
+ $tableParams.TableBorderColor = 'red'
+ $tableParams.TableBorder = 1
+ $tableParams.CellBorder = 1
} else {
-
- $HTML = Format-HtmlTable -TableBorder $TableBorder -TableStyle $TableStyle -TableBackgroundColor $TableBackgroundColor -TableBorderColor $TableBorderColor -CellBorder $CellBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TR
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
-
+ $tableParams.TableBorderColor = $TableBorderColor
+ $tableParams.TableBorder = $TableBorder
+ $tableParams.CellBorder = $CellBorder
}
+ $HTML = Format-HtmlTable @tableParams
+ Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
\ No newline at end of file
diff --git a/AsBuiltReport.Diagram/Src/Private/Add-HtmlTable.ps1 b/AsBuiltReport.Diagram/Src/Private/Add-HtmlTable.ps1
index e352bda..0009394 100644
--- a/AsBuiltReport.Diagram/Src/Private/Add-HtmlTable.ps1
+++ b/AsBuiltReport.Diagram/Src/Private/Add-HtmlTable.ps1
@@ -402,7 +402,7 @@ function Add-HtmlTable {
## Getting the Subgraph Icon from the ImagesObj Hashtable
if ($ImagesObj -and $ImagesObj[$SubgraphIconType]) {
$SubgraphIcon = $ImagesObj[$SubgraphIconType]
- } else { $SubgraphIcon = $false }
+ } else { $SubgraphIcon = $null }
## This part split the array in groups based on the ColumnSize value
if ($Rows.Count -le 1) {
@@ -411,16 +411,25 @@ function Add-HtmlTable {
$Group = Split-ArrayElement -inArray $Rows -size $ColumnSize
}
- # Index to track the number of rows processed
$Number = 0
-
$TD = ''
$TR = ''
+ $fontParams = @{
+ FontSize = $FontSize
+ FontColor = $FontColor
+ FontBold = $FontBold
+ FontItalic = $FontItalic
+ FontUnderline = $FontUnderline
+ FontName = $FontName
+ FontSubscript = $FontSubscript
+ FontSuperscript = $FontSuperscript
+ FontStrikeThrough = $FontStrikeThrough
+ FontOverline = $FontOverline
+ }
# Create the table and splitting elements based on the ColumnSize value
while ($Number -ne $Group.Count) {
foreach ($Element in $Group[$Number]) {
- $FormattedElement = Format-HtmlFontProperty -Text $Element -FontSize $Fontsize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName -FontSubscript:$FontSubscript -FontSuperscript:$FontSuperscript -FontStrikeThrough:$FontStrikeThrough -FontOverline:$FontOverline
-
+ $FormattedElement = Format-HtmlFontProperty @fontParams -Text $Element
$TD += '{1} | ' -f $ALIGN, $FormattedElement
}
$TR += '{0}
' -f $TD
@@ -430,89 +439,72 @@ function Add-HtmlTable {
# This part set the capability to emulate Graphviz Subgraph
if ($Subgraph) {
- if ($SubGraphLabel) {
- # Get the Formatted Subgraph Label Ex: Label
- $FormattedName = Format-HtmlFontProperty -Text $SubGraphLabel -FontSize $SubgraphLabelFontsize -FontColor $SubgraphFontColor -FontBold:$SubgraphFontBold -FontItalic:$SubgraphFontItalic -FontUnderline:$SubgraphFontUnderline -FontName $SubgraphFontName -FontSubscript:$SubgraphFontSubscript -FontSuperscript:$SubgraphFontSuperscript -FontStrikeThrough:$SubgraphFontStrikeThrough -FontOverline:$SubgraphFontOverline
+ $subgraphFontParams = @{
+ FontSize = $SubgraphLabelFontsize
+ FontColor = $SubgraphFontColor
+ FontBold = $SubgraphFontBold
+ FontItalic = $SubgraphFontItalic
+ FontUnderline = $SubgraphFontUnderline
+ FontName = $SubgraphFontName
+ FontSubscript = $SubgraphFontSubscript
+ FontSuperscript = $SubgraphFontSuperscript
+ FontStrikeThrough = $SubgraphFontStrikeThrough
+ FontOverline = $SubgraphFontOverline
+ }
+ $FormattedName = if ($SubGraphLabel) {
+ Format-HtmlFontProperty @subgraphFontParams -Text $SubGraphLabel
}
+
+ # $TDSubgraph format depends only on $IconDebug, regardless of icon presence
+ $TDSubgraph = if ($IconDebug) {
+ '{2} | ' -f $ALIGN, $columnSize, $FormattedName
+ } else {
+ '{2} | ' -f $ALIGN, $columnSize, $FormattedName
+ }
+
+ $TRTemp = ''
if ($SubgraphIcon) {
if ($IconDebug) {
$TDSubgraphIcon = 'SubGraph Icon | ' -f $ALIGN, $columnSize, $FontName, $FontColor, $SubgraphLabelFontsize
-
- $TDSubgraph = '{2} | ' -f $ALIGN, $columnSize, $FormattedName
-
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraphIcon
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp += '{0}
' -f $TDSubgraphIcon
- $TRTemp += '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
+ } elseif ($SubgraphIconWIDTH -and $SubgraphIconHEIGHT) {
+ $TDSubgraphIcon = ' | ' -f $ALIGN, $columnSize, $SubGraphIconWIDTH, $SubGraphIconHEIGHT, $SubGraphIcon
} else {
- if ($SubgraphIconWIDTH -and $SubgraphIconHEIGHT) {
-
- $TDSubgraphIcon = ' | ' -f $ALIGN, $columnSize, $SubGraphIconWIDTH, $SubGraphIconHEIGHT, $SubGraphIcon
-
- $TDSubgraph = '{2} | ' -f $ALIGN, $columnSize, $FormattedName
-
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraphIcon
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp += '{0}
' -f $TDSubgraphIcon
- $TRTemp += '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
- } else {
-
- $TDSubgraphIcon = ' | ' -f $ALIGN, $columnSize, $SubGraphIcon
-
- $TDSubgraph = '{2} | ' -f $ALIGN, $columnSize, $FormattedName
-
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraphIcon
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp += '{0}
' -f $TDSubgraphIcon
- $TRTemp += '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
- }
+ $TDSubgraphIcon = ' | ' -f $ALIGN, $columnSize, $SubGraphIcon
+ }
+ if ($SubgraphLabelPos -eq 'down') {
+ $TR += '{0}
' -f $TDSubgraphIcon
+ $TR += '{0}
' -f $TDSubgraph
+ } else {
+ $TRTemp += '{0}
' -f $TDSubgraphIcon
+ $TRTemp += '{0}
' -f $TDSubgraph
+ $TRTemp += $TR
+ $TR = $TRTemp
}
} else {
- if ($IconDebug) {
- $TDSubgraph = '{2} | ' -f $ALIGN, $columnSize, $FormattedName
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp = '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
-
+ if ($SubgraphLabelPos -eq 'down') {
+ $TR += '{0}
' -f $TDSubgraph
} else {
- $TDSubgraph = '{2} | ' -f $ALIGN, $columnSize, $FormattedName
- if ($SubgraphLabelPos -eq 'down') {
- $TR += '{0}
' -f $TDSubgraph
- } else {
- $TRTemp = '{0}
' -f $TDSubgraph
- $TRTemp += $TR
- $TR = $TRTemp
- }
+ $TRTemp = '{0}
' -f $TDSubgraph
+ $TRTemp += $TR
+ $TR = $TRTemp
}
}
}
+ $tableParams = @{
+ TableStyle = $SubgraphTableStyle
+ TableBackgroundColor = $TableBackgroundColor
+ CellBorder = $CellBorder
+ CellSpacing = $CellSpacing
+ CellPadding = $CellPadding
+ TableRowContent = $TR
+ }
if ($IconDebug) {
- $HTML = Format-HtmlTable -TableStyle $SubgraphTableStyle -TableBorderColor 'red' -CellBorder $CellBorder -TableRowContent $TR -Cellspacing $CellSpacing -Cellpadding $CellPadding -TableBackgroundColor $TableBackgroundColor
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
+ $tableParams.TableBorderColor = 'red'
} else {
- $HTML = Format-HtmlTable -TableStyle $SubgraphTableStyle -TableBorderColor $TableBorderColor -CellBorder $CellBorder -TableBorder $TableBorder -TableRowContent $TR -Cellspacing $CellSpacing -Cellpadding $CellPadding -TableBackgroundColor $TableBackgroundColor
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
+ $tableParams.TableBorderColor = $TableBorderColor
+ $tableParams.TableBorder = $TableBorder
}
+ $HTML = Format-HtmlTable @tableParams
+ Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
\ No newline at end of file
diff --git a/AsBuiltReport.Diagram/Src/Private/Add-NodeIcon.ps1 b/AsBuiltReport.Diagram/Src/Private/Add-NodeIcon.ps1
index 10374c0..d1f1e99 100644
--- a/AsBuiltReport.Diagram/Src/Private/Add-NodeIcon.ps1
+++ b/AsBuiltReport.Diagram/Src/Private/Add-NodeIcon.ps1
@@ -357,7 +357,7 @@ function Add-NodeIcon {
} else { $ICON = 'no_icon.png' }
# Set the image size if ImageSizePercent is less than 100
- if ($ImageSizePercent -lt 100) {
+ if ($ICON -ne 'NoIcon' -and $ImageSizePercent -lt 100) {
if (-not $IconPath) {
throw 'IconPath is required when ImageSizePercent is less than 100.'
}
@@ -365,93 +365,68 @@ function Add-NodeIcon {
}
# Process additionalinfo if provided
+ $TRAditionalInfo = ''
if ($AditionalInfo) {
- $TRAditionalInfo = @()
- switch ($AditionalInfo.GetType().Name) {
- 'Hashtable' {
- foreach ($r in $AditionalInfo) {
- [string]$TRAditionalInfo += $r.getEnumerator() | ForEach-Object {
- '| {4}: {5} |
' -f $_.Key, $CellBackgroundColor, $Align, $FontSize, $_.Key, $_.Value
- }
- }
- }
-
- 'OrderedDictionary' {
- foreach ($r in $AditionalInfo) {
- [string]$TRAditionalInfo += $r.getEnumerator() | ForEach-Object {
- '| {4}: {5} |
' -f $_.Key, $CellBackgroundColor, $Align, $FontSize, $_.Key, $_.Value
- }
- }
- }
-
- 'PSCustomObject' {
- foreach ($r in $AditionalInfo) {
- [string]$TRAditionalInfo += $r.PSObject.Properties | ForEach-Object {
- '| {4}: {5} |
' -f $_.Name, $CellBackgroundColor, $Align, $FontSize, $_.Name, $_.Value
- }
- }
- }
-
- 'Object[]' {
- foreach ($r in $AditionalInfo) {
- [string]$TRAditionalInfo += $r.PSObject.Properties | ForEach-Object {
- '| {4}: {5} |
' -f $_.Name, $CellBackgroundColor, $Align, $FontSize, $_.Name, $_.Value
- }
- }
+ $isPSCustomObj = $AditionalInfo.GetType().Name -in 'PSCustomObject', 'Object[]'
+ foreach ($r in $AditionalInfo) {
+ $entries = if ($isPSCustomObj) { $r.PSObject.Properties } else { $r.getEnumerator() }
+ [string]$TRAditionalInfo += $entries | ForEach-Object {
+ $key = if ($isPSCustomObj) { $_.Name } else { $_.Key }
+ '| {4}: {5} |
' -f $key, $CellBackgroundColor, $Align, $FontSize, $key, $_.Value
}
}
}
- # Determine FontBold based on NoFontBold switch
- if ($NoFontBold) {
- $FontBold = $false
- } else {
- $FontBold = $true
- }
+ $FontBold = -not $NoFontBold
if (-not $LabelName) {
$LabelName = $Name
}
- # Format the name with the specified font properties
- $FormattedName = Format-HtmlFontProperty -Text $LabelName -FontSize $FontSize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName -FontSubscript:$FontSubscript -FontSuperscript:$FontSuperscript -FontStrikeThrough:$FontStrikeThrough -FontOverline:$FontOverline
-
+ $fontParams = @{
+ Text = $LabelName
+ FontSize = $FontSize
+ FontColor = $FontColor
+ FontBold = $FontBold
+ FontItalic = $FontItalic
+ FontUnderline = $FontUnderline
+ FontName = $FontName
+ FontSubscript = $FontSubscript
+ FontSuperscript = $FontSuperscript
+ FontStrikeThrough = $FontStrikeThrough
+ FontOverline = $FontOverline
+ }
+ $FormattedName = Format-HtmlFontProperty @fontParams
+
+ $tableParams = @{
+ Port = $Port
+ TableStyle = $TableStyle
+ TableBorderColor = $TableBorderColor
+ TableBorder = $TableBorder
+ CellBorder = $CellBorder
+ CellSpacing = $CellSpacing
+ CellPadding = $CellPadding
+ TableBackgroundColor = $TableBackgroundColor
+ }
if ($IconDebug) {
if ($ICON -ne 'NoIcon') {
$TRContent = '| {5} |
| {7} |
{8}' -f $Align, $TDProperties, $FontName, $FontColor, $FontSize, $ICON, $CellBackgroundColor, $FormattedName, $TRAditionalInfo
-
- $HTML = Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorderColor 'red' -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
} else {
$TRContent = ' |
| {3} |
{4}' -f $Align, $TDProperties, $CellBackgroundColor, $FormattedName, $TRAditionalInfo
-
- $HTML = Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorderColor 'red' -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
+ $HTML = Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorderColor 'red' -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent
} else {
if ($ICON -ne 'NoIcon') {
if ($ImageSize) {
$TRContent = ' |
| {6} |
{7}' -f $Align, $ImageSize.Width, $ImageSize.Height, $TDProperties, $ICON, $CellBackgroundColor, $FormattedName, $TRAditionalInfo
-
- $HTML = Format-HtmlTable -Port $Port -TableStyle $TableStyle -Tableborder $TableBorder -TableBorderColor $TableBorderColor -TableRowContent $TRContent -CellBorder $CellBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableBackgroundColor $TableBackgroundColor
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
} else {
$TRContent = ' |
| {4} |
{5}' -f $Align, $TDProperties, $ICON, $CellBackgroundColor, $FormattedName, $TRAditionalInfo
-
- $HTML = Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorderColor $TableBorderColor -TableRowContent $TRContent -TableBorder $TableBorder -CellBorder $CellBorder -CellSpacing $CellSpacing -CellPadding $CellPadding -TableBackgroundColor $TableBackgroundColor
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
} else {
$TRContent = ' | | {3} |
{4}' -f $Align, $TDProperties, $CellBackgroundColor, $FormattedName, $TRAditionalInfo
-
- $HTML = Format-HtmlTable -Port $Port -TableStyle $TableStyle -TableBorderColor $TableBorderColor -TableRowContent $TRContent -TableBackgroundColor $TableBackgroundColor -TableBorder $TableBorder -CellBorder $CellBorder -CellSpacing $CellSpacing -CellPadding $CellPadding
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
+ $HTML = Format-HtmlTable @tableParams -TableRowContent $TRContent
}
+ Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
\ No newline at end of file
diff --git a/AsBuiltReport.Diagram/Src/Private/Add-NodeImage.ps1 b/AsBuiltReport.Diagram/Src/Private/Add-NodeImage.ps1
index 62f1ccf..170fd22 100644
--- a/AsBuiltReport.Diagram/Src/Private/Add-NodeImage.ps1
+++ b/AsBuiltReport.Diagram/Src/Private/Add-NodeImage.ps1
@@ -173,6 +173,7 @@ function Add-NodeImage {
Set-ImageOpacity -SourceImageFilePath $sourcePath -OutputImageFilePath $IconSrc -Opacity $ImageOpacityPercent | Out-Null
}
+ $ImageSize = $null
if ($ImageSizePercent -lt 100) {
if (-not $IconPath) {
throw 'IconPath is required when ImageSizePercent is less than 100.'
@@ -182,26 +183,22 @@ function Add-NodeImage {
if ($IconDebug) {
$TRContent = '| {1} |
' -f 'SOLID', $ICON
-
- $HTML = Format-HtmlTable -TableBackgroundColor '#FFCCCC' -TableBorderColor 'red' -CellBorder 0 -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
+ $HTML = Format-HtmlTable -TableBackgroundColor '#FFCCCC' -TableBorderColor 'red' -CellBorder 0 -CellSpacing 0 -CellPadding 0 -TableRowContent $TRContent
} else {
+ $tableParams = @{
+ TableStyle = $TableBorderStyle
+ TableBorder = $TableBorder
+ TableBackgroundColor = $TableBackgroundColor
+ TableBorderColor = $TableBorderColor
+ CellBorder = 0
+ }
if ($ImageSize) {
-
$TRContent = ' |
' -f $TableBorderStyle, $ImageSize.Width, $ImageSize.Height, $IconSrc
-
- $HTML = Format-HtmlTable -TableStyle $TableBorderStyle -TableBorder $TableBorder -TableBackgroundColor $TableBackgroundColor -TableBorderColor $TableBorderColor -CellBorder 0 -TableRowContent $TRContent
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
} else {
-
$TRContent = ' |
' -f $TableBorderStyle, $IconSrc
-
- $HTML = Format-HtmlTable -TableStyle $TableBorderStyle -TableBorder $TableBorder -TableBackgroundColor $TableBackgroundColor -TableBorderColor $TableBorderColor -CellBorder 0 -TableRowContent $TRContent
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
+ $HTML = Format-HtmlTable @tableParams -TableRowContent $TRContent
}
+ Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
\ No newline at end of file
diff --git a/AsBuiltReport.Diagram/Src/Private/Add-NodeText.ps1 b/AsBuiltReport.Diagram/Src/Private/Add-NodeText.ps1
index 7320864..eee77d0 100644
--- a/AsBuiltReport.Diagram/Src/Private/Add-NodeText.ps1
+++ b/AsBuiltReport.Diagram/Src/Private/Add-NodeText.ps1
@@ -186,21 +186,24 @@ function Add-NodeText {
throw 'TableBorderStyle must be specified when TableBorderColor is used.'
}
- $FormattedText = Format-HtmlFontProperty -Text $Text -FontSize $FontSize -FontColor $FontColor -FontBold:$FontBold -FontItalic:$FontItalic -FontUnderline:$FontUnderline -FontName $FontName
+ $fontParams = @{
+ Text = $Text
+ FontSize = $FontSize
+ FontColor = $FontColor
+ FontBold = $FontBold
+ FontItalic = $FontItalic
+ FontUnderline = $FontUnderline
+ FontName = $FontName
+ }
+ $FormattedText = Format-HtmlFontProperty @fontParams
if ($IconDebug) {
$TRContent = '| {2} |
' -f 'SOLID', $TextAlign, $FormattedText
-
$HTML = Format-HtmlTable -TableBackgroundColor '#FFCCCC' -TableBorderColor 'red' -CellBorder 0 -TableRowContent $TRContent
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
-
} else {
$TRContent = '| {2} |
' -f $TableBorderStyle, $TextAlign, $FormattedText
-
$HTML = Format-HtmlTable -TableStyle $TableBorderStyle -TableBorder $TableBorder -TableBorderColor $TableBorderColor -TableBackgroundColor $TableBackgroundColor -CellBorder 0 -TableRowContent $TRContent
-
- Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
+ Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject)
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e963a38..f4cbb6c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [1.0.7] - Unreleased
+
+### :arrows_clockwise: Changed
+
+- Update module version to v1.0.7
+- Enhance Add-HtmlSignatureTable with background color parameters
+- refactor: streamline Add-HtmlSignatureTable function and improve logo handling
+- refactor: optimize Add-HtmlLabel function for improved readability and maintainability
+- refactor: simplify AditionalInfo handling and consolidate font parameter usage in Add-HtmlNodeTable function
+- refactor: add IconPath parameter and improve icon handling in Add-HtmlSubGraph function
+- refactor: streamline font parameter handling and improve subgraph icon logic in Add-HtmlTable function
+- refactor: enhance icon handling and streamline additional info processing in Add-NodeIcon function
+- refactor: optimize HTML table generation and streamline parameter handling in Add-NodeImage function
+- refactor: streamline font parameter handling in Add-NodeText function
+
+### :wrench: Fixed
+
+- Fix duplicate pester test names in AdvancedExample02.Tests tests
+
## [1.0.6] - 2026-04-23
### :arrows_clockwise: Changed
diff --git a/Tests/Add-HtmlSignatureTable.Tests.ps1 b/Tests/Add-HtmlSignatureTable.Tests.ps1
index b9519c8..f2cf9fd 100644
--- a/Tests/Add-HtmlSignatureTable.Tests.ps1
+++ b/Tests/Add-HtmlSignatureTable.Tests.ps1
@@ -18,9 +18,9 @@ Describe Add-HtmlSignatureTable {
}
It 'Should return a multiple column HTML table with an Logo' {
- $HTMLSignaturewithLogo | Should -BeExactly ' |
| Jonathan Colon |
| Zen PR Solutions |
'
+ $HTMLSignaturewithLogo | Should -BeExactly ' |
| Jonathan Colon |
| Zen PR Solutions |
'
}
It 'Should return a multiple column HTML table with an Logo in Debug Mode' {
- $HTMLSignaturewithLogoDebug | Should -BeExactly '| AsBuiltReport.png |
| Jonathan Colon |
| Zen PR Solutions |
'
+ $HTMLSignaturewithLogoDebug | Should -BeExactly '| AsBuiltReport.png |
| Jonathan Colon |
| Zen PR Solutions |
'
}
}
\ No newline at end of file
diff --git a/Tests/AdvancedExample02.Tests.ps1 b/Tests/AdvancedExample02.Tests.ps1
index 9098ce0..818c42e 100644
--- a/Tests/AdvancedExample02.Tests.ps1
+++ b/Tests/AdvancedExample02.Tests.ps1
@@ -113,7 +113,7 @@ Describe AdvancedExample02 {
}
}
- Context 'Graphviz Dot Node Icon (Label) Tests' {
+ Context 'Graphviz Dot Node Icon (Label) Tests - Web-Server Nodes' {
It 'Should match HTML label Web-Server-01 node with embedded image' {
$DotFile = ($RunFile).FullName
$DotContent = Get-Content -Path $DotFile -Raw
@@ -193,7 +193,7 @@ Describe AdvancedExample02 {
}
}
- Context 'Graphviz Dot Node Icon (Label) Tests' {
+ Context 'Graphviz Dot Node Icon (Label) Tests - Info-Box Nodes' {
It 'Should match HTML label Info-Box node with embedded image' {
$DotFile = ($RunFile).FullName
$DotContent = Get-Content -Path $DotFile -Raw