Skip to content

Commit de93341

Browse files
committed
Handle extra field Tag in for the description fields
1 parent 70a8e44 commit de93341

File tree

1 file changed

+40
-6
lines changed

1 file changed

+40
-6
lines changed

src/platyPS/platyPS.psm1

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,22 @@ function AddLineBreaksForParagraphs
23252325
}
23262326
}
23272327

2328+
function DescriptionToPara
2329+
{
2330+
[CmdletBinding()]
2331+
param(
2332+
[Parameter(Mandatory=$false, ValueFromPipeline=$true)]
2333+
$description
2334+
)
2335+
2336+
process
2337+
{
2338+
# on some old maml modules description uses Tag to store *-bullet-points
2339+
# one example of it is Exchange
2340+
$description.Tag + "" + $description.Text
2341+
}
2342+
}
2343+
23282344
function IncrementHelpVersion
23292345
{
23302346
param(
@@ -2493,13 +2509,16 @@ function ConvertPsObjectsToMamlModel
24932509
{
24942510
if ($HelpEntry.description.text)
24952511
{
2496-
$ParameterObject.Description = $HelpEntry.description.text | AddLineBreaksForParagraphs
2512+
$ParameterObject.Description = $HelpEntry.description |
2513+
DescriptionToPara |
2514+
AddLineBreaksForParagraphs
24972515
}
24982516
else
24992517
{
25002518
# this case happens, when there is HelpMessage in 'Parameter' attribute,
25012519
# but there is no maml or comment-based help.
25022520
# then help engine put string outside of 'text' property
2521+
# In this case there is no DescriptionToPara call needed
25032522
$ParameterObject.Description = $HelpEntry.description | AddLineBreaksForParagraphs
25042523
}
25052524
}
@@ -2667,14 +2686,22 @@ function ConvertPsObjectsToMamlModel
26672686
#Get Description
26682687
if($Help.description -ne $null)
26692688
{
2670-
$MamlCommandObject.Description = New-Object -TypeName Markdown.MAML.Model.Markdown.SectionBody ($Help.description.Text | AddLineBreaksForParagraphs)
2689+
$MamlCommandObject.Description = New-Object -TypeName Markdown.MAML.Model.Markdown.SectionBody (
2690+
$Help.description |
2691+
DescriptionToPara |
2692+
AddLineBreaksForParagraphs
2693+
)
26712694
}
26722695

26732696
#Add to Notes
26742697
#From the Help AlertSet data
26752698
if($help.alertSet)
26762699
{
2677-
$MamlCommandObject.Notes = New-Object -TypeName Markdown.MAML.Model.Markdown.SectionBody ($help.alertSet.alert.Text | AddLineBreaksForParagraphs)
2700+
$MamlCommandObject.Notes = New-Object -TypeName Markdown.MAML.Model.Markdown.SectionBody (
2701+
$help.alertSet.alert |
2702+
DescriptionToPara |
2703+
AddLineBreaksForParagraphs
2704+
)
26782705
}
26792706

26802707
# Not provided by the command object. Using the Command Type to create a note declaring it's type.
@@ -2704,7 +2731,9 @@ function ConvertPsObjectsToMamlModel
27042731
New-Object -TypeName Markdown.MAML.Model.MAML.MamlCodeBlock ($Example.code, '')
27052732
)
27062733

2707-
$RemarkText = $Example.remarks.text | AddLineBreaksForParagraphs
2734+
$RemarkText = $Example.remarks |
2735+
DescriptionToPara |
2736+
AddLineBreaksForParagraphs
27082737

27092738
$MamlExampleObject.Remarks = $RemarkText
27102739
$MamlCommandObject.Examples.Add($MamlExampleObject)
@@ -2718,7 +2747,10 @@ function ConvertPsObjectsToMamlModel
27182747
$Help.inputTypes.inputType | ForEach-Object {
27192748
$InputObject = New-Object -TypeName Markdown.MAML.Model.MAML.MamlInputOutput
27202749
$InputObject.TypeName = $_.type.name
2721-
$InputObject.Description = $_.description.Text | AddLineBreaksForParagraphs
2750+
$InputObject.Description = $_.description |
2751+
DescriptionToPara |
2752+
AddLineBreaksForParagraphs
2753+
27222754
$Inputs += $InputObject
27232755
}
27242756

@@ -2734,7 +2766,9 @@ function ConvertPsObjectsToMamlModel
27342766
$Help.returnValues.returnValue | ForEach-Object {
27352767
$OutputObject = New-Object -TypeName Markdown.MAML.Model.MAML.MamlInputOutput
27362768
$OutputObject.TypeName = $_.type.name
2737-
$OutputObject.Description = $_.description.Text | AddLineBreaksForParagraphs
2769+
$OutputObject.Description = $_.description |
2770+
DescriptionToPara |
2771+
AddLineBreaksForParagraphs
27382772
$Outputs += $OutputObject
27392773
}
27402774

0 commit comments

Comments
 (0)