Skip to content

Commit b050971

Browse files
committed
BUG: Fix docs build broken link check bug
1 parent be1d8be commit b050971

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ jobs:
5353
run: time catchsegv python -m backtesting.test
5454

5555
- if: matrix.test-type == 'docs'
56-
run: time catchsegv doc/build.sh
56+
run: time catchsegv bash doc/build.sh

doc/build.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ echo
7171
echo 'Testing for broken links'
7272
echo
7373
pushd "$BUILDROOT" >/dev/null
74+
tree .
7475
WEBSITE='https://kernc\.github\.io/backtesting\.py'
7576
grep -PR '<a .*?href=' |
7677
sed -E "s/:.*?<a .*?href=([\"'])(.*?)/\t\2/g" |
@@ -90,9 +91,12 @@ for line in sys.stdin.readlines():
9091
grep -v $'\t''$' |
9192
while read -r line; do
9293
while IFS=$'\t' read -r file url; do
93-
url=$(python -c 'import html, sys; print(html.unescape(sys.argv[-1]))' "$url")
94-
[ -f "$url" ] ||
95-
curl --silent --fail --retry 5 --retry-delay 5 --user-agent 'Mozilla/5.0 Firefox 61' "$url" >/dev/null 2>&1 ||
94+
target_file="$(python -c 'import html, sys; print(html.unescape(sys.argv[-1]))' "$url")"
95+
echo "$target_file"
96+
if [ -f "$target_file" ]; then continue; fi
97+
98+
url="${url// /%20}"
99+
curl --silent --fail --retry 5 --retry-delay 5 --user-agent 'Mozilla/5.0 Firefox 61' "$url" >/dev/null 2>&1 ||
96100
die "broken link in $file: $url"
97101
done
98102
done

0 commit comments

Comments
 (0)