sempare / sempare-delphi-template-engine

Sempare Template (scripting) Engine for Delphi allows for flexible dynamic text generation. It can be used for generating email, html, reports, source code, xml, configuration, etc.
Apache License 2.0
144 stars 18 forks source link

Extend whitespace/newline removal support #117

Closed darnocian closed 1 year ago

darnocian commented 1 year ago

There is some support for removal of whitespace / newlines using options on the context and using tags <| and |>. However, this is still not flexible enough.

Proposal is to deprecate the current behaviours, and to extend the open / closing script tag sequence using - and *.

<%- would strip any whitespace to the left to the start of the current line. -%> would strip any whitespace to the right to the end of the current line. <% would strip any whitespace and new lines to the left until the first non-whitespace character is reached. %> would strip any whitespace and new lines to the right until the first non-whitespace character is reached.

e.g.

     <%- if cond %>
         <%* value %>
     <%* end *%>
darnocian commented 1 year ago

lexer already updated on the whitesplate_trim_improvements branch. the streamwriter needs to be updated: