Skip to content

Commit 6db17e6

Browse files
committed
Changed separator
1 parent 29b9992 commit 6db17e6

File tree

4 files changed

+87
-148
lines changed

4 files changed

+87
-148
lines changed

microsoftgraph/graph-powershell-1.0/Microsoft.Graph.Identity.SignIns/New-MgIdentityProvider.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,16 @@ $params = @{
6565
developerId = "UBF8T346G9"
6666
serviceId = "com.microsoft.rts.b2c.test.client"
6767
keyId = "99P6D879C4"
68-
certificateData = "### Example 2: Retrieves Apple identity provider (only for Azure AD B2C)
69-
```
68+
certificateData = "******"
69+
}
70+
71+
New-MgIdentityProvider -BodyParameter $params
72+
```
73+
This example shows how to use the New-MgIdentityProvider Cmdlet.
74+
75+
To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference).
76+
77+
7078
## PARAMETERS
7179

7280
### -AdditionalProperties

microsoftgraph/graph-powershell-beta/Microsoft.Graph.Beta.Identity.SignIns/New-MgBetaIdentityProvider.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,16 @@ $params = @{
8888
developerId = "UBF8T346G9"
8989
serviceId = "com.microsoft.rts.b2c.test.client"
9090
keyId = "99P6D879C4"
91-
certificateData = "### Example 3: Retrieves Apple identity provider (only for Azure AD B2C)
92-
```
91+
certificateData = "******"
92+
}
93+
94+
New-MgBetaIdentityProvider -BodyParameter $params
95+
```
96+
This example shows how to use the New-MgBetaIdentityProvider Cmdlet.
97+
98+
To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference).
99+
100+
93101
## PARAMETERS
94102

95103
### -AdditionalProperties

scripts/RepairDescriptions.ps1

