From bbf0a4c3c72a58fe3f084110b6b0f96482a9dd02 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 15 Sep 2020 19:37:39 +0000 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools repository for Tools PR 999 --- eng/common/scripts/update-docs-metadata.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/eng/common/scripts/update-docs-metadata.ps1 b/eng/common/scripts/update-docs-metadata.ps1 index 34aa42801ec0..62986a1c8c88 100644 --- a/eng/common/scripts/update-docs-metadata.ps1 +++ b/eng/common/scripts/update-docs-metadata.ps1 @@ -70,12 +70,14 @@ function GetAdjustedReadmeContent($pkgInfo, $lang){ } $fileContent = $pkgInfo.ReadmeContent - $foundTitle = "" # only replace the version if the formatted header can be found - $titleRegex = "(\# Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C))" - $fileContent = $pkgInfo.ReadmeContent -replace $titleRegex, "`${1} - Version $($pkgInfo.PackageVersion) `n" - + $titleRegex = "(\#\s+(?Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C)))" + $foundTitle = "" + if ($pkgInfo.ReadmeContent -match $titleRegex) { + $fileContent = $fileContent -replace $titleRegex, "`${0} - Version $($pkgInfo.PackageVersion) `n" + $foundTitle = $matches["filetitle"] + } # Replace github master link with release tag. $ReplacementPattern = "`${1}$($pkgInfo.Tag)" $fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern