def METHOD_NAME(pattern):
    """Default title is extracted from target document."""
    def DocumentRole(typ, rawtext, text, lineno, inliner, options={}, content=[]):
        # type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.Node]]  # NOQA
        env = inliner.document.settings.env
        # split title and target in role content
        has_explicit_title, title, target = split_explicit_title(text)
        title = utils.unescape(title)
        target = pattern.format(utils.unescape(target))
        # create the reference node
        refnode = addnodes.pending_xref(rawtext, reftype='doc', refdomain='std', refexplicit=has_explicit_title)
        # we may need the line number for warnings
        set_role_source_info(inliner, lineno, refnode)  # type: ignore
        # now that the target and title are finally determined, set them
        refnode['reftarget'] = target
        refnode += nodes.inline(rawtext, title, classes=['xref', 'doc'])
        # we also need the source document
        refnode['refdoc'] = env.docname
        refnode['refwarn'] = True
        return [refnode], []
    return DocumentRole