#10508 closed (fixed)
Missing syntax highlighting in view code snippets in formset documentation
Reported by: | 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: | no | UI/UX: | no |
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)
Change History (11)
comment:1 Changed 13 years ago by
Summary: | Missing syntax highlighting in Using a formset in views and templates → Missing syntax highlighting in view code snippets in formset documentation |
---|
comment:2 Changed 13 years ago by
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 13 years ago by
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:4 Changed 13 years ago by
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
comment:5 Changed 13 years ago by
Dear Developers,
ok seems to be something generic. I just post some more links I found.
Thanks,
Paul
http://docs.djangoproject.com/en/dev/topics/db/models/#many-to-one-relationships
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey
http://www.djangoproject.com/documentation/models/one_to_one/
Changed 13 years ago by
Attachment: | 10508.diff added |
---|
Patch to turn on code highlighting for two sections in the topics/auth document
comment:6 Changed 13 years ago by
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 13 years ago by
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 13 years ago by
Owner: | changed from nobody to Jacob |
---|---|
Status: | new → assigned |
comment:9 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(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.
Dear developers,
the same is the case in [2].
Thanks,
Paul
[2] http://docs.djangoproject.com/en/dev/topics/forms/formsets/#using-more-than-one-formset-in-a-view