  
  .. note::
      Notice how we used ``self`` to scope the ``CycleNode`` specific information
      within the ``render_context``. There may be multiple ``CycleNodes`` in a
      given template, so we need to be careful not to clobber another node's state
      information. The easiest way to do this is to always use ``self`` as the key
      into ``render_context``. If you're keeping track of several state variables,
      make ``render_context[self]`` a dictionary.
  
  Registering the tag
  ~~~~~~~~~~~~~~~~~~~
  
  Finally, register the tag with your module's ``Library`` instance, as explained
 
</s> remove in "Writing custom template filters" above. Example::
 </s> add in "Writing custom template filters" above. Example:

.. code-block:: python </s> remove ``render_context`` behaves like a Python dictionary, and should be used to store
``Node`` state between invocations of the ``render`` method.
 </s> add ``render_context`` behaves like a Python dictionary, and should be used to
store ``Node`` state between invocations of the ``render`` method. </s> remove Let's refactor our ``CycleNode`` implementation to use the ``render_context``::
 </s> add Let's refactor our ``CycleNode`` implementation to use the ``render_context``:

.. code-block:: python </s> remove tag is used inside a ``{% autoescape off %}`` block.
 </s> add tag is used inside a :ttag:`{% autoescape off %}<autoescape>` block. </s> remove A couple of things to note about the ``simple_tag`` helper function:
 </s> add A few things to note about the ``simple_tag`` helper function:
    given template, so we need to be careful not to clobber another node's
    state information. The easiest way to do this is to always use ``self`` as
    the key into ``render_context``. If you're keeping track of several state
    variables, make ``render_context[self]`` a dictionary.
  
  .. note::
      Notice how we used ``self`` to scope the ``CycleNode`` specific information
      within the ``render_context``. There may be multiple ``CycleNodes`` in a
    given template, so we need to be careful not to clobber another node's
    state information. The easiest way to do this is to always use ``self`` as
    the key into ``render_context``. If you're keeping track of several state
    variables, make ``render_context[self]`` a dictionary.
    given template, so we need to be careful not to clobber another node's
    state information. The easiest way to do this is to always use ``self`` as
    the key into ``render_context``. If you're keeping track of several state
    variables, make ``render_context[self]`` a dictionary.
    given template, so we need to be careful not to clobber another node's
    state information. The easiest way to do this is to always use ``self`` as
    the key into ``render_context``. If you're keeping track of several state
    variables, make ``render_context[self]`` a dictionary.
    given template, so we need to be careful not to clobber another node's
    state information. The easiest way to do this is to always use ``self`` as
    the key into ``render_context``. If you're keeping track of several state
    variables, make ``render_context[self]`` a dictionary.
  
  Registering the tag
  ~~~~~~~~~~~~~~~~~~~
  
  Finally, register the tag with your module's ``Library`` instance, as explained
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Brushed up the custom template tag 'howto' guide by moving the assignment_tag doc to a more appropriate place (i.e. under the "Setting a variable in the context" section), adding cross references, fixing a few minor inaccuracies and doing a little PEP8 cleanup.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16909 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
docs/howto/custom-template-tags.txt