From 1365897de58e899178604e439e5b03b22846877b Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 1 Apr 2025 18:43:20 -0500 Subject: [PATCH] Fixed an issue where inline code samples on mslearn weren't generated when `[ToolkitSample(somevalue)]` is instead of `[ToolkitSample(id: somevalue)]` --- Build-Toolkit-Docs.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Build-Toolkit-Docs.ps1 b/Build-Toolkit-Docs.ps1 index 2f8f5fbd..4a4eec81 100644 --- a/Build-Toolkit-Docs.ps1 +++ b/Build-Toolkit-Docs.ps1 @@ -37,7 +37,7 @@ function ProcessMarkdownFile($markdownFile) { # Insert Header $contents = $contents.Substring(0, $endIndex + 5) + "`n# $header`n" + $contents.Substring($endIndex + 5) - + # Find Sample Placeholders, replace with code content foreach ($sample in ($contents | Select-String -Pattern '>\s*\[!SAMPLE\s*(?.*)\s*\]\s*' -AllMatches).Matches) { $sampleid = $sample.Groups[1].Value @@ -47,8 +47,8 @@ function ProcessMarkdownFile($markdownFile) { foreach ($csFile in Get-ChildItem -Recurse -Path ($markdownFile.DirectoryName + '\**\*.xaml.cs').Replace('\', '/') | Where-Object { $_.FullName -notlike "*\bin\*" -and $_FullName -notlike "*\obj\*" }) { $csSample = Get-Content $csFile -Raw - - if ($csSample -match '\[ToolkitSample\s?\(\s*id:\s*(?:"|nameof\()\s?' + $sampleid + '\s?(?:"|\))') { + + if ($csSample -match '\[ToolkitSample\s?\(\s*(?:id\:)?\s*(?:"|nameof\()\s?' + $sampleid + '\s?(?:"|\))') { # Get Relative Path $docPath = $(Join-Path "components" $($csfile.FullName.Replace($componentsRoot.Path, ''))).Replace('\', '/').Trim('/')