mirror of
https://github.com/cytopia/devilbox.git
synced 2024-12-30 09:38:51 +00:00
Fix default file extensions for linkcheck
This commit is contained in:
parent
f7ce65ab94
commit
ddc23aafd8
@ -49,7 +49,7 @@ help:
|
|||||||
|
|
||||||
|
|
||||||
linkcheck2:
|
linkcheck2:
|
||||||
./linkcheck.sh -r 10 -t 10 _includes/
|
./linkcheck.sh -r 10 -t 10 -e rst _includes/
|
||||||
|
|
||||||
build:
|
build:
|
||||||
sphinx-build -a -E -n -j auto -q -W . _build/html
|
sphinx-build -a -E -n -j auto -q -W . _build/html
|
||||||
|
@ -20,7 +20,7 @@ SEARCH_PATH="."
|
|||||||
###
|
###
|
||||||
### Comma separated list of file extensions to scan for urls
|
### Comma separated list of file extensions to scan for urls
|
||||||
###
|
###
|
||||||
EXTENSIONS="rst"
|
EXTENSIONS=""
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
@ -137,12 +137,20 @@ gather_urls() {
|
|||||||
local reg_exclude="${3}"
|
local reg_exclude="${3}"
|
||||||
|
|
||||||
local url_regex="http(s)?:\/\/[-=?:,._/#0-9a-zA-Z]+"
|
local url_regex="http(s)?:\/\/[-=?:,._/#0-9a-zA-Z]+"
|
||||||
|
local find_ext=
|
||||||
local find_cmd=
|
local find_cmd=
|
||||||
|
|
||||||
find_cmd="find ${path} \( -iname \*.${extensions//,/ -o -iname \\*.} \) -exec grep -Eo '${url_regex}' {} \;"
|
if [ -n "${extensions}" ]; then
|
||||||
|
find_ext="\( -iname \*.${extensions//,/ -o -iname \\*.} \)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
find_cmd="find ${path} ${find_ext} -type f -exec grep --binary-files=without-match -Eo '${url_regex}' '{}' \;"
|
||||||
|
>&2 echo "\$ ${find_cmd}"
|
||||||
|
|
||||||
# Loop through uniqued URLs
|
# Loop through uniqued URLs
|
||||||
for url in $(eval "${find_cmd}" | sort -u); do
|
for url in $(eval "${find_cmd}" 2>/dev/null | sort -u); do
|
||||||
|
# Ignore any 'Binary file...' results
|
||||||
|
if echo "${url}" | grep -Eq '^htt'; then
|
||||||
# Remove any trailing: [,.]
|
# Remove any trailing: [,.]
|
||||||
url="$( echo "${url}" | sed 's/[,.]$//g')"
|
url="$( echo "${url}" | sed 's/[,.]$//g')"
|
||||||
|
|
||||||
@ -150,6 +158,7 @@ gather_urls() {
|
|||||||
if ! echo "${url}" | grep -qE "${reg_exclude}"; then
|
if ! echo "${url}" | grep -qE "${reg_exclude}"; then
|
||||||
echo "${url}"
|
echo "${url}"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user