Prepare for conditionally escaping Markdown based on user settings.
Review Request #6467 — Created Oct. 20, 2014 and submitted
Previously, we assumed that plain text should always be Markdown-escaped
for editing purposes. However, when Markdown becomes optional, we won't
always want to do this. Instead, we want to take the user's settings
into account, and only escape if the text isn't already in Markdown and
the user has chosen to edit in Markdown by default.A couple of new Markdown utility functions were added to normalize text
for editing and for determining if a user wants to edit in Markdown by
default. The latter is hard-coded to True right now.New template tags have been added for this new normalization. The old
markdown_escape filter has been removed. Templates now contain the
proper edit state for the user.
Unit tests pass.
Toggled the user default on and saw that all Markdown fields on review requests
and review replies were showing up as Markdown, and that plain text fields were
being escaped for edit.Toggled it off and saw that both Markdown and plain text fields were represented
as-is, without any escaping.
Description | From | Last Updated |
---|---|---|
undefined name 'request' |
reviewbot | |
list comprehension redefines 'file_attachment' from line 578 |
reviewbot | |
Can you flip this sentence around? This will normalize text for editing based on the rich_text flag and the user … |
david | |
list comprehension redefines 'file_attachment' from line 578 |
reviewbot |
- Change Summary:
-
Fixed a missing variable caused by a last-minute removal of the reference.
- Commit:
-
39a32096378b2485b11173d5a83d3de9da4441d0f0c6024c2e98be9f32d01f3d5416177735df09cb
- Diff:
-
Revision 2 (+108 -56)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/reviews/markdown_utils.py reviewboard/reviews/fields.py reviewboard/reviews/templatetags/reviewtags.py reviewboard/reviews/context.py Ignored Files: reviewboard/templates/reviews/boxes/review.html reviewboard/templates/reviews/review_header.html reviewboard/templates/reviews/reviewable_page_data.js reviewboard/templates/reviews/review_reply.html reviewboard/templates/reviews/boxes/change.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/reviews/markdown_utils.py reviewboard/reviews/fields.py reviewboard/reviews/templatetags/reviewtags.py reviewboard/reviews/context.py Ignored Files: reviewboard/templates/reviews/boxes/review.html reviewboard/templates/reviews/review_header.html reviewboard/templates/reviews/reviewable_page_data.js reviewboard/templates/reviews/review_reply.html reviewboard/templates/reviews/boxes/change.html
-