forked from flcdrg/au-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-helper.ps1
55 lines (42 loc) · 1.29 KB
/
update-helper.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Parsing code from original package. Not used in AU package yet.
function Parse-ReleaseNotes()
{
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$response = Invoke-WebRequest -Uri https://www.scootersoftware.com/download.php?zz=v4changelog
$html = $response.ParsedHtml
$heading2 = $html.getElementsByTagName("h2");
$h2 = $heading2[0]
$secondH2 = $heading2[1]
"#### " + $h2.innerText
foreach ($child in $h2.parentElement.children)
{
if ($child -eq $h2) {
continue;
}
if ($child -eq $secondH2) {
break;
}
$prefix = ""
$suffix = ""
if ($child.nodeName -eq "h2")
{
$prefix = "`n`r#### "
$suffix = "`n`r"
}
if ($child.nodeName -eq "h4")
{
$prefix = "`n`r##### "
$suffix = "`n`r"
}
if ($child.nodeName -eq "ul")
{
foreach ($li in $child.children)
{
$s = $li.innerHTML -replace "<strong>", "**" -replace "</strong>", "**" -replace "</?code>", "``"
"* " + $s
}
} else {
$prefix + $child.innerText + $suffix
}
}
}