Fix update-wiki.sh script

- Do not generate TOC from non-wiki contents
- Trim unnecessary whitespaces from TOC texts
- Fail fast on unsuccessful page list retrieval