Fix issue with HTML docs generation (#6433)
* Move to the docs/generator/doc directory before running checklinks * remove the entire DOCS_DIR before switching to another language * Try copying with -a instead of -r
Chris Akritidis committed
Jul 11, 2019 at 20:31 UTC
d46387882edebde405c91f6faff704a1e3ee1102
3 files changed
+23
-18
docs/generator/buildhtml.sh
+2
-4
@@ -39,7 +39,6 @@ find ${SRC_DIR} -name "*.md" -print0 | xargs -0 sed -i -e 's/\[!\[analytics.*UA-
39
declare -a EXCLUDE_LIST=(
40
"HISTORICAL_CHANGELOG.md"
41
"contrib/sles11/README.md"
42
- "packaging/maintainers/README.md"
42
)
43
44
for f in "${EXCLUDE_LIST[@]}"; do
@@ -56,7 +55,6 @@ MKDOCS_CONFIG_FILE="${GENERATOR_DIR}/mkdocs.yml"
55
MKDOCS_DIR="doc"
56
DOCS_DIR=${GENERATOR_DIR}/${MKDOCS_DIR}
57
rm -rf ${DOCS_DIR}
59
-mkdir ${DOCS_DIR}
58
59
prep_html() {
60
lang="${1}"
@@ -90,12 +88,12 @@ prep_html() {
88
89
for d in "en" $(find ${LOC_DIR} -mindepth 1 -maxdepth 1 -name .git -prune -o -type d -printf '%f ') ; do
90
echo "Preparing source for $d"
93
- cp -a ${SRC_DIR}/* ${DOCS_DIR}/
91
+ cp -r ${SRC_DIR} ${DOCS_DIR}
92
if [ "${d}" != "en" ] ; then
93
cp -a ${LOC_DIR}/${d}/* ${DOCS_DIR}/
94
fi
95
prep_html $d
98
- rm -rf ${DOCS_DIR}/*
96
+ rm -rf ${DOCS_DIR}
97
done
98
99
# Remove cloned projects and temp directories
docs/generator/buildyaml.sh
+2
-1
@@ -254,9 +254,10 @@ navpart 2 web/api/badges "" "" 2
254
navpart 2 web/api/health "" "" 2
255
navpart 2 web/api/queries "" "Queries" 2
256
257
-echo -ne "- Hacking Netdata:
257
+echo -ne "- Additional Info:
258
- CODE_OF_CONDUCT.md
259
- CONTRIBUTORS.md
260
+ - packaging/maintainers/README.md
261
"
262
navpart 2 packaging/makeself "" "" 4
263
navpart 2 libnetdata "" "libnetdata" 4
docs/generator/checklinks.sh
+19
-13
@@ -5,6 +5,8 @@
5
# Validates and tries to fix all links that will cause issues either in the repo, or in the html site
6
7
GENERATOR_DIR="docs/generator"
8
+MKDOCS_DIR="doc"
9
+DOCS_DIR=${GENERATOR_DIR}/${MKDOCS_DIR}
10
11
dbg () {
12
if [ "$VERBOSE" -eq 1 ] ; then printf "%s\\n" "${1}" ; fi
@@ -186,25 +188,27 @@ ck_netdata_relative () {
188
fi
189
;;
190
* )
189
- if [ -f "$fpath/$rlnk" ] ; then
190
- dbg "-- # (path/someotherfile) $rlnk"
191
- if [ "$fpath" = "." ] ; then
192
- s="https://github.com/netdata/netdata/tree/master/$rlnk"
193
- else
194
- s="https://github.com/netdata/netdata/tree/master/$fpath/$rlnk"
191
+ if [ -d "$fpath/$rlnk" ] ; then
192
+ dbg "-- # (path) -> htmldoc (path/)"
193
+ testf "$f" "$fpath/$rlnk/README.md"
194
+ if [ $? -eq 0 ] ; then
195
+ s="$rlnk/"
196
+ if [ "$fname" != "README.md" ] ; then s="../$s"; fi
197
fi
198
else
197
- if [ -d "$fpath/$rlnk" ] ; then
198
- dbg "-- # (path) -> htmldoc (path/)"
199
- testf "$f" "$fpath/$rlnk/README.md"
200
- if [ $? -eq 0 ] ; then
201
- s="$rlnk/"
202
- if [ "$fname" != "README.md" ] ; then s="../$s"; fi
199
+ cd - >/dev/null
200
+ if [ -f "$fpath/$rlnk" ] ; then
201
+ dbg "-- # (path/someotherfile) $rlnk"
202
+ if [ "$fpath" = "." ] ; then
203
+ s="https://github.com/netdata/netdata/tree/master/$rlnk"
204
+ else
205
+ s="https://github.com/netdata/netdata/tree/master/$fpath/$rlnk"
206
fi
207
else
208
echo "-- ERROR: $f - $rlnk is neither a file or a directory. Giving up!"
209
EXITCODE=1
210
fi
211
+ cd $DOCS_DIR >/dev/null
212
fi
213
;;
214
esac
@@ -212,7 +216,7 @@ ck_netdata_relative () {
216
if [[ ! -z $s ]] ; then
217
srch=$(echo "$rlnk" | sed 's/\//\\\//g')
218
rplc=$(echo "$s" | sed 's/\//\\\//g')
215
- fix "sed -i 's/($srch)/($rplc)/g' $GENERATOR_DIR/doc/$f"
219
+ fix "sed -i 's/($srch)/($rplc)/g' $f"
220
fi
221
}
222
@@ -314,9 +318,11 @@ if [ -z "${file}" ] ; then
318
printhelp
319
exit 1
320
fi
321
+ cd ${DOCS_DIR}
322
for f in $(find . -type d \( -path ./${GENERATOR_DIR} -o -path ./node_modules \) -prune -o -name "*.md" -print); do
323
checklinks "$f"
324
done
325
+ cd -
326
else
327
if [ $RECURSIVE -eq 1 ] ; then
328
printhelp