doc: Update build-docs helper script.
I fixed this locally for KF5 some time ago but hadn't realized I'd committed this to git. Copying my fixes over.