Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#10508 closed (fixed)

Missing syntax highlighting in view code snippets in formset documentation

Reported by: Paul Menzel <paulepanter@…> Owned by: Jacob
Component: Documentation Version: 1.0
Severity: Keywords: syntax error pycamp2009
Cc: Manuel Kaufmann Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Dear developers,

there is no syntax highlighting in the first code snippet for an example view in [1].

Thanks,

Paul

[1] http://docs.djangoproject.com/en/dev/topics/forms/formsets/#using-a-formset-in-views-and-templates

Attachments (1)

10508.diff (1.2 KB) - added by Matt Boersma 8 years ago.
Patch to turn on code highlighting for two sections in the topics/auth document

Download all attachments as: .zip

Change History (11)

comment:1 Changed 8 years ago by Paul Menzel <paulepanter@…>

Summary: Missing syntax highlighting in Using a formset in views and templatesMissing syntax highlighting in view code snippets in formset documentation

comment:2 Changed 8 years ago by Paul Menzel <paulepanter@…>

Dear developers,

I am going to just add more links to section were the code is not syntax highlighted.

Thanks,

Paul

http://docs.djangoproject.com/en/dev/topics/auth/#authentication-in-web-requests

http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.login

comment:3 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:4 Changed 8 years ago by Tim Graham

Looks like the syntax highlighting is failing due to the if/else statements that only have comments nested in them instead of actual python code.

example:

if formset.is_valid():
  # do something with the formset.cleaned_data

Changed 8 years ago by Matt Boersma

Attachment: 10508.diff added

Patch to turn on code highlighting for two sections in the topics/auth document

comment:6 Changed 8 years ago by Tim Graham

Does the patch actually highlight the code when you build it, mboersma? I tried applying your patch and it doesn't highlight the text. Like I said before, I think this issue has to do with the syntax highlighting parser failing due to what is technically invalid python (when a comment is used to describe what to do instead of writing python statements).

comment:7 Changed 8 years ago by Manuel Kaufmann

Cc: Manuel Kaufmann added
Keywords: pycamp2009 added

I found a good description for this in http://bitbucket.org/birkenfeld/sphinx/src/bfda544c3193/doc/markup/code.rst (Line 32), it says that if the python code is invalid it will not be highlighted. So, when the code is interpret, the comments are deleted and then the code is invalid.

If you add pass below the line that contains the comment, it disappear. I can't find how to disable this option in Sphinx.

comment:8 Changed 8 years ago by Jacob

Owner: changed from nobody to Jacob
Status: newassigned

comment:9 Changed 8 years ago by Jacob

Resolution: fixed
Status: assignedclosed

(In [10371]) Fixed a whole bunch of small docs typos, errors, and ommissions.

Fixes #8358, #8396, #8724, #9043, #9128, #9247, #9267, #9267, #9375, #9409, #9414, #9416, #9446, #9454, #9464, #9503, #9518, #9533, #9657, #9658, #9683, #9733, #9771, #9835, #9836, #9837, #9897, #9906, #9912, #9945, #9986, #9992, #10055, #10084, #10091, #10145, #10245, #10257, #10309, #10358, #10359, #10424, #10426, #10508, #10531, #10551, #10635, #10637, #10656, #10658, #10690, #10699, #19528.

Thanks to all the respective authors of those tickets.

comment:18 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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