Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 9177 (#2940)
Browse files Browse the repository at this point in the history
* Escape parentheses in includes to fix issues in publishing

* Only escape close parens

* Comments

---------

Co-authored-by: Daniel Jurek <djurek@microsoft.com>
  • Loading branch information
azure-sdk and danieljurek authored Oct 17, 2024
1 parent 5065d46 commit 560ef38
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ function create-service-readme(
$readmePath = Join-Path $readmeFolder -ChildPath $readmeName
$content = ""
if (Test-Path (Join-Path $readmeFolder -ChildPath $indexTableLink)) {
# Escape the close parentheses in the URL. This is required by docs
# https://github.com/Azure/azure-sdk-tools/issues/5433
# This line looks incorrect but the left parameter is a regex and must
# escape the parentheses. The right is a literal string and, since this is
# PowerShell, the backslash does not itself need to be escaped.

# Example: "filename-with-(parens).md" -> "filename-with-(parens\).md"
$escapedIndexTableLink = $indexTableLink -replace '\)', '\)'

$content = "## Packages - $moniker`r`n"
$content += "[!INCLUDE [packages]($indexTableLink)]"
$content += "[!INCLUDE [packages]($escapedIndexTableLink)]"
}
if (!$content) {
LogError "There are no packages under service '$serviceName'. "
Expand Down Expand Up @@ -101,15 +110,15 @@ function generate-service-level-readme(
$readmeFolder = "$docRepoLocation/$pathPrefix/$moniker/"
$serviceReadme = "$readmeBaseName.md"
$indexReadme = "$readmeBaseName-index.md"

if ($packageInfos) {
generate-markdown-table `
-readmeFolder $readmeFolder `
-readmeName $indexReadme `
-packageInfos $packageInfos `
-moniker $moniker
-moniker $moniker
}

if (!(Test-Path "$readmeFolder$serviceReadme") -and $packageInfos) {
create-service-readme `
-readmeFolder $readmeFolder `
Expand Down

0 comments on commit 560ef38

Please sign in to comment.