Skip to content

Commit

Permalink
add regex to catch case
Browse files Browse the repository at this point in the history
but the real question is why didn't it error
  • Loading branch information
SallyMcGrath committed Nov 1, 2024
1 parent 7028d9f commit 018d623
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions common-theme/layouts/partials/strings/readme-paths.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
{{/* Handle /tree/main/path format */}}
{{ $newSrc = replaceRE "/tree/main/(.+)$" "/readme/$1" $newSrc }}

{{/* Add /readme if it's not already present */}}
{{ if not (findRE "/readme" $newSrc) }}
{{/* Handle root of repo with /tree/main */}}
{{ $newSrc = replaceRE "/tree/main$" "/readme" $newSrc }}

{{/* Make sure that /readme is present, avoiding duplicates */}}
{{ if not (findRE "/readme(/.*)?$" $newSrc) }}
{{ $newSrc = print $newSrc "/readme" }}
{{ end }}

Expand Down

0 comments on commit 018d623

Please sign in to comment.