Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#33329 closed New feature (invalid)

Allow more whitespace control on template tags

Reported by: sur.la.route Owned by: nobody
Component: Template system Version: 3.2
Severity: Normal Keywords: space control template
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When putting template tags inside of html attributes the surrounding whitespace is not removed.

For example a readable template

<input value="{% if a %}
                 this
              {% else %}
                  that
              {% endif %}">

It not parsed onto a single line, which is needed. How about adding the option -%} to remove whitespace between the tag end and contents?

Change History (3)

comment:1 by Mariusz Felisiak, 3 years ago

Resolution: invalid
Status: newclosed

Thanks for this ticket, however there is no need for a new syntax, you can use {% spaceless %} for removing whitespace in rendered HTML.

comment:2 by sur.la.route, 3 years ago

Does that remove space inside attributes as well? Not just in surrounding html?

in reply to:  2 comment:3 by Mariusz Felisiak, 3 years ago

Replying to sur.la.route:

Does that remove space inside attributes as well? Not just in surrounding html?

You can use spaceless around the value, e.g.

<input value="{% spaceless %}{% if a %}
         this
      {% else %}
          that
      {% endif %}{% endspaceless %}">

Please use one of support channels if you have further questions.

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