makes a get_document function available in templates

/cc @dpford