Stash icon indicating copy to clipboard operation
Stash copied to clipboard

Stash Set/Append and Whitespace

Open leigeber opened this issue 10 years ago • 6 comments

I am trying to build out a query for the query module and despite having a trailing/leading whitespacing when setting or appending it gets stripped. I thought trim was set to no by default but even specifically setting it doesn't seem to help. Any thoughts? Thanks.

leigeber avatar Sep 20 '13 03:09 leigeber

Scratch this, I'm pretty sure this was blatant user error. Sorry for the false alarm.

leigeber avatar Sep 20 '13 04:09 leigeber

Actually I was just able to replicate this...

{exp:stash:set name="test"} test {/exp:stash:set} {exp:stash:append name="test" trim="no"} 123 {/exp:stash:append} {exp:stash:get name="test"}

If you have a line break on both the gap between test and 123 closes. If you close up either the set or the append it opens back up. Strange..

leigeber avatar Sep 20 '13 05:09 leigeber

Stash doesn't do any trimming unless you specifically ask it to. EE trims whitespace in params automatically, but I didn't think it did that for tagdata enclosed by a tag pair, unless that's changed.

Are you testing this on windows or mac? EE 2.7?

croxton avatar Sep 20 '13 09:09 croxton

EE 2.7 w/ Windows. Thanks.

leigeber avatar Sep 20 '13 17:09 leigeber

It's a windows line-break thing for sure, but Stash isn't doing anything other than concatenating the strings it gets passed when it appends/prepends. It could be EE's template class that's causing this behaviour. I have a windows box somewhere so I'm going to do some tests and see if I can work out where this is happening.

croxton avatar Sep 24 '13 16:09 croxton

Wasn't able to reproduce this on my windows box. Leaving open in case anyone can shed light.

croxton avatar Dec 06 '13 10:12 croxton