A simple rest template filter

1
2
3
4
5
6
7
8
from django.template import Library
from docutils.core import publish_parts

@register.filter
def rest(value, arg):
    arg = arg or 'html'
    parts = publish_parts(value, writer_name=arg)
    return parts['html_body']

More like this

  1. Template filters utils by marinho 6 years, 5 months ago
  2. Date/time util template filters by marinho 6 years, 5 months ago
  3. Add delete buttons to admin changelist by kylefox 6 years, 10 months ago
  4. RESTful class dispatch by Phoenix 4 years, 10 months ago
  5. Convert numbers in USA notation to brazilian notation by eOliva 5 years, 6 months ago

Comments

zgoda (on November 15, 2007):

Why would one need to reinvent the wheel? There is already ReST filter in markup contrib library.

#

marinho (on November 16, 2007):

hummm... it's truth, I not knew this :/ thanks :)

#

(Forgotten your password?)