Lines changed: 64 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,13 @@
1-
# Copyright (c) Microsoft Corporation. All rights reserved.
2-
# Licensed under the MIT License.
3-
Param(
4-
$ModulesToGenerate = @(),
5-
[string] $ModuleMappingConfigPath = (Join-Path $PSScriptRoot "../../msgraph-sdk-powershell/config/ModulesMapping.jsonc"),
6-
[string] $SDKDocsPath = (Join-Path $PSScriptRoot "../../msgraph-sdk-powershell/src"),
7-
[string] $WorkLoadDocsPath = (Join-Path $PSScriptRoot "../microsoftgraph")
8-
)
9-
function Get-GraphMapping {
10-
$graphMapping = @{}
11-
$graphMapping.Add("v1.0", "v1.0")
12-
$graphMapping.Add("beta", "beta")
13-
return $graphMapping
14-
}
15-
16-
function Start-Copy {
17-
Param(
18-
$ModulesToGenerate = @()
19-
)
20-
21-
$ModulePrefix = "Microsoft.Graph"
22-
$GraphMapping = Get-GraphMapping
23-
$GraphMapping.Keys | ForEach-Object {
24-
$graphProfile = $_
25-
$profilePath = "graph-powershell-1.0"
26-
if($graphProfile -eq "beta"){
27-
$profilePath = "graph-powershell-beta"
28-
}
29-
Get-FilesByProfile -GraphProfile $graphProfile -GraphProfilePath $profilePath -ModulePrefix $ModulePrefix -ModulesToGenerate $ModulesToGenerate
30-
}
31-
git config --global user.email "[email protected]"
32-
git config --global user.name "Timothy Wamalwa"
33-
git add .
34-
git commit -m "Corrected titles"
35-
}
36-
function Get-FilesByProfile{
37-
Param(
38-
[ValidateSet("beta", "v1.0")]
39-
[string] $GraphProfile = "v1.0",
40-
[ValidateNotNullOrEmpty()]
41-
[string] $GraphProfilePath = "graph-powershell-1.0",
42-
[ValidateNotNullOrEmpty()]
43-
[string] $ModulePrefix = "Microsoft.Graph",
44-
[ValidateNotNullOrEmpty()]
45-
$ModulesToGenerate = @()
46-
)
47-
48-
$ModulesToGenerate | ForEach-Object {
49-
$ModuleName = $_
50-
$docs = Join-Path $SDKDocsPath $ModuleName $GraphProfile "examples"
51-
Copy-Files -DocPath $docs -GraphProfilePath $GraphProfilePath -Module $ModuleName -ModulePrefix $ModulePrefix -GraphProfile $GraphProfile
52-
}
53-
54-
}
55-
function Copy-Files{
56-
param(
57-
[ValidateSet("beta", "v1.0")]
58-
[string] $GraphProfile = "v1.0",
59-
[ValidateNotNullOrEmpty()]
60-
[string] $GraphProfilePath = "graph-powershell-1.0",
61-
[ValidateNotNullOrEmpty()]
62-
[string] $Module = "Users",
63-
[ValidateNotNullOrEmpty()]
64-
[string] $ModulePrefix = "Microsoft.Graph",
65-
[ValidateNotNullOrEmpty()]
66-
[string] $DocPath = "..\msgraph-sdk-powershell\src\Users\v1.0\examples"
67-
)
68-
$Path = "$ModulePrefix.$ModuleName"
69-
if($GraphProfile -eq 'beta'){
70-
$Path = "$ModulePrefix.Beta.$ModuleName"
71-
}
72-
$Destination = Join-Path $WorkLoadDocsPath $GraphProfilePath $Path
73-
74-
if ((Test-Path $DocPath)) {
75-
76-
foreach ($File in Get-ChildItem $DocPath) {
77-
# Read the content of the file searching for example headers.
78-
$Command = [System.IO.Path]::GetFileName($File)
79-
$content = Get-Content -Path $File
80-
$DestinationFile = Join-Path $Destination $Command
81-
$Content = Get-Content -Path $File
82-
Import-Descriptions -Content $Content -File $DestinationFile
83-
84-
}
85-
86-
}
87-
}
881
function Import-Descriptions {
892
Param (
903
[object]$Content,
914
[string]$File
925
)
6+
$SearchBlock = "## EXAMPLES(?s).*## PARAMETERS"
7+
$SearchBlock2 = "## DESCRIPTION(?s).*## PARAMETERS"
8+
$option = [System.Text.RegularExpressions.RegexOptions]::Multiline
9+
$Re = [regex]::new($SearchBlock, $option)
10+
$Re2 = [regex]::new($SearchBlock2, $option)
9311
$RetainedExamples = New-Object Collections.Generic.List[string]
9412
$End = 0
9513
$NoOfExamples = 0
@@ -99,45 +17,65 @@ function Import-Descriptions {
9917
}
10018
$End++
10119
}
20+
Write-Host "Importing descriptions $NoOfExamples"
10221
Get-ExistingDescriptions -Content $Content -File $File -start 0 -end $End -NoOfExamples $NoOfExamples
22+
if(Test-Path $File){
10323
$TitleCount = 1
104-
$DestinationContent = Get-Content -Path $File
105-
$DestContentCount = 0
106-
foreach($DestContent in $DestinationContent){
107-
$DestContentCount++
108-
}
24+
$DestinationContent = Get-Content -Encoding UTF8 -Raw $File
25+
$RetainedContent = $null
10926
foreach ($Ex in $RetainedExamples) {
110-
$ContentDescription = $Ex
111-
if(-not($ContentDescription.Contains(" Add description here"))){
112-
113-
$NextExampleCount = $TitleCount + 1
114-
if($RetainedExamples.Count -gt 1){
115-
for($m = 0; $m -lt $DestContentCount; $m++){
116-
if($DestinationContent[$m].Contains("### Example $NextExampleCount")){
117-
118-
$NewContentBlockWithDescription = $ContentDescription + "`n" + $DestinationContent[$m]
119-
120-
(Get-Content $File) |
121-
Foreach-Object { $_ -replace $DestinationContent[$m], $NewContentBlockWithDescription } |
122-
Out-File $File
123-
124-
}
125-
126-
127-
}
128-
}
129-
130-
27+
$ContentBody = $Ex.Split("**##@**")[0]
28+
$ContentDescription = $Ex.Split("**##@**")[2]
29+
$RetainedContent += "$ContentBody$ContentDescription"
13130
$TitleCount++
132-
}
31+
13332
}
134-
#Replace the last param with description of the last example
135-
$LastExampleDescription = $RetainedExamples[$RetainedExamples.Count - 1] + "`n## PARAMETERS"
136-
if(-not($RetainedExamples[$RetainedExamples.Count - 1].Contains(" Add description here"))){
137-
(Get-Content $File) |
138-
Foreach-Object { $_ -replace "## PARAMETERS", $LastExampleDescription } |
139-
Out-File $File
33+
34+
35+
if(-not($Null -eq $RetainedContent) -and -not($RetainedContent.Contains("Add title here"))){
36+
if($DestinationContent -match $Re){
37+
$Extracted = $Matches[0]
38+
$FinalOutput = "## EXAMPLES`r`n$RetainedContent`r`n## PARAMETERS"
39+
$text = $DestinationContent.ToString()
40+
if(-not($Extracted.Contains("``````powershell"))){
41+
$text = $text.Replace($Extracted, "## PARAMETERS")
42+
Write-Host "Does not have snippet"
43+
}else{
44+
$text = $text.Replace($Extracted, $FinalOutput)
45+
}
46+
$text | Out-File $File -Encoding UTF8
47+
}
48+
if($DestinationContent -match $Re2){
49+
$Extracted2 = $Matches[0]
50+
$DescriptionCommand = [System.IO.Path]::GetFileNameWithoutExtension($File)
51+
$Description1 = "This example shows how to use the $DescriptionCommand Cmdlet."
52+
$Description2 = "To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference)."
53+
54+
$text2 = $DestinationContent.ToString()
55+
if(-not($Extracted2.Contains("## EXAMPLES"))){
56+
Write-Host "Does not have snippet $DescriptionCommand"
57+
$text2 = $text2.Replace($Description1, $null)
58+
$text2 = $text2.Replace($Description2, $null)
59+
$text2 | Out-File $File -Encoding UTF8
60+
61+
}
62+
}
63+
$Stream = [IO.File]::OpenWrite($File)
64+
try
65+
{
66+
$Stream.SetLength($stream.Length - 2)
67+
$Stream.Close()
68+
}
69+
catch
70+
{
71+
72+
}
73+
$Stream.Dispose()
74+
$RetainedExamples.Clear()
14075
}
76+
77+
}
78+
14179
}
14280
function Get-ExistingDescriptions {
14381

@@ -149,6 +87,7 @@ function Get-ExistingDescriptions {
14987
[int]$End,
15088
[int]$NoOfExamples
15189
)
90+
$Title = $null
15291
$ContentBlock = $null
15392

15493
for ($i = $Start; $i -lt $End; $i++) {
@@ -171,7 +110,7 @@ function Get-ExistingDescriptions {
171110
$DescVal = $Content[$j]
172111
$RetainedDescription += "$DescVal`n"
173112
}
174-
$RetainedExamples.Add("$RetainedDescription")
113+
$RetainedExamples.Add("$ContentBlock**##@**$Title**##@**$RetainedDescription")
175114
if ($NoOfExamples -gt 1) {
176115
$NoOfExamples--
177116
for ($k = $Start; $k -lt $End; $k++) {
@@ -185,23 +124,7 @@ function Get-ExistingDescriptions {
185124
}
186125

187126
}
188-
Set-Location microsoftgraph-docs-powershell
189-
$proposedBranch = "weekly_v2_docs_update_$date"
190-
$exists = git branch -l $proposedBranch
191-
if ([string]::IsNullOrEmpty($exists)) {
192-
git checkout -b $proposedBranch
193-
}else{
194-
Write-Host "Branch already exists"
195-
git checkout $proposedBranch
196-
}
197-
if (-not (Test-Path $ModuleMappingConfigPath)) {
198-
Write-Error "Module mapping file not be found: $ModuleMappingConfigPath."
199-
}
200-
if ($ModulesToGenerate.Count -eq 0) {
201-
[HashTable] $ModuleMapping = Get-Content $ModuleMappingConfigPath | ConvertFrom-Json -AsHashTable
202-
$ModulesToGenerate = $ModuleMapping.Keys
203-
}
204-
Set-Location ..\microsoftgraph-docs-powershell
205-
Write-Host -ForegroundColor Green "-------------finished checking out to today's branch-------------"
206-
Start-Copy -ModulesToGenerate $ModulesToGenerate
207-
Write-Host -ForegroundColor Green "-------------Done-------------"
127+
$File = "C:\Projects\msgraph-sdk-powershell\src\Identity.SignIns\beta\examples\New-MgBetaIdentityProvider.md"
128+
$DestinationFile = "C:\Projects\microsoftgraph-docs-powershell\microsoftgraph\graph-powershell-beta\Microsoft.Graph.Beta.Identity.SignIns\New-MgBetaIdentityProvider.md"
129+
$Content = Get-Content -Path $File
130+
Import-Descriptions -Content $Content -File $DestinationFile

scripts/RepairExamplesDescriptionsAndTitle.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ function Import-Descriptions {
110110
$DestinationContent = Get-Content -Encoding UTF8 -Raw $File
111111
$RetainedContent = $null
112112
foreach ($Ex in $RetainedExamples) {
113-
$ContentBody = $Ex.Split("****")[0]
114-
$ContentDescription = $Ex.Split("****")[2]
113+
$ContentBody = $Ex.Split("**##@**")[0]
114+
$ContentDescription = $Ex.Split("**##@**")[2]
115115
$RetainedContent += "$ContentBody$ContentDescription"
116116
$TitleCount++
117117

@@ -196,7 +196,7 @@ function Get-ExistingDescriptions {
196196
$DescVal = $Content[$j]
197197
$RetainedDescription += "$DescVal`n"
198198
}
199-
$RetainedExamples.Add("$ContentBlock****$Title****$RetainedDescription")
199+
$RetainedExamples.Add("$ContentBlock**##@**$Title**##@**$RetainedDescription")
200200
if ($NoOfExamples -gt 1) {
201201
$NoOfExamples--
202202
for ($k = $Start; $k -lt $End; $k++) {

0 commit comments

Comments
 (0)