@@ -45,46 +45,39 @@ Function New-HTML {
45
45
$FooterHTML = @ ()
46
46
47
47
48
- $MainHTML = foreach ($_ in $TempOutputHTML ) {
49
- if ($_ -is [PSCustomObject ]) {
50
- if ($_.Type -eq ' Footer' ) {
51
- $FooterHTML = $_.Output
52
- } elseif ($_.Type -eq ' Header' ) {
53
- $HeaderHTML = $_.Output
48
+ $MainHTML = foreach ($ObjectTemp in $TempOutputHTML ) {
49
+ if ($ObjectTemp -is [PSCustomObject ]) {
50
+ if ($ObjectTemp.Type -eq ' Footer' ) {
51
+ $FooterHTML = foreach ($_ in $ObjectTemp.Output ) {
52
+ # this gets rid of any non-strings
53
+ # it's added here to track nested tabs
54
+ if ($_ -isnot [System.Collections.IDictionary ]) { $_ }
55
+ }
56
+ } elseif ($ObjectTemp.Type -eq ' Header' ) {
57
+ $HeaderHTML = foreach ($_ in $ObjectTemp.Output ) {
58
+ # this gets rid of any non-strings
59
+ # it's added here to track nested tabs
60
+ if ($_ -isnot [System.Collections.IDictionary ]) { $_ }
61
+ }
54
62
} else {
55
- if ($_.Output ) {
56
- # this gets rid of any non-strings
57
- # it's added here to track nested tabs
58
- if ($_.Output -isnot [System.Collections.IDictionary ]) {
59
- $_.Output
63
+ if ($ObjectTemp.Output ) {
64
+ # this gets rid of any non-strings
65
+ # it's added here to track nested tabs
66
+ foreach ($SubObject in $ObjectTemp.Output ) {
67
+ if ($SubObject -isnot [System.Collections.IDictionary ]) {
68
+ $SubObject
69
+ }
60
70
}
61
71
}
62
72
}
63
73
} else {
64
- # this gets rid of any non-strings
65
- # it's added here to track nested tabs
66
- if ($_ -isnot [System.Collections.IDictionary ]) {
67
- $_
74
+ # this gets rid of any non-strings
75
+ # it's added here to track nested tabs
76
+ if ($ObjectTemp -isnot [System.Collections.IDictionary ]) {
77
+ $ObjectTemp
68
78
}
69
79
}
70
80
}
71
- <#
72
- if ($MainHTML.Count -eq 0) {
73
- # this gets rid of any non-strings
74
- # it's added here to track nested tabs
75
- $MainHTML = foreach ($_ in $MainHTML) {
76
- if ($_ -isnot [System.Collections.IDictionary]) {
77
- $_
78
- }
79
- }
80
- } else {
81
- $MainHTML = foreach ($_ in $MainHTML) {
82
- if ($_ -isnot [System.Collections.IDictionary]) {
83
- $_
84
- }
85
- }
86
- }
87
- #>
88
81
89
82
$Features = Get-FeaturesInUse - PriorityFeatures ' JQuery' , ' DataTables' , ' Tabs'
90
83
@@ -109,30 +102,28 @@ Function New-HTML {
109
102
New-HTMLTag - Tag ' meta' - Attributes @ { name = ' revised' ; content = $CurrentDate } - SelfClosing
110
103
New-HTMLTag - Tag ' title' { $TitleText }
111
104
112
- if ($null -ne $FavIcon ){
105
+ if ($null -ne $FavIcon ) {
113
106
$Extension = [System.IO.Path ]::GetExtension($FavIcon )
114
107
if ($Extension -in @ (' .png' , ' .jpg' , ' jpeg' , ' .svg' , ' .ico' )) {
115
- switch ($FavIcon.Scheme ){
108
+ switch ($FavIcon.Scheme ) {
116
109
" file" {
117
- if (Test-Path - Path $FavIcon.OriginalString ){
110
+ if (Test-Path - Path $FavIcon.OriginalString ) {
118
111
$FavIcon = Get-Item - Path $FavIcon.OriginalString
119
112
$FavIconImageBinary = Convert-ImageToBinary - ImageFile $FavIcon
120
- New-HTMLTag - Tag ' link' - Attributes @ {rel = ' icon' ; href = " $FavIconImageBinary " ; type = ' image/x-icon' }
121
- }
122
- else {
113
+ New-HTMLTag - Tag ' link' - Attributes @ {rel = ' icon' ; href = " $FavIconImageBinary " ; type = ' image/x-icon' }
114
+ } else {
123
115
Write-Warning - Message " The path to the FavIcon image could not be resolved."
124
116
}
125
117
}
126
118
" https" {
127
119
$FavIcon = $FavIcon.OriginalString
128
- New-HTMLTag - Tag ' link' - Attributes @ {rel = ' icon' ; href = " $FavIcon " ; type = ' image/x-icon' }
120
+ New-HTMLTag - Tag ' link' - Attributes @ {rel = ' icon' ; href = " $FavIcon " ; type = ' image/x-icon' }
129
121
}
130
122
default {
131
123
Write-Warning - Message " The path to the FavIcon image could not be resolved."
132
124
}
133
125
}
134
- }
135
- else {
126
+ } else {
136
127
Write-Warning - Message " File extension `' $Extension `' is not supported as a FavIcon image.`n Please use images with these extensions: '.png', '.jpg', 'jpeg', '.svg', '.ico'"
137
128
}
138
129
}
0 commit comments