Files
esp-modbus/docs/generate_docs

40 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

2023-12-10 15:13:11 +01:00
#!/bin/bash
exit_if_error() {
local exit_code=$1
shift
[[ $exit_code ]] && # do nothing if no error code passed
((exit_code != 0)) && { # do nothing if error code is 0
printf 'ERROR: %s\n' "$@" >&2
exit "$exit_code"
}
}
rm -rf _build
build-docs --target esp32 --language en || exit_if_error $? "Documentation build fail."
2023-12-10 15:13:11 +01:00
# Modifes target field of html files
ELEMENT="<script type='text/javascript'>
window.onload =(function() {
var myAnchor = document.getElementById('target-select');
var mySpan = document.createElement('input');
mySpan.style.float = 'left';
mySpan.setAttribute('type', 'text');
mySpan.setAttribute('maxLength', '10');
mySpan.value = 'all targets';
mySpan.setAttribute('disabled', true);
myAnchor.parentNode.replaceChild(mySpan, myAnchor);
})();
</script>"
FILES=$(find . -path "*/_build/en/esp32/html/*.html")
for FILE in ${FILES}
do
echo ${ELEMENT} >> "${FILE}"
done
exit_if_error $? "Documentation build fail."
2023-12-10 15:13:11 +01:00
echo "Documentation build ok."