Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 973 (#14995)
Browse files Browse the repository at this point in the history
* 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 <48036328+sima-zhu@users.noreply.github.com>
  • Loading branch information
azure-sdk and sima-zhu authored Sep 11, 2020
1 parent 0e6d31d commit 45d0f7f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions eng/common/scripts/update-docs-metadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,13 @@ function GetAdjustedReadmeContent($pkgInfo, $lang){
$foundTitle = ""

# only replace the version if the formatted header can be found
$headerContentMatches = (Select-String -InputObject $pkgInfo.ReadmeContent -Pattern 'Azure .+? (client|plugin|shared) library for (JavaScript|Java|Python|\.NET|C)')
if ($headerContentMatches) {
$foundTitle = $headerContentMatches.Matches[0]
$fileContent = $pkgInfo.ReadmeContent -replace $foundTitle, "$foundTitle - Version $($pkgInfo.PackageVersion) `n"

# Replace github master link with release tag.
$ReplacementPattern = "`${1}$($pkgInfo.Tag)"
$fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern
}

$titleRegex = "(\# Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C))"
$fileContent = $pkgInfo.ReadmeContent -replace $titleRegex, "`${1} - Version $($pkgInfo.PackageVersion) `n"

# Replace github master link with release tag.
$ReplacementPattern = "`${1}$($pkgInfo.Tag)"
$fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern

$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"

if ($fileContent) {
Expand Down

0 comments on commit 45d0f7f

Please sign in to comment.