Skip to content

docs/tour/types/stringlit: prose explaining multi-line string whitespace is technically incorrect  #174

Closed
@jpluscplusm

Description

@jpluscplusm

What page were you looking at?

https://cuelang.org/docs/tour/types/stringlit/

What version of the site were you looking at?

cue-lang/cuelang.org@fccf480

What did you do?

I tried to rely on this phrase when writing a multi-line string that contains blank lines:

Any whitespace before the closing quotes must also prefix the lines between the quotes, because it is removed from all lines.

What did you expect?

I expected that blank lines inside a multi-line string would require the string's standard whitespace prefix.

What did you see instead?

The prefix is not required when the intent is to encode a blank line:

exec cue export foo.cue
cmp stdout out
-- foo.cue --
x: """
	The next line is totally blank.

	The next line is blank, but the CUE has a tab prefix
	
	This is the last line.
	"""
-- out --
{
    "x": "The next line is totally blank.\n\nThe next line is blank, but the CUE has a tab prefix\n\nThis is the last line."
}

(This example doesn't make it clear via the web view, but the copy button does generate the correct underlying txtar that demonstrates the corner case)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions