Opened 16 years ago
Closed 11 years ago
#4746 closed Cleanup/optimization (fixed)
[patch] Allow whitespace before and after filter separator
Reported by: | Owned by: | Aymeric Augustin | |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | template filter separator whitespace tplrf-fixed |
Cc: | sciyoshi@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It always bugged me that I couldn't do {{ variable | filter }} because of the spaces around the pipe. It seems to me that this looks cleaner, although it may have been a design choice not to allow this.
Anyways, here's the patch.
Samuel Cormier-Iijima
Attachments (2)
Change History (12)
Changed 16 years ago by
Attachment: | filter_sep.patch added |
---|
comment:1 Changed 16 years ago by
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:2 Changed 16 years ago by
I would like to support this change. Right now I'm a django starter and took some time for me to figure out that a simple space was getting my hair off my head. Although the documentation http://www.djangoproject.com/documentation/templates/#filters show the example without spaces, seeing the way filters work just give the same feeling of using a pipe in a shell script, with or without spaces.
comment:3 Changed 16 years ago by
I'm not against allowing spaces, but we probably don't want to allow newlines.
comment:4 Changed 16 years ago by
Just my +1 to this feature (no voting in this ticket engine? would be nice to have). It is slightly inconsistent that Django site logic is written in Python where whitespaces in the code (do not confuse with indentation) do not matter, templates are written mostly in HTML where whitespaces do not alter the rendered output, but the whitespaces inside the filter declarations do matter.
comment:5 Changed 15 years ago by
Keywords: | tplrf-fixed added |
---|
This would be fixed by the refactoring proposed in #7806.
comment:7 Changed 13 years ago by
Severity: | → Normal |
---|---|
Type: | → Cleanup/optimization |
comment:8 Changed 12 years ago by
Easy pickings: | unset |
---|---|
Owner: | changed from nobody to Aymeric Augustin |
UI/UX: | unset |
Changed 11 years ago by
Attachment: | 4746.patch added |
---|
comment:9 Changed 11 years ago by
Needs tests: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
This is really a very simple change and it looks reasonable to me.
The current behavior (raising TemplateSyntaxError for spaces around the |
) was tested. AFAICT this test exists mostly for completeness and it reasonable to change it if we make the filter syntax less strict.
This may be a sensitive design change. I'll leave the patch in RFC for a few days so that other core devs can get a chance to review or veto it.
comment:10 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in ddfc7c2530197112fb105b6dd237574bc2fd6b49.
Patch to allow whitespace around template filter separators