summaryrefslogtreecommitdiffstats
path: root/docs/generator/checklinks.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-08-04 08:56:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-08-04 08:56:44 +0000
commit34f488f41ee820371159111bf621f11d0f54f669 (patch)
tree13eea1c3aa3d905ec929691bbf23d8b90bef1dcb /docs/generator/checklinks.sh
parentAdding upstream version 1.16.0. (diff)
downloadnetdata-34f488f41ee820371159111bf621f11d0f54f669.tar.xz
netdata-34f488f41ee820371159111bf621f11d0f54f669.zip
Adding upstream version 1.16.1.upstream/1.16.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdocs/generator/checklinks.sh32
1 files changed, 19 insertions, 13 deletions
diff --git a/docs/generator/checklinks.sh b/docs/generator/checklinks.sh
index acc144656..5012ad17d 100755
--- a/docs/generator/checklinks.sh
+++ b/docs/generator/checklinks.sh
@@ -5,6 +5,8 @@
# Validates and tries to fix all links that will cause issues either in the repo, or in the html site
GENERATOR_DIR="docs/generator"
+MKDOCS_DIR="doc"
+DOCS_DIR=${GENERATOR_DIR}/${MKDOCS_DIR}
dbg () {
if [ "$VERBOSE" -eq 1 ] ; then printf "%s\\n" "${1}" ; fi
@@ -186,25 +188,27 @@ ck_netdata_relative () {
fi
;;
* )
- if [ -f "$fpath/$rlnk" ] ; then
- dbg "-- # (path/someotherfile) $rlnk"
- if [ "$fpath" = "." ] ; then
- s="https://github.com/netdata/netdata/tree/master/$rlnk"
- else
- s="https://github.com/netdata/netdata/tree/master/$fpath/$rlnk"
+ if [ -d "$fpath/$rlnk" ] ; then
+ dbg "-- # (path) -> htmldoc (path/)"
+ testf "$f" "$fpath/$rlnk/README.md"
+ if [ $? -eq 0 ] ; then
+ s="$rlnk/"
+ if [ "$fname" != "README.md" ] ; then s="../$s"; fi
fi
else
- if [ -d "$fpath/$rlnk" ] ; then
- dbg "-- # (path) -> htmldoc (path/)"
- testf "$f" "$fpath/$rlnk/README.md"
- if [ $? -eq 0 ] ; then
- s="$rlnk/"
- if [ "$fname" != "README.md" ] ; then s="../$s"; fi
+ cd - >/dev/null
+ if [ -f "$fpath/$rlnk" ] ; then
+ dbg "-- # (path/someotherfile) $rlnk"
+ if [ "$fpath" = "." ] ; then
+ s="https://github.com/netdata/netdata/tree/master/$rlnk"
+ else
+ s="https://github.com/netdata/netdata/tree/master/$fpath/$rlnk"
fi
else
echo "-- ERROR: $f - $rlnk is neither a file or a directory. Giving up!"
EXITCODE=1
fi
+ cd $DOCS_DIR >/dev/null
fi
;;
esac
@@ -212,7 +216,7 @@ ck_netdata_relative () {
if [[ ! -z $s ]] ; then
srch=$(echo "$rlnk" | sed 's/\//\\\//g')
rplc=$(echo "$s" | sed 's/\//\\\//g')
- fix "sed -i 's/($srch)/($rplc)/g' $GENERATOR_DIR/doc/$f"
+ fix "sed -i 's/($srch)/($rplc)/g' $f"
fi
}
@@ -314,9 +318,11 @@ if [ -z "${file}" ] ; then
printhelp
exit 1
fi
+ cd ${DOCS_DIR}
for f in $(find . -type d \( -path ./${GENERATOR_DIR} -o -path ./node_modules \) -prune -o -name "*.md" -print); do
checklinks "$f"
done
+ cd -
else
if [ $RECURSIVE -eq 1 ] ; then
printhelp