From 12d9580138eb02bde998a7834e0b518f41aa22a5 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 15 Sep 2020 21:55:10 +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..2f7f3343de43 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 ($fileContent -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