Skip to content

Commit dde5dc6

Browse files
authored
Merge pull request #285 from vors/merge-fixes
2 fixes for Merge-MarkdownHelp
2 parents deb5aec + fb668fd commit dde5dc6

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

src/Markdown.MAML/Transformer/MamlMultiModelMerger.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,6 @@ public MamlMultiModelMerger(Action<string> infoCallback, bool ignoreTagsIfAllApp
3232
_mergeMarker = mergeMarker;
3333
}
3434

35-
/// <summary>
36-
/// Facade for Merge method that's easier to call from PowerShell
37-
/// </summary>
38-
/// <param name="applicableTag2Model"></param>
39-
/// <returns></returns>
40-
public MamlCommand MergePS(Hashtable applicableTag2Model)
41-
{
42-
Dictionary<string, MamlCommand> dict = new Dictionary<string, MamlCommand>();
43-
foreach (DictionaryEntry pair in applicableTag2Model)
44-
{
45-
MamlCommand value;
46-
if (pair.Value is PSObject)
47-
{
48-
value = (pair.Value as PSObject).BaseObject as MamlCommand;
49-
}
50-
else
51-
{
52-
value = pair.Value as MamlCommand;
53-
}
54-
55-
if (value == null)
56-
{
57-
throw new ArgumentException("Value of hashtable cannot be casted to MamlCommand");
58-
}
59-
60-
dict[pair.Key.ToString()] = pair.Value as MamlCommand;
61-
}
62-
63-
return this.Merge(dict);
64-
}
65-
6635
public MamlCommand Merge(Dictionary<string, MamlCommand> applicableTag2Model)
6736
{
6837
if (applicableTag2Model.Count == 0)

src/platyPS/platyPS.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ function Merge-MarkdownHelp
503503
$files = $_.Group
504504
$groupName = $_.Name
505505

506-
$dict = @{}
506+
$dict = New-Object 'System.Collections.Generic.Dictionary[string, Markdown.MAML.Model.MAML.MamlCommand]'
507507
$files | ForEach-Object {
508508
$model = GetMamlModelImpl $_.FullName -ForAnotherMarkdown -Encoding $Encoding
509509
# unwrap List of 1 element
@@ -523,8 +523,8 @@ function Merge-MarkdownHelp
523523
$newMetadata = @{}
524524
}
525525

526-
$merger = New-Object Markdown.MAML.Transformer.MamlMultiModelMerger -ArgumentList $null, !$ExplicitApplicableIfAll, $MergeMarker
527-
$newModel = $merger.MergePS($dict)
526+
$merger = New-Object Markdown.MAML.Transformer.MamlMultiModelMerger -ArgumentList $null, (-not $ExplicitApplicableIfAll), $MergeMarker
527+
$newModel = $merger.Merge($dict)
528528

529529
$md = ConvertMamlModelToMarkdown -mamlCommand $newModel -metadata $newMetadata -PreserveFormatting
530530
$outputFilePath = Join-Path $OutputPath $groupName

0 commit comments

Comments
 (0)