substitution reference).  Such directives must verify
substitution definition context, typically using code like this::

    if not isinstance(state, states.SubstitutionDef):
        error = self.reporter.error(
            'Invalid context: the "%s" directive can only be used '
            'within a substitution definition.' % (name),
            nodes.literal_block(block_text, block_text), line=lineno)
        return [error]
r