OpenTally/scripts/build_docs.sh

12 lines
668 B
Bash
Executable File

#!/bin/bash
# Gen docs
cargo doc --no-deps --document-private-items
# Remove wasm-bindgen items from HTML
find target/doc/opentally -type f -print0 | xargs -0 perl -0777 -i -pe 's#<tr class="module-item"><td><a class="fn" href="fn.__wasm_bindgen_generated_.*?</tr>##gs'
# Remove wasm-bindgen items from sidebars
find target/doc/opentally -name sidebar-items.js -print0 | xargs -0 perl -0777 -i -pe 's#initSidebarItems\({#initSidebarItems(Object.fromEntries(Object.entries({#g'
find target/doc/opentally -name sidebar-items.js -print0 | xargs -0 perl -0777 -i -pe 's#}\);#}).map(([k, v]) => [k, v.filter((w) => !w[0].startsWith("__wasm_bindgen_generated_"))])));#g'