blob: a7b5e2f9bae240794b6cce85a4d3ea63f6e42586 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/bash
# buildhtml.sh
# Builds the html static site, using mkdocs
set -e
# Assumes that the script is executed either from the htmldoc folder (by netlify), or from the root repo dir (as originally intended)
currentdir=$(pwd | awk -F '/' '{print $NF}')
echo "$currentdir"
if [ "$currentdir" = "generator" ]; then
cd ../..
fi
GENERATOR_DIR="docs/generator"
# Copy all netdata .md files to docs/generator/src. Exclude htmldoc itself and also the directory node_modules generatord by Netlify
echo "Copying files"
rm -rf ${GENERATOR_DIR}/src
find . -type d \( -path ./${GENERATOR_DIR} -o -path ./node_modules \) -prune -o -name "*.md" -print | cpio -pd ${GENERATOR_DIR}/src
# Modify the first line of the main README.md, to enable proper static html generation
echo "Modifying README header"
sed -i '0,/# netdata /s//# Introduction\n\n/' ${GENERATOR_DIR}/src/README.md
# Remove specific files that don't belong in the documentation
declare -a EXCLUDE_LIST=(
"HISTORICAL_CHANGELOG.md"
)
for f in "${EXCLUDE_LIST[@]}"; do
rm "${GENERATOR_DIR}/src/$f"
done
echo "Creating mkdocs.yaml"
# Generate mkdocs.yaml
${GENERATOR_DIR}/buildyaml.sh >${GENERATOR_DIR}/mkdocs.yml
echo "Fixing links"
# Fix links (recursively, all types, executing replacements)
${GENERATOR_DIR}/checklinks.sh -rax
echo "Calling mkdocs"
# Build html docs
mkdocs build --config-file=${GENERATOR_DIR}/mkdocs.yml
echo "Finished"
|