Fix relinker

This fixes several flaws in the link rewriter:
- broken links on the docs side
- multiple links on one line being mangled
- byzantine logic

Also generalize the logic of the Dockerfile so it is no longer specific to "registry" (env variable), which is a first step in making it possible to upstream all this into the base image and docs project.

Added a number of tests (test.md) to validate the link replacer behavior (against test.compare.md), and embedded the test so that the doc build will fail if the link replacer does not behave.

This is still sed, unfortunately.

Signed-off-by: Olivier Gambier <olivier@docker.com>
This commit is contained in:
Olivier Gambier 2015-08-04 22:55:21 -07:00
parent a0c63372fa
commit 3ad11ff363
3 changed files with 48 additions and 19 deletions

16
docs/test.md Normal file
View file

@ -0,0 +1,16 @@
<!--[metadata]>
WHATEVER
<![end-metadata]-->
<!--[metadata]>
WHATEVER AGAIN
<![end-metadata]-->
[display11](/link-1) [display12](/link_2) [display13](/link/3)
[display21](link-1.md) [display22](link_2.md) [display23](link/3.md)
[display31.md](link-1.md) [display32.md](link_2.md) [display33.md](link/3.md)
[display41](./link-1.md) [display42](./link_2.md) [display43](./link/3.md)
[display51](../link-1.md) [display52](../link_2.md) [display53](../link/3.md)
[display61](../../link-1.md) [display62](../../link_2.md) [display63](../../link/3.md)
[display71](link-1.md#something-else) [display62](link_2#else) [display63](#else)
[dont-touch](https://somewhere/foo.md#dont) [dont-touch](https://somewhere/foo.md#dont)