references.py 831 B

1234567891011121314151617181920212223242526272829
  1. # $Id: references.py 7062 2011-06-30 22:14:29Z milde $
  2. # Authors: David Goodger <goodger@python.org>; Dmitry Jemerov
  3. # Copyright: This module has been placed in the public domain.
  4. """
  5. Directives for references and targets.
  6. """
  7. __docformat__ = 'reStructuredText'
  8. from docutils import nodes
  9. from docutils.transforms import references
  10. from docutils.parsers.rst import Directive
  11. from docutils.parsers.rst import directives
  12. class TargetNotes(Directive):
  13. """Target footnote generation."""
  14. option_spec = {'class': directives.class_option,
  15. 'name': directives.unchanged}
  16. def run(self):
  17. pending = nodes.pending(references.TargetNotes)
  18. self.add_name(pending)
  19. pending.details.update(self.options)
  20. self.state_machine.document.note_pending(pending)
  21. return [pending]