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

Incorrect handling of white space surrounding comments in EPP

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 6.0.0
    • Component/s: Docs, Language
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Sub-team:
    • Team:
      Platform Core
    • 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

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support