Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-8476

Incorrect handling of white space surrounding comments in EPP

    Details

    • Template:
    • Team:
      Platform Core
    • Sub-team:
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      EPP comments {{<%# Like this %>}} always trimmed preceding whitespace. This is different from ERB making it more difficult to migrate ERB templates to EPP. There was also no way of making EPP preserve those spaces.

      Now, EPP comment does not trim preceding whitespace by default, and a new left trimming tag {{<%#-}} has been added.

      This is a backwards incompatibility in that code like this:
      {code}
      Before <%# comment %>after
      {code}
      resulted in the string {{"Beforeafter"}}, whereas now it will be "Before after".
      Show
      EPP comments {{<%# Like this %>}} always trimmed preceding whitespace. This is different from ERB making it more difficult to migrate ERB templates to EPP. There was also no way of making EPP preserve those spaces. Now, EPP comment does not trim preceding whitespace by default, and a new left trimming tag {{<%#-}} has been added. This is a backwards incompatibility in that code like this: {code} Before <%# comment %>after {code} resulted in the string {{"Beforeafter"}}, whereas now it will be "Before after".
    • QA Risk Assessment:
      Needs Assessment

      Description

      An EPP comment preceded by any number of spaces or tabs will not produce those spaces or tabs on output:

      inline_epp("some   \t\t   <%#%>text")) # returns 'sometext'
      inline_epp("some<%#%> text")) # returns 'some text'
      

      I can't find anything in the documentation that supports this. The code contains this comment and a regexp. It would make sense if the regexp was anchored at the beginning of line (and if the behavior was documented) but it isn't.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                thomas.hallgren Thomas Hallgren
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: