Skip to content

Commit 8e23dec

Browse files
Description should be empty when it is missing in ModuleFile (#769)
1 parent 04e1564 commit 8e23dec

File tree

4 files changed

+142
-4
lines changed

4 files changed

+142
-4
lines changed

src/MarkdownReader/ModuleFileMarkdownReader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ internal static string GetModuleFileDescriptionFromMarkdown(ParsedMarkdownConten
181181
var nextHeader = md.FindHeader(nextHeaderLevel, "");
182182
if (nextHeader == -1)
183183
{
184-
nextHeaderLevel = 3;
184+
md.CurrentIndex--; // Back up to the description header
185+
return string.Empty;
185186
}
186187

187188
string descriptionString = MarkdownConverter.GetLinesTillNextHeader(md, nextHeaderLevel, index);

test/Pester/ImportMarkdownModuleFile.Tests.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Describe "Import-ModuleFile tests" {
99
Context "File creation" {
1010
It "Should be able to read module files" {
1111
$results = $modFiles.FullName | Import-MarkdownModuleFile
12-
$results.Count | Should -Be 14
12+
$results.Count | Should -Be 15
1313
}
1414

1515
It "Should produce the correct type of object" {
@@ -87,6 +87,12 @@ Describe "Import-ModuleFile tests" {
8787
$mf0.CommandGroups[0].Commands[$offset].Description | Should -Be $Description
8888

8989
}
90+
91+
It "Should be able to parse even if description is missing" {
92+
$mf = Import-MarkdownModuleFile "${PSScriptRoot}/assets/Microsoft.SystemCenter.ServiceManagementAutomation.md"
93+
$mf.Description | Should -Be ""
94+
$mf.CommandGroups.Count | Should -Be 1
95+
}
9096
}
9197

9298
Context "Metadata content" {

test/Pester/MeasurePlatyPSMarkdown.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Describe "Export-MarkdownModuleFile" {
1414
It "Should identify all the '<fileType>' assets" -TestCases @(
1515
@{ fileType = "unknown"; expectedCount = 2 }
1616
@{ fileType = "CommandHelp"; expectedCount = 41 }
17-
@{ fileType = "ModuleFile"; expectedCount = 15 }
18-
@{ fileType = "V1Schema"; expectedCount = 51 }
17+
@{ fileType = "ModuleFile"; expectedCount = 16 }
18+
@{ fileType = "V1Schema"; expectedCount = 52 }
1919
@{ fileType = "V2Schema"; expectedCount = 5 }
2020
) {
2121
param ($fileType, $expectedCount)
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
Download Help Link:
3+
Help Version: 5.0.0.0
4+
Locale: en-US
5+
Module Guid: 03F356FB-485D-41BC-B7FE-7F573ECC186F
6+
Module Name: Microsoft.SystemCenter.ServiceManagementAutomation
7+
---
8+
9+
# Microsoft.SystemCenter.ServiceManagementAutomation Module
10+
## Description
11+
12+
## Microsoft.SystemCenter.ServiceManagementAutomation Cmdlets
13+
### [Edit-SmaRunbook](Edit-SmaRunbook.md)
14+
Updates the draft field of a runbook.
15+
16+
### [Get-SmaAdminConfiguration](Get-SmaAdminConfiguration.md)
17+
Gets the SMA administration configuration.
18+
19+
### [Get-SmaCertificate](Get-SmaCertificate.md)
20+
Gets a certificate.
21+
22+
### [Get-SmaConnection](Get-SmaConnection.md)
23+
Gets an SMA connection.
24+
25+
### [Get-SmaConnectionField](Get-SmaConnectionField.md)
26+
Gets an SMA connection field.
27+
28+
### [Get-SmaConnectionType](Get-SmaConnectionType.md)
29+
Gets all SMA connection types.
30+
31+
### [Get-SmaCredential](Get-SmaCredential.md)
32+
Gets SMA credentials.
33+
34+
### [Get-SmaJob](Get-SmaJob.md)
35+
Gets a runbook job.
36+
37+
### [Get-SmaJobOutput](Get-SmaJobOutput.md)
38+
Gets the output of a SMA job.
39+
40+
### [Get-SmaLicense](Get-SmaLicense.md)
41+
Gets an SMA license.
42+
43+
### [Get-SmaModule](Get-SmaModule.md)
44+
Gets a module from SMA.
45+
46+
### [Get-SmaRunbook](Get-SmaRunbook.md)
47+
Gets an SMA runbook.
48+
49+
### [Get-SmaRunbookDefinition](Get-SmaRunbookDefinition.md)
50+
Gets a runbook definition.
51+
52+
### [Get-SmaRunbookWorkerDeployment](Get-SmaRunbookWorkerDeployment.md)
53+
Gets all runbook workers in the SMA deployment.
54+
55+
### [Get-SmaSchedule](Get-SmaSchedule.md)
56+
Gets an SMA schedule.
57+
58+
### [Get-SmaVariable](Get-SmaVariable.md)
59+
Gets an SMA variable.
60+
61+
### [Import-SmaModule](Import-SmaModule.md)
62+
Imports a module into SMA.
63+
64+
### [Import-SmaRunbook](Import-SmaRunbook.md)
65+
Imports a runbook into SMA.
66+
67+
### [New-SmaConnection](New-SmaConnection.md)
68+
Creates a connection instance in SMA.
69+
70+
### [New-SmaRunbookWorkerDeployment](New-SmaRunbookWorkerDeployment.md)
71+
Changes the runbook worker deployment in SMA.
72+
73+
### [Publish-SmaRunbook](Publish-SmaRunbook.md)
74+
Publishes a runbook in SMA.
75+
76+
### [Remove-SmaCertificate](Remove-SmaCertificate.md)
77+
Deletes a certificate from SMA.
78+
79+
### [Remove-SmaConnection](Remove-SmaConnection.md)
80+
Deletes a connection from SMA.
81+
82+
### [Remove-SmaCredential](Remove-SmaCredential.md)
83+
Deletes a credential from SMA.
84+
85+
### [Remove-SmaModule](Remove-SmaModule.md)
86+
Deletes a module from SMA.
87+
88+
### [Remove-SmaRunbook](Remove-SmaRunbook.md)
89+
Removes a runbook from SMA.
90+
91+
### [Remove-SmaSchedule](Remove-SmaSchedule.md)
92+
Deletes a schedule from SMA.
93+
94+
### [Remove-SmaVariable](Remove-SmaVariable.md)
95+
Deletes a variable from SMA.
96+
97+
### [Resume-SmaJob](Resume-SmaJob.md)
98+
Resumes a SMA job.
99+
100+
### [Set-SmaAdminConfiguration](Set-SmaAdminConfiguration.md)
101+
Modifies administrative configuration settings in SMA.
102+
103+
### [Set-SmaCertificate](Set-SmaCertificate.md)
104+
Creates or updates a certificate in SMA.
105+
106+
### [Set-SmaConnectionFieldValue](Set-SmaConnectionFieldValue.md)
107+
Modifies a connection field value for a connection object in SMA.
108+
109+
### [Set-SmaCredential](Set-SmaCredential.md)
110+
Creates or updates a credential in SMA.
111+
112+
### [Set-SmaLicense](Set-SmaLicense.md)
113+
Updates the SMA product key.
114+
115+
### [Set-SmaRunbookConfiguration](Set-SmaRunbookConfiguration.md)
116+
Modifies the configuration of a runbook.
117+
118+
### [Set-SmaSchedule](Set-SmaSchedule.md)
119+
Creates or modifies a schedule in SMA.
120+
121+
### [Set-SmaVariable](Set-SmaVariable.md)
122+
Creates or modifies a variable in SMA.
123+
124+
### [Start-SmaRunbook](Start-SmaRunbook.md)
125+
Starts a runbook job.
126+
127+
### [Stop-SmaJob](Stop-SmaJob.md)
128+
Stops a SMA job.
129+
130+
### [Suspend-SmaJob](Suspend-SmaJob.md)
131+
Suspends an SMA job.

0 commit comments

Comments
 (0)