from django import template
from django.utils.html import mark_safe

register = template.Library()


@register.simple_tag(takes_context=True)
def render_plugin(context, plugin):
    """
    Render a single plugin. See :mod:`feincms3.renderer` for additional
    details.
    """
    return context['renderer'].render_plugin_in_context(plugin, context)


@register.simple_tag(takes_context=True)
def render_plugins(context, plugins):
    """
    Render and concatenate a list of plugins. See
    :mod:`feincms3.renderer` for additional details.
    """
    renderer = context['renderer']
    return mark_safe(''.join(
        renderer.render_plugin_in_context(plugin, context)
        for plugin in plugins
    ))


@register.simple_tag(takes_context=True)
def render_region(context, regions, region, **kwargs):
    """
    Render a single region. See :class:`~feincms3.renderer.Regions` for
    additional details. Any and all keyword arguments are forwarded to the
    ``render`` method of the ``Regions`` instance.
    """
    return regions.render(region, context, **kwargs)

from django import template
from django.utils.html import mark_safe

register = template.Library()


@register.simple_tag(takes_context=True)
def render_plugin(context, plugin):
    """
    Render a single plugin. See :mod:`feincms3.renderer` for additional
    details.

    In general you should prefer
    :func:`~feincms3.templatetags.feincms3_renderer.render_region` over this
    tag.
    """
    return context['renderer'].render_plugin_in_context(plugin, context)


@register.simple_tag(takes_context=True)
def render_plugins(context, plugins):
    """
    Render and concatenate a list of plugins. See
    :mod:`feincms3.renderer` for additional details.

    In general you should prefer
    :func:`~feincms3.templatetags.feincms3_renderer.render_region` over this
    tag.
    """
    renderer = context['renderer']
    return mark_safe(''.join(
        renderer.render_plugin_in_context(plugin, context)
        for plugin in plugins
    ))


@register.simple_tag(takes_context=True)
def render_region(context, regions, region, **kwargs):
    """
    Render a single region. See :class:`~feincms3.renderer.Regions` for
    additional details. Any and all keyword arguments are forwarded to the
    ``render`` method of the ``Regions`` instance.
    """
    return regions.render(region, context, **kwargs)

Add note to render_plugin[s] that render_region should be preferred
Add note to render_plugin[s] that render_region should be preferred

  from django import template
  from django.utils.html import mark_safe
  
  register = template.Library()
  
  
  @register.simple_tag(takes_context=True)
  def render_plugin(context, plugin):
      """
      Render a single plugin. See :mod:`feincms3.renderer` for additional
      details.
+ 
+     In general you should prefer
+     :func:`~feincms3.templatetags.feincms3_renderer.render_region` over this
+     tag.
      """
      return context['renderer'].render_plugin_in_context(plugin, context)
  
  
  @register.simple_tag(takes_context=True)
  def render_plugins(context, plugins):
      """
      Render and concatenate a list of plugins. See
      :mod:`feincms3.renderer` for additional details.
+ 
+     In general you should prefer
+     :func:`~feincms3.templatetags.feincms3_renderer.render_region` over this
+     tag.
      """
      renderer = context['renderer']
      return mark_safe(''.join(
          renderer.render_plugin_in_context(plugin, context)
          for plugin in plugins
      ))
  
  
  @register.simple_tag(takes_context=True)
  def render_region(context, regions, region, **kwargs):
      """
      Render a single region. See :class:`~feincms3.renderer.Regions` for
      additional details. Any and all keyword arguments are forwarded to the
      ``render`` method of the ``Regions`` instance.
      """
      return regions.render(region, context, **kwargs)
  
Add note to render_plugin[s] that render_region should be preferred
## Code Before:
from django import template
from django.utils.html import mark_safe

register = template.Library()


@register.simple_tag(takes_context=True)
def render_plugin(context, plugin):
    """
    Render a single plugin. See :mod:`feincms3.renderer` for additional
    details.
    """
    return context['renderer'].render_plugin_in_context(plugin, context)


@register.simple_tag(takes_context=True)
def render_plugins(context, plugins):
    """
    Render and concatenate a list of plugins. See
    :mod:`feincms3.renderer` for additional details.
    """
    renderer = context['renderer']
    return mark_safe(''.join(
        renderer.render_plugin_in_context(plugin, context)
        for plugin in plugins
    ))


@register.simple_tag(takes_context=True)
def render_region(context, regions, region, **kwargs):
    """
    Render a single region. See :class:`~feincms3.renderer.Regions` for
    additional details. Any and all keyword arguments are forwarded to the
    ``render`` method of the ``Regions`` instance.
    """
    return regions.render(region, context, **kwargs)

## Instruction:
Add note to render_plugin[s] that render_region should be preferred
## Code After:
from django import template
from django.utils.html import mark_safe

register = template.Library()


@register.simple_tag(takes_context=True)
def render_plugin(context, plugin):
    """
    Render a single plugin. See :mod:`feincms3.renderer` for additional
    details.

    In general you should prefer
    :func:`~feincms3.templatetags.feincms3_renderer.render_region` over this
    tag.
    """
    return context['renderer'].render_plugin_in_context(plugin, context)


@register.simple_tag(takes_context=True)
def render_plugins(context, plugins):
    """
    Render and concatenate a list of plugins. See
    :mod:`feincms3.renderer` for additional details.

    In general you should prefer
    :func:`~feincms3.templatetags.feincms3_renderer.render_region` over this
    tag.
    """
    renderer = context['renderer']
    return mark_safe(''.join(
        renderer.render_plugin_in_context(plugin, context)
        for plugin in plugins
    ))


@register.simple_tag(takes_context=True)
def render_region(context, regions, region, **kwargs):
    """
    Render a single region. See :class:`~feincms3.renderer.Regions` for
    additional details. Any and all keyword arguments are forwarded to the
    ``render`` method of the ``Regions`` instance.
    """
    return regions.render(region, context, **kwargs)
