Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools repository for Tools P…
Browse files Browse the repository at this point in the history
…R 999
  • Loading branch information
azure-sdk committed Sep 15, 2020
1 parent 30c771e commit 1aeb602
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions eng/common/scripts/update-docs-metadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ 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+(?<filetitle>Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C)))"
$fileTitle = ""
if ($pkgInfo.ReadmeContent -match $titleRegex) {
$fileContent = $fileContent -replace $titleRegex, "`${0} - Version $($pkgInfo.PackageVersion) `n"
# The if block gurantee there is at least one match which starts with the format of "# Azure..."
$fileTitle = $matches["filetitle"]
}
# Replace github master link with release tag.
$ReplacementPattern = "`${1}$($pkgInfo.Tag)"
$fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern
Expand Down

0 comments on commit 1aeb602

Please sign in to comment.