Changed internal build process, now compiles then write.  Added getLink().

The writer now uses a compiled set of references which allows for getLink() to
provide relative paths to other documents which might be related to the
one you're working on.  This is useful inside the templating.
Move write() method for consistency.
Rebuilt doc for writer.