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

JS Compiler: fix interaction with NHT code #51

Open
vlapchenko opened this issue Apr 5, 2017 · 6 comments
Open

JS Compiler: fix interaction with NHT code #51

vlapchenko opened this issue Apr 5, 2017 · 6 comments
Assignees

Comments

@vlapchenko
Copy link
Member

Please, fix JS Compiler to correctly parse NHT code insertions like as:

div {
  span="?[:SomeVariable]" {}
}
@itadapter
Copy link
Member

Change precedence tpl then js would not work

You have practical example?

@vlapchenko
Copy link
Member Author

If I write such construction:

div {
  span="?[:SomeVariable]" {}
}

then I get output:

var Ø5=WAVE.ce('span');Ø5.innerText=[:SomeVariable];

which contains invalid NHT code [:SomeVariable].

@vlapchenko
Copy link
Member Author

Also, how exactly I should write laconf code in this case:

@[if (m_IsOwner) {]
  <a class='uiSmallButton' href='?[order.Link]'>Order</a>
@[}]

?

@itadapter
Copy link
Member

I guess the NHT compilation model is such that NHT generates C# template class.
The LJS comilation phase is taking place before NHT/C#, so there is no way you can eval
NHTC# syntax before LJS (laconinc js). In your case I would use the (ctx ) passed into the js function
and use pure js IF. Another way it to compile LJS under NTC ifs

@OlegPanagushin
Copy link
Contributor

Fixed.
Use double question marks

div {
  span="??[:SomeVariable]" {}
}

@vlapchenko
Copy link
Member Author

There is some inconvenience to use the offered decision. To parse my statement correctly I have to wrap it with additional quotes every time:

div {
  span="?'?[:SomeVariable]'" {}
}

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

3 participants