stencilproject / Stencil

Stencil is a simple and powerful template language for Swift.
https://stencil.fuller.li
BSD 2-Clause "Simplified" License
2.33k stars 221 forks source link

Trim whitespace #287

Closed yonaskolb closed 1 year ago

yonaskolb commented 4 years ago

This takes the work that @bejar37 started in #92 and builds upon it.

In addition to the Jinja2 trimming symbols, this adds a trimBehavior: TrimBehaviour on Environment. This defaults to .none but can be customized. It also comes with a built in .smart case that removes whitespace before a block, and whitespace and a single newline after a block.

yonaskolb commented 4 years ago

Any comments?

aufflick commented 3 years ago

Hey all, do you need any help on this? I'm using Stencil for code generation and the Jinja2 would be super helpful to avoid the awkward-looking templates necessary to make nice-looking output. I'm happy to put some time into getting this PR ready for submission if you're all fundamentally happy with the approach.

tikimcfee commented 2 years ago

I'll add to that - this seems like great progress so far. If we can put together a specific list of must-do changes, we can get this in. Unfortunately, I'm not familiar enough with the holistic system image, and will have to defer my part in that to someone more so.

EDIT: This actually looks to have been merged in with https://github.com/Azure/autorest.swift/pull/134. Does this just need to be closed out?

tomnvt commented 2 years ago

I wonder if I could help with finishing this issue? It seems that having this merged would make many people happy 🙂

subdan commented 2 years ago

Hello, @kylef, @ilyapuchka, @djbe, @astromonkee. What's stopping you from merging this PR?

subdan commented 2 years ago

@yonaskolb Could you please fix the conflicts?

thebarndog commented 2 years ago

Is there any intention of this merging? This is a desperately needed feature.

SwiftGen-Eve commented 1 year ago
1 Message
:book: Big PR

Hey 👋 I'm Eve, the friendly bot watching over Stencil 🤖

Thanks a lot for your contribution!


Seems like everything is in order 👍 You did a good job here! 🤝

Generated by :no_entry_sign: Danger

djbe commented 1 year ago

I've rebased the changes on top of the (currently still open) drop swift4 PR, ~once that is merged, this should be converted to a full PR again~ done.

TODO:

yonaskolb commented 1 year ago

Thank you @djbe for getting this across the line! Awesome work here in the repo in the last couple of days 💪