Exit with error if unresolved links or macros are found.

This can then block publishing process.

(cherry picked from commit 0aef2b5ac5d09e4afcdf40422924207103c59b75)

Conflicts:
	_scripts/cfdoc_sourcelinks.py
Remove obsolete imports.

(cherry picked from commit 6af4bd0a336b5cf95df54308a6922e3777918c62)
Self-tests for regex matching.

Also tighten exception handling around file opening.

(cherry picked from commit aa80ac3f3e8edfd3926da7262c424bafa5871d7e)