Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Yaml ] Use double-quoted for DUMP_MULTI_LINE_LITERAL_BLOCK to allow more characters #39682

Copy link
Copy link
Closed as not planned
@geek-merlin

Description

@geek-merlin
Issue body actions

Background

Yaml is nice for dumping config in a human-readable and -editable format. E.g. Drupal uses it extensively.

In that context, dumping e.g. CSS as multiline is essential for human-readability.

As discovered in #25842, and confirmed on SO and yaml-multiline.info,

  • Yaml multiline is not capable of handling arbitrary characters: escaped unicode characters like \u1234, also "\r" is excluded in current code
  • Double-quoted iscapable of handling arbitrary escaped unicode values, and can span multiple lines

Researched thoroughly, so which are valid multiline literal characters:

  • l-nb-literal-text = ...nb-char+
  • nb-char = c-printable - b-char - c-byte-order-mark = #x9 | [#x20-#x7E] | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] - #xFEFF | [#x10000-#x10FFFF]

As of current code,
a) "\r" is excluded in current code, which means that any multiline string containing it will not be dumped as multiline, but as quoted scalar.
b) All other (non-printable) characters are invalid as multiline literal, so current code will produce invalid yaml.

Which means

  • either we extend the "\r" blacklist with above, so to rather
  • or switch to the following more robust format

Description

  • Do multiline dumping like shown below (or see this fiddle). So we get multiline readability capable to encode every unicode character.

Example

dquote 0: "one\n\
  two (after every litaral newline, we add an escaped yaml newline)"
dquote 1: "one\n\
  two\n\
  "
dquote 2: "one\n\
  two\n\
  \n\
  "
dquote with initial space: "  one  \n\
    two  \n\
  \  as we see, trailing spaces are no problem, but we need to escape initial spaces on non-first line.  "

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRFC = Request For Comments (proposals about features that you want to be discussed)RFC = Request For Comments (proposals about features that you want to be discussed)StalledYaml

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.