Refactor post-build script that replaces relative and full URLs

When a stable version is built by single.Dockerfile, the normalize-links.sh script is used to replace the docs URLs to use a version.

It needs refactoring to be more quick and some bugs to be fixed.

Edited by Achilleas Pipinellis