def markdown_filter(value): """Processes the given value as Markdown, optionally using a particular Markdown style/config Syntax:: {{ value|markdown }} {# uses the "default" style #} {{ value|markdown:"mystyle" }} Markdown "styles" are defined by the `MARKDOWN_DEUX_STYLES` setting. """ return mark_safe(render_func(value))
def cached_render(self): if self.cache_time < 0: return self.content.rendered cache = caches[self.cache_name] cache_key = self._cache_key() rendered = cache.get(cache_key) if rendered is None: rendered = render_func(self.content.raw) # Should reset the database copy, but this is enough for # now cache.set(cache_key, rendered, self.cache_time) return rendered
# -*- coding: utf-8 -*- from .models import MarkitUpPluginModel from django.template import Template from django.utils.safestring import mark_safe from markitup.fields import render_func def process_templatetags(instance, placeholder, rendered_content, original_context): """ This plugin processor render the resulting content to parse for templatetags in the plugin output """ def render(tpl_source): try: template = Template(tpl_source) except Exception, e: return u'<p><strong>Template Error: {}</strong></p>{}'.format( str(e), rendered_content) return template.render(original_context) if isinstance(instance, MarkitUpPluginModel): # this is a markitup field, rendered_content is not anymore a valid # django template. I have to work on the raw content. mark = render(instance.body.raw) html = mark_safe(render_func(mark)) else: html = render(rendered_content) return html
def render_markup(content): return render_func(content)
def render(self, context): value = self.nodelist.render(context) return mark_safe(render_func(value))
def item_description(self, item): return render_func(item.body)
# -*- coding: utf-8 -*- from .models import MarkitUpPluginModel from django.template import Template from django.utils.safestring import mark_safe from markitup.fields import render_func def process_templatetags(instance, placeholder, rendered_content, original_context): """ This plugin processor render the resulting content to parse for templatetags in the plugin output """ def render(tpl_source): try: template = Template(tpl_source) except Exception, e: return u'<p><strong>Template Error: {}</strong></p>{}'.format(str(e), rendered_content) return template.render(original_context) if isinstance(instance, MarkitUpPluginModel): # this is a markitup field, rendered_content is not anymore a valid # django template. I have to work on the raw content. mark = render(instance.body.raw) html = mark_safe(render_func(mark)) else: html = render(rendered_content) return html