diff --git a/doc/Makefile b/doc/Makefile index ef15d734d..8be1327dd 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -14,6 +14,7 @@ all: $(JSONRPC) ./generate_seminar_ics.py --ics $(MAKE) -C ../ rustdoc cp -r ../target/doc/* book/development/ + ./remove_chapter_nav_js.py $(DARKFID_JSONRPC): @echo "# darkfid JSON-RPC API" > $@ diff --git a/doc/remove_chapter_nav_js.py b/doc/remove_chapter_nav_js.py new file mode 100644 index 000000000..adf0d4f51 --- /dev/null +++ b/doc/remove_chapter_nav_js.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +# cp book/book.js /tmp/ +# python remove_chapter_nav_js.py +# diff book/book.js /tmp/book.js + +with open("book/book.js") as f: + lines = f.read() + +lines = lines.split("\n") + +pre = [] +while True: + line = lines[0] + + if "chapterNavigation()" in line: + break + + pre.append(lines.pop(0)) + +# chapterNavigation() { +lines.pop(0) + +i = 1 +while True: + line = lines.pop(0) + i += line.count("{") - line.count("}") + assert i >= 0 + if i == 0: + break + +src = "\n".join(pre + lines) +#print(src) + +with open("book/book.js", "w") as f: + f.write(src)