spiral / framework

High-Performance PHP Framework
https://spiral.dev
MIT License
1.82k stars 89 forks source link

Stempler Import Directory does not work when mixed with HTML #1154

Open enyancc opened 1 month ago

enyancc commented 1 month ago

Description

Adding <use:dir/> tag within template that contains HTML would try to resolve regular tags as templates.

How To Reproduce

views/home.dark.php

<extends:layout.base title="[[The PHP Framework for future Innovators]]"/>
<use:dir dir="partials" ns="partials"/>
<stack:push name="styles">
    <link rel="stylesheet" href="/styles/welcome.css"/>
</stack:push>

<define:body>
    <h1 class="main-title">The PHP Framework <span>for future Innovators</span></h1>
    <partials:router-link />
</define:body>

views/partials/router-link.dark.php

<a href="test.php">test</a>

throws exception "Unable to resolve import link"

<extends:layout.base title="[[The PHP Framework for future Innovators]]"/>
<use:dir dir="partials" ns="partials"/>
<stack:push name="styles">
    <link rel="stylesheet" href="/styles/welcome.css"/> <!------ HERE  ->
</stack:push>

<define:body>
    <h1 class="main-title">The PHP Framework <span>for future Innovators</span></h1>
    <partials:router-link/>
</define:body>

Additional Info

Q A
Framework Version 3.14.5
PHP version 8.3.4
Operating system Linux