Skip to content

Commit 808df6f

Browse files
adityapatwardhanvors
authored andcommitted
Added xmlns to the XML_PREAMBULA
The xmlns msh = 'http://msh' is required for xpath queries of provider help to work. Added it to the XML_PREAMBULA
1 parent 2c7ff13 commit 808df6f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/Markdown.MAML/Renderer/MamlRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class MamlRenderer
1818
private Stack<string> _tagStack = new Stack<string>();
1919

2020
public const string XML_PREAMBULA = @"<?xml version=""1.0"" encoding=""utf-8""?>
21-
<helpItems schema=""maml"">
21+
<helpItems xmlns=""http://msh"" schema=""maml"">
2222
";
2323
public const string COMMAND_PREAMBULA = @"<command:command xmlns:maml=""http://schemas.microsoft.com/maml/2004/10"" xmlns:command=""http://schemas.microsoft.com/maml/dev/command/2004/10"" xmlns:dev=""http://schemas.microsoft.com/maml/dev/2004/10"" xmlns:MSHelp=""http://msdn.microsoft.com/mshelp"">";
2424

test/Pester/PlatyPs.Tests.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,18 @@ Describe 'New-ExternalHelp' {
394394
$Named
395395
}
396396

397-
It "generates right order for syntax" {
397+
BeforeAll {
398398
$a = @{
399399
command = 'Test-OrderFunction'
400400
OutputFolder = 'TestDrive:\'
401401
Force = $true
402402
}
403403

404404
$file = New-MarkdownHelp @a
405-
$maml = $file | New-ExternalHelp -OutputPath "TestDrive:\" -Force
405+
$maml = $file | New-ExternalHelp -OutputPath "TestDrive:\TestOrderFunction.xml" -Force
406+
}
407+
408+
It "generates right order for syntax" {
406409
$help = Get-HelpPreview -Path $maml
407410
($help.Syntax.syntaxItem | measure).Count | Should Be 1
408411
$names = $help.Syntax.syntaxItem.parameter.Name
@@ -411,6 +414,11 @@ Describe 'New-ExternalHelp' {
411414
$names[1] | Should Be 'Third'
412415
$names[2] | Should Be 'Named'
413416
}
417+
418+
It "checks that xmlns 'http://msh' is present" {
419+
$xml = [xml] (Get-Content (Join-Path $TestDrive 'TestOrderFunction.xml'))
420+
$xml.helpItems.namespaceuri | Should Be 'http://msh'
421+
}
414422
}
415423

416424
#region PS Objects to MAML Model Tests

0 commit comments

Comments
 (0)