culturekings / shopify-shortcodes

Allows you to use Shortcodes within Shopify - Unsupported April 2021
MIT License
111 stars 43 forks source link

Whitespace in Variables #8

Closed baberuth22 closed 8 years ago

baberuth22 commented 8 years ago

My shortcode-render include file automatically gets a whitespace character added onto the end.

I have a page shortcode-test.liquid:

--{% include 'shortcode-render' render:'handletext' -%}--

And the output is

--testout --

Notice the extra space at the end.

I don't want to have to capture and strip every time because there might be 10 variables on the page and I am trying to keep code tight.

{% capture handle %}{% include 'shortcode-test' %}{% endcapture -%}
{%assign realhandle = handle | strip %}
--{{realhandle}}--

Even if I pull the code out of shortcode-render.liquid and replace it with a string (testout), the space persists. It seems like more of a shopify liquid issue, but maybe someone can help.

I've also summarized the issue on shopify github. https://github.com/Shopify/liquid/issues/783

evulse commented 8 years ago

New whitespace control added to liquid fixes this