sergey icon indicating copy to clipboard operation
sergey copied to clipboard

Nested templates: first closing tag closes parent instead of child

Open Imable opened this issue 5 years ago • 4 comments

Issue

Nesting templates causes the parent to close on the closing tag of the child template.

Expected behavior

The last newly opened <sergey-template> tag should close at the subsequent </sergey-template>.

How to reproduce

The </sergey-template> tag after 'article' closes the name="main" template tag instead of the expected name="classes" template tag.

<sergey-template name="main">
    <sergey-import src="grid-item">
        <sergey-template name="classes">article</sergey-template>
        <sergey-template name="content">
            Test
        </sergey-template>
    </sergey-import>

    < more html />

<sergey-template/>

Imable avatar Dec 13 '19 22:12 Imable

@Imable thanks for the report - I'll investigate the issue when I get a second!

https://regex101.com/r/8AQwse/1 (for my reference)

trys avatar Jan 02 '20 16:01 trys

@trys what about using jsdom instead of regular expressions?

I've created a POC (proof of concept) that really simplifies the mathing of sergey-* tags and reduces the while loops.

Also, i've tried to run this error and seems to be solved.

guesant avatar Feb 09 '20 12:02 guesant

What do you think @trys? Can I work on this?

guesant avatar Feb 12 '20 19:02 guesant

@guesant So sorry for the delay, there's an awful lot going on in my life right now. jsdom or parse5 was exactly the route I was planning on going down to properly fix this, so thank you so much for the proof of concept! I'm so grateful!

I can't guarantee how much time I can commit to this project over the next month or so, but please feel free to keep working on this and I'll try and find some time to get involved, review, test and suggest! 😄

trys avatar Feb 28 '20 14:02 trys