Extension for restructuredtext filter a django.contrib.markup
    
    
    
      
      
      
        
As suggested at 0 I browserd markup sorce code1 to see how does restructuredtext filter work. I founded that it returns only the fragment part instead on other contet. I suggest an argument fot the filter to be used in parts[arg].
The suggested implementation is, as follow (two small changes):
def restructuredtext(value, arg="fragment"):
    try:
        from docutils.core import publish_parts
    except ImportError:
        if settings.DEBUG:
            raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed."
        return force_unicode(value)
    else:
        docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {})
        parts = publish_parts(source=smart_str(value), writer_name="html4css1", settings_overrides=docutils_settings)
        return mark_safe(force_unicode(parts[arg]))
restructuredtext.is_safe = True
[0] http://docs.djangoproject.com/en/dev/ref/contrib/#ref-contrib-markup
[1] http://code.djangoproject.com/browser/django/trunk/django/contrib/markup/templatetags/markup.py
       
     
   
 
      
        
        
          Change History
          (8)
        
          
  
  
  
    
      | Component: | 
      
        Uncategorized → Contrib apps
       | 
    
  
 
           
          
          
  
  
  
    
      | Triage Stage: | 
      
        Unreviewed → Design decision needed
       | 
    
  
 
           
          
          
  
  
  
    
      | Component: | 
      
        Contrib apps → contrib.markup
       | 
    
  
 
           
          
  
  
  
    
      | Severity: | 
      
        → Normal
       | 
    
    
      | Type: | 
      
        → New feature
       | 
    
  
 
           
          
          
  
  
  
    
      | Easy pickings: | 
      
        unset
       | 
    
    
      | Resolution: | 
      
        → duplicate
       | 
    
    
      | Status: | 
      
        new → closed
       | 
    
    
      | UI/UX: | 
      
        unset
       | 
    
  
 
           
          
         
       
     
        
    
    
Milestone post-1.0 deleted