#Inconsistencies with leading/trailing spaces?

8 messages · Page 1 of 1 (latest)

rotund sun
#

I'm trying to understand why some of the values in the second column aren't a b c. The code is:

set stack(dir: ltr)
table(
  columns: 2,

  [String concat],        "a" + " b " + "c",
  [String stack],   stack("a" , " b " , "c"),
  [Content concat],       [a] + [ b ] + [c],
  [Content stack],  stack([a] , [ b ] , [c]),
)

"String concat" and "content concat" make sense. "String stack" almost makes sense but ends up making the least sense since the leading space is preserved but not the trailing space. "Content stack" doesn't make sense because content blocks clearly do preserve leading/trailing spaces as demonstrated by "content concat", but they aren't preserved inside of other elements for some reason?

I assume this is intentional behavior, so is there any explanation or pattern for it?

burnt plaza
#

Content stack makes sense because trailing and leading space is only conserved for the purpose of joining with other content

#

If you're treating them as individual content, like in a stack, then it's stripped

rotund sun
#

Ahh, gotcha. So that's just straight-up the intended behavior. Thanks!

burnt plaza
#

The one that confuses me a bit is the string stack. I would've expected it to behave the same as the content one

rotund sun
#

Yeah, it seems really weird that it would be half-and-half like that. Bug perhaps?

burnt plaza
#

Maybe. But there could be an explanation I'm not thinking of.

#

?render #block(stroke:1pt," a ")