Skip to content

Commit 27dd64b

Browse files
committed
Update latest_notes.ps1
1 parent 095471c commit 27dd64b

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

latest-notes.ps1

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,47 @@
11
Set-PSDebug -Strict
22

33
$saveEncode = $null
4-
if ([Console]::IsOutputRedirected) {
4+
if ([Console]::IsOutputRedirected ) {
55
$saveEncode = [System.Console]::OutputEncoding
66
[System.Console]::OutputEncoding=[System.Text.Encoding]::UTF8
77
}
88

9-
Get-ChildItem "release_note*" | Sort-Object { Format-Hex -InputObject $_.Name } | ForEach-Object{
9+
$blanklines = $null
10+
Get-ChildItem "release_note*.md" -Recurse | Sort-Object { Format-Hex -InputObject $_.FullName } | ForEach-Object{
1011
$lang = "(English)"
1112
if ( $_.FullName -like "*ja*" ) {
1213
$lang = "(Japanese)"
1314
}
1415
$flag = 0
1516
$section = 0
1617
Get-Content $_.FullName | ForEach-Object {
17-
if ( $_ -match "^v[0-9]+\.[0-9]+\.[0-9]+$" ){
18+
if ( $_ -match "^v?[0-9]+\.[0-9]+\.[0-9]+" ){
1819
$flag++
1920
if ( $flag -eq 1 ){
20-
Write-Host ("`r`n### Changes in {0} in {1}" -f ($_,$lang))
21+
Write-Output ""
22+
Write-Output ("### Changes in {0} in {1}" -f ($_,$lang))
2123
}
2224
} elseif ($flag -eq 1 ){
2325
if ( $_ -eq "" ){
2426
$section++
2527
}
26-
if ( $section % 2 -eq 1 ){
27-
Write-Host $_
28+
if ( $section -ge 1 ){
29+
Write-Output $_
2830
}
2931
}
3032
}
33+
} | ForEach-Object {
34+
if ( $_ -match "^\s*$" ){
35+
if ( $blanklines -ne $null ){
36+
$blanklines = $true
37+
}
38+
} else {
39+
if ( $blanklines ){
40+
Write-Output ""
41+
}
42+
Write-Output $_
43+
$blanklines = $false
44+
}
3145
}
3246

3347
if ( $saveEncode -ne $null ){

0 commit comments

Comments
 (0)