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

closing tag is removed even when no opening tag before => troublesome for CSS #773

Closed
bfredo123 opened this issue Oct 12, 2024 · 1 comment

Comments

@bfredo123
Copy link

bfredo123 commented Oct 12, 2024

Hi,
I am using EJS to allow HTML content personalization.
I use custom open/closeDelimieters: { } instead of < >.

Unfortunatelty, another node component generates HTML, with embedded CSS like "{ ... width: 75%}".
As a result, when invoking EJS on this HTML, in order to personalize it, the "75%}" is replaced by "75", which obviously makes the CSS corrupted, and the display of the HTML is broken.

I would expect that EJS does not remove this "%}", because there is no preceding "{%" or "{%=" tag.

Is there an option to ask EJS not to remove the unbalanced closing tags?
Or some kind of workaround? (I cannot change the "{}" delimiters to other chars).

I have read issue #284 which seems related, but could not find any solution.

Many thanks in advance!

@mde
Copy link
Owner

mde commented Oct 12, 2024

An implementation which works the way you suggest it should, would add a ton of complexity that would be unnecessary for all but the most exceptional of cases, as you describe.

Number one, you are using custom tags. Number two, you are using another library that generates code which end up aping the custom tags you have specified, resulting in broken code.

There are multiple possible workarounds here. You could stop using custom tags ("Doctor, it hurts when I do 'this.'"), or you could possibly clean the code generated by the problematic Node library so that there are always spaces around the brackets in the embedded CSS.

@mde mde closed this as completed Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants