def _directive_checks(self):
# Check if file insertion is enabled
if not self.state.document.settings.file_insertion_enabled:
msg = (
'File and URL access deactivated. '
'Ignoring directive "{}".'.format(self._get_directive_name())
)
warning = nodes.warning(
'', self.state_machine.reporter.warning(
'', nodes.literal_block('', msg),
line=self.lineno
)
)
return [warning]
# Check that no content and argument are used at the same time
if self.arguments and self.content:
warning = self.state_machine.reporter.warning(
'{} directive cannot have both content and a filename '
'argument.'.format(self._get_directive_name()),
line=self.lineno
)
return [warning]
# Check that at least one was provided
if not (self.arguments or self.content):
warning = self.state_machine.reporter.warning(
'{} directive must have content or a filename '
'argument.'.format(self._get_directive_name()),
line=self.lineno
)
return [warning]
return None
评论列表
文章目录