Skip to content
Snippets Groups Projects
Commit 228d1a2b authored by Jan Frenzel's avatar Jan Frenzel
Browse files

Split check-no-floating.sh into multiple files.

parent 304dc406
No related branches found
No related tags found
2 merge requests!841Automated merge from preview to main,!838Split check-no-floating.sh into multiple files.
#!/bin/bash
scriptpath=${BASH_SOURCE[0]}
basedir=$(dirname "${scriptpath}")
basedir=$(dirname "${basedir}")
DOCUMENT_ROOT=${basedir}/docs
MSG=$(find ${DOCUMENT_ROOT} -name "*.md" | while IFS=' ' read string
do
md=${string#${DOCUMENT_ROOT}/}
# count occurences of md in nav
numberOfReferences=$(sed -n '/nav:/,/^$/p' ${basedir}/mkdocs.yml | grep -c ${md})
if [[ ${numberOfReferences} -gt 1 ]]; then
echo "${md} is included ${numberOfReferences} times in nav"
fi
done
)
if [[ ! -z "${MSG}" ]]; then
echo "${MSG}"
exit 1
fi
#!/bin/bash
scriptpath=${BASH_SOURCE[0]}
basedir=$(dirname "${scriptpath}")
basedir=$(dirname "${basedir}")
DOCUMENT_ROOT=${basedir}/docs
expectedFooter="legal_notice.md accessibility.md data_protection_declaration.md"
MSG=$(for md in ${expectedFooter}
do
# md included in footer
numberOfReferencesInFooter=$(sed -n '/footer:/,/^$/p' ${basedir}/mkdocs.yml | grep -c /${md%.md})
if [[ ${numberOfReferencesInFooter} -eq 0 ]]; then
echo "${md} is not included in footer"
elif [[ ${numberOfReferencesInFooter} -ne 1 ]]; then
echo "${md} is included ${numberOfReferencesInFooter} times in footer"
fi
done
)
if [[ ! -z "${MSG}" ]]; then
echo "${MSG}"
exit 1
fi
#!/bin/bash
scriptpath=${BASH_SOURCE[0]}
basedir=$(dirname "${scriptpath}")
basedir=$(dirname "${basedir}")
DOCUMENT_ROOT=${basedir}/docs
# there should be at most one directory between the root directory and the page
maxDepth=1
DOCUMENT_SLASH_COUNT=$(echo "${DOCUMENT_ROOT}/" | awk -F'/' '{print NF}')
MSG=$(find ${DOCUMENT_ROOT} -name "*.md" | awk -F'/' '{print $0,NF}' | while IFS=' ' read string slash_count
do
depth=$((slash_count - DOCUMENT_SLASH_COUNT))
if [[ "${depth}" -gt ${maxDepth} ]]; then
echo "max depth (${maxDepth}) exceeded for ${string}"
fi
done
)
if [[ ! -z "${MSG}" ]]; then
echo "${MSG}"
exit 1
fi
#!/bin/bash
if [ ${#} -ne 1 ]; then
echo "Usage: ${0} <path>"
fi
basedir=${1}
scriptpath=${BASH_SOURCE[0]}
basedir=$(dirname "${scriptpath}")
basedir=$(dirname "${basedir}")
DOCUMENT_ROOT=${basedir}/docs
maxDepth=4
expectedFooter="$DOCUMENT_ROOT/legal_notice.md $DOCUMENT_ROOT/accessibility.md $DOCUMENT_ROOT/data_protection_declaration.md"
expectedFooter="legal_notice.md accessibility.md data_protection_declaration.md"
MSG=$(find ${DOCUMENT_ROOT} -name "*.md" | awk -F'/' '{print $0,NF}' | while IFS=' ' read string depth
MSG=$(find ${DOCUMENT_ROOT} -name "*.md" | while IFS=' ' read string
do
#echo "string=${string} depth=${depth}"
# max depth check
if [ "${depth}" -gt $maxDepth ]; then
echo "max depth ($maxDepth) exceeded for ${string}"
fi
md=${string#${DOCUMENT_ROOT}/}
# md included in nav
numberOfReferences=`sed -n '/nav:/,/^$/p' ${basedir}/mkdocs.yml | grep -c ${md}`
if [ $numberOfReferences -eq 0 ]; then
# fallback: md included in footer
if [[ "${expectedFooter}" =~ ${string} ]]; then
numberOfReferencesInFooter=`sed -n '/footer:/,/^$/p' ${basedir}/mkdocs.yml | grep -c /${md%.md}`
if [ $numberOfReferencesInFooter -eq 0 ]; then
echo "${md} is not included in footer"
elif [ $numberOfReferencesInFooter -ne 1 ]; then
echo "${md} is included $numberOfReferencesInFooter times in footer"
fi
else
if [[ ! "${expectedFooter}" =~ ${md} ]]; then
numberOfReferences=$(sed -n '/nav:/,/^$/p' ${basedir}/mkdocs.yml | grep -c ${md})
if [[ ${numberOfReferences} -eq 0 ]]; then
echo "${md} is not included in nav"
fi
elif [ $numberOfReferences -ne 1 ]; then
echo "${md} is included $numberOfReferences times in nav"
fi
done
)
if [ ! -z "${MSG}" ]; then
if [[ ! -z "${MSG}" ]]; then
echo "${MSG}"
exit -1
exit 1
fi
......@@ -54,6 +54,30 @@ while read -r; do
fi
done <<< "$files"
echo "Checking floating pages"
if ! runInDocker ./doc.zih.tu-dresden.de/util/check-no-floating.sh; then
echo -e "\tFailed"
exit_ok=no
fi
echo "Checking that every page is not included more than once"
if ! runInDocker ./doc.zih.tu-dresden.de/util/check-every-page-not-included-more-than-once.sh; then
echo -e "\tFailed"
exit_ok=no
fi
echo "Checking that contains necessary links"
if ! runInDocker ./doc.zih.tu-dresden.de/util/check-footer.sh; then
echo -e "\tFailed"
exit_ok=no
fi
echo "Checking max depth"
if ! runInDocker ./doc.zih.tu-dresden.de/util/check-max-depth.sh; then
echo -e "\tFailed"
exit_ok=no
fi
echo "Testing syntax of bash files..."
if ! runInDocker ./doc.zih.tu-dresden.de/util/check-bash-syntax.sh; then
echo -e "\tFailed"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment