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

n:syntax does not reset syntax after closing element tag #358

Closed
daun opened this issue Mar 11, 2024 · 2 comments
Closed

n:syntax does not reset syntax after closing element tag #358

daun opened this issue Mar 11, 2024 · 2 comments

Comments

@daun
Copy link

daun commented Mar 11, 2024

Version: 3.0.13

Bug Description

When using n:syntax on an element node, the closing tag does not reset the syntax. Any content after the closing element tag is treated as text.

Steps To Reproduce

In theory, this should resolve both outer {$var} and leave the inner {$var} untouched.

{$var} <div n:syntax="off">{$var}</div> {$var}

In reality, this is what's rendered:

hello <div>{$var}</div> {$var}

See fiddle f6d9e5b641 for a demonstration.

Expected Behavior

The content after the element should resume parsing normally and also print the second outer {$var}.

hello <div>{$var}</div> hello

Possible Solution

Not sure. Stumbled upon this by accident while trying to solve a similar situation in a custom tag, and wanted to check how the core handles this. Eager to learn the solution here :)

@daun
Copy link
Author

daun commented Mar 11, 2024

Interestingly, wrapping it in another div seems to reset the syntax for the outer element, however not for the inner element context. See fiddle 615314f99d for an example.

<div>
	{$var} <div n:syntax="off">{$var}</div> {$var}
</div>

{$var}

Which results in:

<div>
	hello <div>{$var}</div> {$var}
</div>

hello

@daun
Copy link
Author

daun commented Mar 11, 2024

Getting closer. There is a test for this scenario, but it passes because of a line break before the after variable. Removing the line breaks causes the issue.

Works and resolves both outer print statements:

{$var}
<div n:syntax="off">{$var}</div>
{$var}

Fails and ignores last print statement:

{$var} <div n:syntax="off">{$var}</div> {$var}

@dg dg closed this as completed in 767b278 Mar 19, 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

1 participant