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:macros not available in <script type="text/html"> #71

Closed
xpavp03 opened this issue Jun 5, 2015 · 8 comments
Closed

n:macros not available in <script type="text/html"> #71

xpavp03 opened this issue Jun 5, 2015 · 8 comments

Comments

@xpavp03
Copy link

@xpavp03 xpavp03 commented Jun 5, 2015

<script type="text/html">
<a n:href="Page: param">fails with n:macro</a>
<a href="{plink Page: param}">works with plink</a>
</script>

will be rendered as

<script type="text/html">
<a n:href="Page: param">fails with n:macro</a>
<a href="/param">works with plink</a>
</script>

I didn't test all n:macros, only n:href and n:class.

@xpavp03

This comment has been minimized.

Copy link
Author

@xpavp03 xpavp03 commented Jun 5, 2015

It's possible to work around the issue by adding {contentType html} inside of <script>.

<script type="text/html">
{contentType html}
@fprochazka

This comment has been minimized.

Copy link
Contributor

@fprochazka fprochazka commented Jun 6, 2015

What is your point? Are you bugreporting? Or are you requesting feature?

@JanTvrdik

This comment has been minimized.

Copy link
Contributor

@JanTvrdik JanTvrdik commented Jun 6, 2015

Well I personally thought that type="text/html" would do the same as {contentType html}, maybe it is a bug.


Hm…, both <script> and <style> are currently always parsed as CDATA regardless of type attribute.

@xpavp03

This comment has been minimized.

Copy link
Author

@xpavp03 xpavp03 commented Jun 7, 2015

@fprochazka Yes, I consider this to be a bug. Why would you think otherwise?

@JanTvrdik

This comment has been minimized.

Copy link
Contributor

@JanTvrdik JanTvrdik commented Jun 7, 2015

@xpavp03 Because current processing is identical to what browser does.

@xpavp03

This comment has been minimized.

Copy link
Author

@xpavp03 xpavp03 commented Jun 7, 2015

@JanTvrdik I don't understand your answer. Browser doesn't render Latte at all so even {$var} wouldn't work. {$var} currently does work in <script type="text/html">.

And why should it be the goal anyway? I guess in some cases we might need to turn off Latte processing completely and for that I assume syntax="off" exists.

I don't see the benefit of only disabling n:macros in <script type="text/html">.

@JanTvrdik

This comment has been minimized.

Copy link
Contributor

@JanTvrdik JanTvrdik commented Jun 7, 2015

I don't understand your answer.

You believe that inside <script type="text/html"> are some HTML tags with n:attributes that do not work. But the problem is that there are no HTML tags at all. Both browser and Latte parser treat the content of <script> and <style> as CDATA.

This is the reason why the following code in valid:

<script>
var foo = "<unknownTag>";
</script>

Neither browser nor Latte recognize <unknownTag> as HTML tag. Changing this behavior is not so simple. Consider the following code:

<script type="text/html">
    INSIDE SCRIPT TAG
    <script type="application/javascript">

    </script>
     THIS IS NOT IN SCRIPT TAG
</script>

I don't see the benefit of only disabling n:macros

They are not disabled but there are not HTML tags they can be attach to.

@xpavp03

This comment has been minimized.

Copy link
Author

@xpavp03 xpavp03 commented Jun 7, 2015

Oh, I understand now. Thanks. Mhm...

@dg dg closed this in 1622a40 May 15, 2016
dg added a commit that referenced this issue Jun 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.