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

Add # alt flag to String format %p to force double quoted output

    XMLWordPrintable

Details

    • Enhancement
    • Hide
      It is now possible to force formatting of a string to only use double quotes instead of dynamically determining if single quotes can be used. This is achieved by using the "alternative format flag" `#` when specifying the string format given to `String.new`.
      Show
      It is now possible to force formatting of a string to only use double quotes instead of dynamically determining if single quotes can be used. This is achieved by using the "alternative format flag" `#` when specifying the string format given to `String.new`.
    • Needs Assessment

    Description

      When formatting strings with String.new the formatting rules select single or double quotes depending on the contents of the string. If it can be output as a single quoted string it will produce single quote delimiters, otherwise double quote.

      This is bad when the result must have double quotes and there is currently no way to force the string formatter to enforce double quotes.

      To support this, we can add support for "alternate form" using # to the %p format and let that mean "use double quotes" - this then applies to all string format that produce a quoted output.

      Attachments

        Activity

          People

            Unassigned Unassigned
            henrik.lindberg Henrik Lindberg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support