def __call__(self, text, filter_name=None, **kwargs):
        """
        Applies text-to-HTML conversion to a string, and returns the
        HTML.

        TODO: `filter` should either be a filter_name or a filter class.
        """

        filter_fallback = getattr(settings, 'MARKUP_FILTER_FALLBACK', False)
        if not filter_name and filter_fallback:
            filter_name = filter_fallback

        # Check that the filter_name is a registered markup filter
        if filter_name not in self.filter_list:
            raise ValueError(
                "'%s' is not a registered markup filter. Registered filters are: %s."
                % (filter_name, ', '.join(six.iterkeys(self.filter_list)))
            )
        filter_class = self.filter_list[filter_name]

        # Read global filter settings and apply it
        filter_kwargs = {}
        filter_settings = getattr(settings, 'MARKUP_SETTINGS', {})
        if filter_name in filter_settings:
            filter_kwargs.update(filter_settings[filter_name])
        filter_kwargs.update(**kwargs)

        # Apply the filter on text
        return filter_class().render(text, **filter_kwargs)
def __call__ ( self , text , filter_name = None , ** kwargs ) : filter_fallback = getattr ( settings , 'MARKUP_FILTER_FALLBACK' , False ) if not filter_name and filter_fallback : filter_name = filter_fallback if filter_name not in self . filter_list : raise ValueError ( "'%s' is not a registered markup filter. Registered filters are: %s." % ( filter_name , ', ' . join ( six . iterkeys ( self . filter_list ) ) ) ) filter_class = self . filter_list [ filter_name ] filter_kwargs = { } filter_settings = getattr ( settings , 'MARKUP_SETTINGS' , { } ) if filter_name in filter_settings : filter_kwargs . update ( filter_settings [ filter_name ] ) filter_kwargs . update ( ** kwargs ) return filter_class ( ) . render ( text , ** filter_kwargs )
Applies text-to-HTML conversion to a string, and returns the
        HTML.

        TODO: `filter` should either be a filter_name or a filter class.