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

Indenting doesn't work for custom functions #303

Open
rickyheijnen opened this issue Oct 14, 2021 · 3 comments
Open

Indenting doesn't work for custom functions #303

rickyheijnen opened this issue Oct 14, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@rickyheijnen
Copy link

Describe the bug
When using the format document function, it doesn't keep the indenting of my custom functions. Indents of Smarty default functions such as {if} {foreach} or {for} are nicely formatted. But I have many custom functions like {tabset} or {tab} and their indent keeps being removed by Format document.

Screenshots
Before formatting
image

After formatting
image

Context (please complete the following information):

  • Version v1.9.0
@aswinkumar863 aswinkumar863 added the bug Something isn't working label Oct 14, 2021
@aswinkumar863 aswinkumar863 self-assigned this Oct 14, 2021
@DreamerHan
Copy link

This is reproduced here for me as well. But I don't think it's a bug.
I've found that there is no problem if using smarty's native delimiter {} indentation, it only happens with custom tags or custom delimiters.
I strongly hope that the author can add custom delimiters. For example, my current project delimiter is {%%}. This project is very old, and it will be a big project to modify the delimiter.

@answeb
Copy link

answeb commented Mar 24, 2023

I have a similar issue, I use {t}text{/t} to mark translatable strings, but the formatter breaks things up :

<div class="callout secondary">{t}No records found{/t}</div>

becomes

<div class="callout secondary">{t}No records found {/t}</div>

It is a big problem because now the translation string has a \n at the end, and it cannot be found anymore.
Would be nice if we could have a blacklist for specific functions, or at least doesn't try to format unknown functions
...

@AdmDevSincro
Copy link

AdmDevSincro commented Oct 5, 2023

@aswinkumar863 could you please add the possibility to configure custom reservated words for identation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants