Skip to content

Commit 4c506a5

Browse files
dhilmathyKeboo
authored andcommitted
Fix for mising styles in Wiki MarkDown (#1309)
1 parent a0b77de commit 4c506a5

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Scripts/GenerateThemesWikiMarkdown.ps1

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Function Main {
2424

2525
Function Format-Output {
2626
Write-OutputFile "[//]: <> (AUTO GENERATED FILE; DO NOT EDIT)"
27-
foreach($style in $discoverdStyles | Sort-Object -Property Control,@{Expression = {$_.IsDefault}; Ascending = $false}) {
27+
foreach($style in $discoverdStyles | Sort-Object -Property File,@{Expression = {$_.IsDefault}; Ascending = $false}) {
2828
if ($previousFile -ne $style.File) {
2929
Write-OutputFile "`n$headerMarkdown $($style.File)"
3030
}
@@ -46,18 +46,17 @@ Function Write-OutputFile{
4646
}
4747

4848
Function Set-Defaults{
49-
$remainingDefaults = New-Object System.Collections.ArrayList
5049
ForEach ($default in $defaults) {
51-
$style = $discoverdStyles.Where({$_.style -match $default.style})
50+
$style = $discoverdStyles.Where({$_.style -match $default.style -and $_.Control -match $default.Type})
5251
if ($null -ne $style[0]) {
5352
$style[0].IsDefault = $true
5453
}
55-
else {
56-
$remainingDefaults.Add($default)
54+
else {
55+
$temp = Get-Style -targetType $default.Type -styleName $default.Style -fileName $default.Type
56+
$discoverdStyles.Add($temp) | Out-Null
5757
}
5858
}
5959
$discoverdStyles | Format-Table #debug
60-
$remainingDefaults | Format-Table #debug
6160
}
6261

6362
Function Select-ControlNameFromFile {
@@ -68,8 +67,9 @@ Function Select-ControlNameFromFile {
6867
Function Read-XamlStyles {
6968
Param ($xamlString, $file)
7069
[xml]$xaml = $xamlString
71-
$xaml.selectNodes("//*") | Where-Object {$_.LocalName -eq "Style"} |
70+
$xaml.ResourceDictionary.Style |
7271
Foreach-Object {
72+
Write-Output $_
7373
if ($file -eq "Defaults") {
7474
# Special handeling of Defaults
7575
New-Default -style $_ -file $file
@@ -121,13 +121,19 @@ Function New-Style {
121121
}
122122

123123
Function Add-Style {
124+
Param ($targetType, $styleName, $fileName)
125+
$temp = Get-Style -targetType $targetType -styleName $styleName -fileName $file
126+
$discoverdStyles.Add($temp) | Out-Null
127+
}
128+
129+
Function Get-Style {
124130
Param ($targetType, $styleName, $fileName)
125131
$temp = "" | Select-Object "Control", "Style", "IsDefault", "File"
126132
$temp.Control = $targetType
127133
$temp.Style = $styleName
128134
$temp.IsDefault = !$styleName
129135
$temp.File = $fileName
130-
$discoverdStyles.Add($temp) | Out-Null
136+
return $temp
131137
}
132138

133139
Function Add-DefaultStyle {

0 commit comments

Comments
 (0)