Skip to content

Commit 45d0f7f

Browse files
azure-sdksima-zhu
andauthored
Sync eng/common directory with azure-sdk-tools for PR 973 (#14995)
* Sync eng/common directory with azure-sdk-tools repository for Tools PR 973 * Update update-docs-metadata.ps1 * Update update-docs-metadata.ps1 Co-authored-by: Sima Zhu <[email protected]>
1 parent 0e6d31d commit 45d0f7f

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

eng/common/scripts/update-docs-metadata.ps1

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,13 @@ function GetAdjustedReadmeContent($pkgInfo, $lang){
7373
$foundTitle = ""
7474

7575
# only replace the version if the formatted header can be found
76-
$headerContentMatches = (Select-String -InputObject $pkgInfo.ReadmeContent -Pattern 'Azure .+? (client|plugin|shared) library for (JavaScript|Java|Python|\.NET|C)')
77-
if ($headerContentMatches) {
78-
$foundTitle = $headerContentMatches.Matches[0]
79-
$fileContent = $pkgInfo.ReadmeContent -replace $foundTitle, "$foundTitle - Version $($pkgInfo.PackageVersion) `n"
80-
81-
# Replace github master link with release tag.
82-
$ReplacementPattern = "`${1}$($pkgInfo.Tag)"
83-
$fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern
84-
}
85-
76+
$titleRegex = "(\# Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C))"
77+
$fileContent = $pkgInfo.ReadmeContent -replace $titleRegex, "`${1} - Version $($pkgInfo.PackageVersion) `n"
78+
79+
# Replace github master link with release tag.
80+
$ReplacementPattern = "`${1}$($pkgInfo.Tag)"
81+
$fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern
82+
8683
$header = "---`ntitle: $foundTitle`nkeywords: Azure, $lang, SDK, API, $($pkgInfo.PackageId), $service`nauthor: maggiepint`nms.author: magpint`nms.date: $date`nms.topic: article`nms.prod: azure`nms.technology: azure`nms.devlang: $lang`nms.service: $service`n---`n"
8784

8885
if ($fileContent) {

0 commit comments

Comments
 (0)