Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitespace trimming doesn't work like examples in Liquid docs #377

Open
agersant opened this issue Jan 6, 2020 · 6 comments
Open

Whitespace trimming doesn't work like examples in Liquid docs #377

agersant opened this issue Jan 6, 2020 · 6 comments
Labels
bug Not as expected

Comments

@agersant
Copy link
Contributor

agersant commented Jan 6, 2020

liquid-rust version: 0.19
rust version: nightly
OS: Windows

When using {%- -%} to open and close a tag, some unwanted whitespace still appears in the rendered document.
Looking at the example at the bottom of this page for reference, I would expect the following template render to look correctly indented:

return {
	type = "spritesheet",
	content = {
		texture = "{{ sheet_image | replace: "\", "/" }}",
		frames = {
			{%- for frame in frames -%}
			frame_{{ frame.index }} = { x = {{ frame.x }}, y = {{ frame.y }}, w = {{ frame.width }}, h = {{ frame.height }}, },
			{%- endfor -%}
		},
	},
};

Instead, the result looks like:

return {
	type = "spritesheet",
	content = {
		texture = "assets/texture/sprite/duran.png",
		frames = {
						frame_0 = { x = 0, y = 0, w = 33, h = 27, },
						frame_1 = { x = 33, y = 0, w = 25, h = 44, },
						frame_2 = { x = 58, y = 0, w = 35, h = 34, },
						frame_3 = { x = 93, y = 0, w = 35, h = 31, },
						frame_4 = { x = 128, y = 0, w = 25, h = 29, },
						frame_5 = { x = 153, y = 0, w = 19, h = 41, },
						frame_6 = { x = 172, y = 0, w = 20, h = 43, },
						frame_7 = { x = 192, y = 0, w = 20, h = 44, },
						frame_8 = { x = 212, y = 0, w = 16, h = 37, },
		},
	},
};

Notice the extra indentation before each entry in the frames struct.

@epage epage added the bug Not as expected label Jan 6, 2020
@epage
Copy link
Member

epage commented Jan 6, 2020

Thanks for reporting this! I'm going to be a bit busy for the next month or so with having just moved, so it'll be a bit before I can get to this though I could help you if you want to dig into it.

@agersant
Copy link
Contributor Author

agersant commented Jan 6, 2020

Thank you for the quick answer! I am in no rush at all so I can wait as long as you need.

@JGailor
Copy link

JGailor commented Mar 14, 2020

I'm new to rust but would be interested in taking a look at this issue; seems like it could be straight-forward to track down. Please let me know if you are interested in the help.

@epage
Copy link
Member

epage commented Mar 14, 2020

I'm new to rust but would be interested in taking a look at this issue; seems like it could be straight-forward to track down. Please let me know if you are interested in the help.

Yes, would love the help.

@JGailor
Copy link

JGailor commented Mar 16, 2020

Great. I'll start taking a look today. I've read through the contributing guidelines, but if there are any other details to be aware of please let me know.

@epage
Copy link
Member

epage commented Mar 16, 2020

Nah, pretty straightforward. Not sure if its mentioned but we do use conventional commit style which the CI enforces. I try to not make too big of a deal out of it because not everyone is comfortable enough with git to clean things up. I usually tell people tell people how to clean it up or give them the option of me cleaning it up for them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not as expected
Projects
None yet
Development

No branches or pull requests

3 participants