Michael Lake wrote:
> Hi all
> 
> I have a problem I think when I use the markup package. This provides 
> markdown, 
> textile and restructuredtext markups. I have the following in views.py:
> 
> def testwiki:
> 
>      content = '''
> Restructured Text Test
> ======================
> 
> How de do.
> 
> Sub Heading
> -----------
> 
> Hi
> '''
> 
> return render_to_response("app/testwiki.html" , {'content': content})
> 
> In testwiki.html I have {{ content|restructuredtext}}
> 
> The page is displayed but there is no heading level 1 i.e. I'm missing 
> "Restructured 
> Text Test". If I place any character above the heading like 'a' then the 
> heading 
> shows fine. It also works fine if I have a H1 anywhere lower down. But If I 
> just wish 
> to have one H1 level Im in problems.
> 
> Maybe this is a restructured text parsing problem? Has anyone seen this?
> 
> Mike

I use something like the following instead, the important difference 
being that it returns the 'html_body' part instead of the 'fragment' 
part. Also, this implementation doesn't check for docutils not being 
installed as the django.contrib.markup templatetag does, as I'm doing 
the HTML translation at Model save time:


from docutils.core import publish_parts
from django.conf import settings

def restructuredtext(value):
     docutils_settings = getattr(settings,
         'RESTRUCTUREDTEXT_FILTER_SETTINGS', {})
     parts = publish_parts(source=value, writer_name='html4css1',
         settings_overrides=docutils_settings)
     return parts['html_body']


Regards,
Jonathan.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to