Opened 14 years ago

Closed 12 years ago

#14449 closed Cleanup/optimization (wontfix)

restructuredtext filter does not return the correct content

Reported by: Julian Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords: markup, restructuredtext
Cc: robinchew@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I'm using the django.contrib.flatpages with restructuredtext markup. I've tested it with a small

Disclaimer
==========

This is a *test*.

After all, the disclaimer part is not rendered. This happens because the renderer returns a parts and its fragment key is used. The docutils doc reads that the fragment does not contain the document title. I've added a patch which makes use of the html_body key.

Attachments (1)

markup-rest.diff (2.7 KB ) - added by Julian 14 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 by Julian, 14 years ago

working on a proper patch.

by Julian, 14 years ago

Attachment: markup-rest.diff added

comment:2 by Julian, 14 years ago

check.

comment:3 by Daniel F Moisset, 14 years ago

Owner: changed from nobody to Daniel F Moisset

triaging

comment:4 by Daniel F Moisset, 14 years ago

Owner: changed from Daniel F Moisset to nobody
Triage Stage: UnreviewedReady for checkin

The patch looks ok. The generated output adds a <div> element around the content but I think that's reasonable

comment:5 by Russell Keith-Magee, 14 years ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

Adding a diff where one didn't exist previously is a pretty big backwards incompatibility. I'm not sure what the right way forward is here, but the existing test cases must pass without modification.

Three suggestions:

  • Automated inspection of the document contents; if it contains parts that aren't rendered as part of fragment, *then* include the div.
  • An argument that turns on 'full document' insertion
  • A second template filter. I'd rather not go down this path; I'm really only mentioning it for completeness.

comment:6 by Gabriel Hurley, 14 years ago

Component: Contrib appscontrib.contenttypes

comment:7 by Julien Phalip, 14 years ago

Component: contrib.contenttypesDocumentation
Easy pickings: unset
Severity: Normal
Type: Cleanup/optimization

You can invert this default docutils behaviour using this setting:

RESTRUCTUREDTEXT_FILTER_SETTINGS = {
    'doctitle_xform': False,
}

RESTRUCTUREDTEXT_FILTER_SETTINGS is already mentioned in the contrib.markup doc, but this seems like a frequent enough use case to add a note about this particular setting. So what we need here is a documentation patch.

comment:8 by Robin, 13 years ago

Cc: robinchew@… added
UI/UX: unset

comment:9 by Robin, 13 years ago

Version: 1.21.3

Replying to julien

I find that doctitle_xform:false will cause problem with section numbering.
Consider the following:

.. section-numbering::

Title
=====

Sub Title
---------

Sub Title
---------

if doctitle_xform is true and if django.contrib.markup.templatetags.markup.restructuredtext returns parts fragment, the rst code will produce:

1 Sub Title

2 Sub Title

if doctitle_xform is false and if django.contrib.markup.templatetags.markup.restructuredtext returns parts fragment, the rst code will produce:

1 Title

1.1 Sub Title

1.2 Sub Title

None of the result above is exactly right. I personally think the correct result should be:

Title

1 Sub Title

2 Sub Title

But how do I achieve that without writing my own restructuredtext function?

comment:10 by Tim Graham, 12 years ago

Resolution: wontfix
Status: newclosed

There are plans to deprecate contrib.markup (#18054) so marking this as won't fix.

Note: See TracTickets for help on using tickets.
Back to Top