Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the bug of missing title #999

Merged
merged 9 commits into from
Sep 15, 2020
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
weshaggard marked this conversation as resolved.
Show resolved Hide resolved
$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 = "(\#.*(?<filetitle>Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C)))"
sima-zhu marked this conversation as resolved.
Show resolved Hide resolved
$fileTitle = ""
if ($pkgInfo.ReadmeContent -match $titleRegex) {
sima-zhu marked this conversation as resolved.
Show resolved Hide resolved
sima-zhu marked this conversation as resolved.
Show resolved Hide resolved
$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..."
sima-zhu marked this conversation as resolved.
Show resolved Hide resolved
$fileTitle = $matches["filetitle"]
}
# Replace github master link with release tag.
$ReplacementPattern = "`${1}$($pkgInfo.Tag)"
$fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern
Expand Down