When the doctree has been read in, and ``include`` directives have been
    executed and replaced with the included file, walk the tree via
    LinkToRefVisitor.

def on_doctree_read(_, doctree):
    """
    When the doctree has been read in, and ``include`` directives have been
    executed and replaced with the included file, walk the tree via
    LinkToRefVisitor.
    """
    docname = os.path.splitext(
        os.path.basename(doctree.attributes['source']))[0]
    if docname == 'changes':
        ref_mapping = {
            'http://awslimitchecker.readthedocs.io/en/latest/limits.html#ec2':
                [
                    label_ref_node, docname, 'limits.ec2',
                    'the EC2 limit documentation'
                ],
            'https://awslimitchecker.readthedocs.io/en/latest/awslimitchecker.'
            'limit.html#awslimitchecker.limit.AwsLimit.get_limit':
                [
                    meth_ref_node, docname,
                    'awslimitchecker.limit.AwsLimit.get_limit'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/'
            'getting_started.html#trusted-advisor':
                [
                    label_ref_node, docname, 'getting_started.trusted_advisor',
                    'Getting Started - Trusted Advisor'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/awslimitchecker.'
            'checker.html#awslimitchecker.checker.AwsLimitChecker.'
            'check_thresholds':
                [
                    meth_ref_node, docname,
                    'awslimitchecker.checker.AwsLimitChecker.check_thresholds'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/awslimitchecker.'
            'checker.html#awslimitchecker.checker.AwsLimitChecker.find_usage':
                [
                    meth_ref_node, docname,
                    'awslimitchecker.checker.AwsLimitChecker.find_usage'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/awslimitchecker.'
            'checker.html#awslimitchecker.checker.AwsLimitChecker.get_limits':
                [
                    meth_ref_node, docname,
                    'awslimitchecker.checker.AwsLimitChecker.get_limits'
                ]
        }
        doctree.walk(LinkToRefVisitor(doctree, ref_mapping))
    if docname == 'index':
        ref_mapping = {
            'http://awslimitchecker.readthedocs.io/en/latest/'
            'getting_started.html':
                [
                    label_ref_node, docname, 'getting_started',
                    'Getting Started'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/'
            'getting_started.html#credentials':
                [
                    label_ref_node, docname, 'getting_started.credentials',
                    'Credentials'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/getting_help.html':
                [
                    label_ref_node, docname, 'getting_help',
                    'Getting Help'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/getting_help.html'
            '#enterprise-support-agreements-and-contract-development':
                [
                    label_ref_node, docname, 'getting_help.paid_support',
                    'Enterprise Support Agreements and Contract Development'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/changes.html':
                [
                    label_ref_node, docname, 'changes',
                    'Changelog'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/'
            'development.html#agpl-license':
                [
                    label_ref_node, docname, 'development.agpl',
                    'Development / AGPL'
                ],
            'http://awslimitchecker.readthedocs.org/en/latest/'
            'development.html#pull-requests':
                [
                    label_ref_node, docname, 'development.pull_requests',
                    'development documentation'
                ],
            'http://awslimitchecker.readthedocs.io/en/latest/'
            'getting_started.html#trusted-advisor':
                [
                    label_ref_node, docname, 'getting_started.trusted_advisor',
                    'Getting Started - Trusted Advisor'
                ]
        }
        doctree.walk(LinkToRefVisitor(doctree, ref_mapping))