build-docs --target esp32 --language en
build-docs --target esp32 --language zh_CN

cp -rf _build/en/esp32/html html_en
cp -rf _build/zh_CN/esp32/html html_zh_CN
rm -rf _build __pycache__ tee

# Modifes some version and target fields of index.html
echo "<script type="text/javascript">
window.onload =(function() {
    var myAnchor = document.getElementById('version-select');
    var mySpan = document.createElement('input');
    mySpan.setAttribute('type', 'text');
    mySpan.setAttribute('maxLength', '10');
    mySpan.value = 'latest';
    mySpan.setAttribute('disabled', true);
    myAnchor.parentNode.replaceChild(mySpan, myAnchor);

    var myAnchor = document.getElementById('target-select');
    var mySpan = document.createElement('input');
    mySpan.setAttribute('type', 'text');
    mySpan.setAttribute('maxLength', '10');
    mySpan.value = 'all targets';
    mySpan.setAttribute('disabled', true);
    myAnchor.parentNode.replaceChild(mySpan, myAnchor);

})();
</script>" | tee -a html_en/index.html html_zh_CN/index.html > /dev/null
