Opened 17 years ago
Closed 13 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)
by , 17 years ago
Attachment: | filter_sep.patch added |
---|
comment:1 by , 17 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 17 years ago
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 by , 17 years ago
I'm not against allowing spaces, but we probably don't want to allow newlines.
comment:4 by , 17 years ago
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 by , 16 years ago
Keywords: | tplrf-fixed added |
---|
This would be fixed by the refactoring proposed in #7806.
comment:7 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Cleanup/optimization |
comment:8 by , 13 years ago
Easy pickings: | unset |
---|---|
Owner: | changed from | to
UI/UX: | unset |
by , 13 years ago
Attachment: | 4746.patch added |
---|
comment:9 by , 13 years ago
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 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in ddfc7c2530197112fb105b6dd237574bc2fd6b49.
Patch to allow whitespace around template filter separators