Skip to content

Commit 2375d97

Browse files
committed
Updates example script
1 parent c57fd8d commit 2375d97

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/ImportExamples.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ function Get-ExternalDocsUrl {
182182
}
183183
if (-not([string]::IsNullOrEmpty($ExternalDocUrl))) {
184184
Start-WebScrapping -GraphProfile $GraphProfile -ExternalDocUrl $ExternalDocUrl -Command $Command -GraphProfilePath $GraphProfilePath -UriPath $UriPath -Module $Module
185+
}else{
186+
# This step will still correct the examples if the external docs url is not found
187+
$ExampleFile = "$GraphProfilePath/$Command.md"
188+
Retain-ExistingCorrectExamples -Content (Get-Content $ExampleFile) -File $ExampleFile -CommandPattern $Command
185189
}
186190
}
187191

@@ -510,9 +514,9 @@ function Retain-ExistingCorrectExamples {
510514
$TitleCount = 1
511515
$RetainedContent = $null
512516
foreach ($Ex in $RetainedExamples) {
513-
$ContentBody = $Ex.Split("|")[0]
514-
$ContentTitle = $Ex.Split("|")[1]
515-
$ContentDescription = $Ex.Split("|")[2]
517+
$ContentBody = $Ex.Split("**##@**")[0]
518+
$ContentTitle = $Ex.Split("**##@**")[1]
519+
$ContentDescription = $Ex.Split("**##@**")[2]
516520
if ($ContentBody -match "\b$CommandPattern\b") {
517521
$Val = $ContentTitle.Split("### Example ")
518522
$ToBeReplaced = $Val[1].Substring(0, 1)
@@ -569,7 +573,7 @@ function Get-ExistingCorrectExamples {
569573
$DescVal = $Content[$j]
570574
$RetainedDescription += "$DescVal`n"
571575
}
572-
$RetainedExamples.Add("$ContentBlock|$Title|$RetainedDescription")
576+
$RetainedExamples.Add("$ContentBlock**##@**$Title**##@**$RetainedDescription")
573577
if ($NoOfExamples -gt 1) {
574578
$NoOfExamples--
575579
for ($k = $Start; $k -lt $End; $k++) {

0 commit comments

Comments
 (0)