Creates a package-list URL and a link base from a docroot element.

    Args:
        app: the global app object
        root: the docroot element [string or dictionary]

def normalize_docroot(app, root):
    """Creates a package-list URL and a link base from a docroot element.

    Args:
        app: the global app object
        root: the docroot element [string or dictionary]
    """

    srcdir = app.env.srcdir
    default_version = app.config.javalink_default_version

    if isinstance(root, basestring):
        (url, base) = _parse_docroot_str(srcdir, root)
        return {'root': url, 'base': base, 'version': default_version}
    else:
        normalized = {}
        normalized['root'] = _parse_docroot_str(srcdir, root['root'])[0]

        if 'base' in root:
            normalized['base'] = _parse_docroot_str(srcdir, root['base'])[1]
        else:
            normalized['base'] = _parse_docroot_str(srcdir, root['root'])[1]

        if 'version' in root:
            normalized['version'] = root['version']
        else:
            normalized['version'] = default_version

        return normalized