Skip to content

Commit

Permalink
Merge pull request #110 from mrbobbytables/fix-url-expansion
Browse files Browse the repository at this point in the history
Fix reference link expansion
  • Loading branch information
k8s-ci-robot authored Feb 8, 2020
2 parents fe36c43 + 0136345 commit cc4ca73
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions hack/gen-content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,17 @@ find_md_files() {
# with the path that it will be after being copied over. This includes removing
# the extension and if the file is a README, trim it (README's function as the
# root page.) If the link references something not within the content that is
# being copied over, but still within one of the kubernetes projects update it to
# to use the git.k8s.io shortener.
# being copied over, it will be expanded to the full github url.
# Example:
# Repo: https://github.com/kubernetes/community
# Content to be synced: /contributors/guide -> /guide
# Markdown file: /contributors/guide/README.md
# Links:
# ./bug-bounty.md -> /guide/bug-bounty
# contributor-cheatsheet/README.md -> /guide/contributor-cheatsheet
# ../../sig-list.md -> https://git.k8s.io/community/sig-list.md
# /contributors/devel/README.md -> https://git.k8s.io/community/contributors/devel/README.md
# ../../sig-list.md -> https://github.com/kubernetes/community/blob/master/sig-list.md
# /contributors/devel/README.md -> https://github.com/kubernetes/community/blob/master/contributors/devel/README.md
# http://git.k8s.io/cotributors/guide/collab.md -> /guide/collab
# https://github.com/kubernetes/enhancements/tree/master/keps -> https://git.k8s.io/enhancements/keps
#
# Args:
# $1 - Full path to markdown file to be processed
Expand Down Expand Up @@ -117,7 +115,7 @@ process_content() {
fi

mapfile -t ref_link_matches < \
<(grep -o -i -P '^\[.+\]:\s*(?!|mailto|\S+?@|<|>|\?|\!|@|#|\$|%|\^|&|\*)\K\S+$' "$1")
<(grep -o -i -P '^\[.+\]:\s*(?!mailto|\S+?@|<|>|\?|\!|@|#|\$|%|\^|&|\*)\K\S+$' "$1")

if [[ -v ref_link_matches ]]; then
for match in "${ref_link_matches[@]}"; do
Expand Down

0 comments on commit cc4ca73

Please sign in to comment.