Django

Code

Ticket #10508 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Missing syntax highlighting in view code snippets in formset documentation

Reported by: Paul Menzel <paulepanter@users.sourceforge.net> Assigned to: jacob
Milestone: 1.1 Component: Documentation
Version: 1.0 Keywords: syntax error pycamp2009
Cc: humitos Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

10508.diff (1.2 kB) - added by mboersma on 03/19/09 16:02:10.
Patch to turn on code highlighting for two sections in the topics/auth document

Change History

03/15/09 05:40:19 changed by Paul Menzel <paulepanter@users.sourceforge.net>

  • needs_better_patch changed.
  • summary changed from Missing syntax highlighting in Using a formset in views and templates to Missing syntax highlighting in view code snippets in formset documentation.
  • needs_tests changed.
  • needs_docs changed.

03/15/09 06:10:32 changed by Paul Menzel <paulepanter@users.sourceforge.net>

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

03/15/09 09:42:41 changed by jacob

  • stage changed from Unreviewed to Accepted.
  • milestone set to 1.1.

03/15/09 11:39:22 changed by timo

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

03/15/09 19:58:21 changed by Paul Menzel <paulepanter@users.sourceforge.net>

03/19/09 16:02:10 changed by mboersma

  • attachment 10508.diff added.

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

03/19/09 17:08:45 changed by timo

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).

03/23/09 17:00:35 changed by humitos

  • cc set to humitos.
  • keywords changed from syntax error to syntax error pycamp2009.

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.

04/02/09 13:43:06 changed by jacob

  • owner changed from nobody to jacob.
  • status changed from new to assigned.

04/03/09 13:30:55 changed by jacob

  • status changed from assigned to closed.
  • resolution set to fixed.

(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.


Add/Change #10508 (Missing syntax highlighting in view code snippets in formset documentation)




Change Properties
Action