-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
@htl JavaScript comments are being parsed incorrectly #1387
Comments
Can you edit your post to delete the second issue here and post it to HypertextLiteral.jl instead? |
Sure, no problem. Moved as requested. |
In HypertextLiteral #15, @paulbthub represents that he doesn't want to use string interpolation. Therefore, he probably has no need to be using |
Hi again -- and thanks for the suggestion. ClickCounter(text="Click") = @htl("""...""") to function ClickCounter(text="Click") """...""" |> HTML -- seems to do the trick. Unfortunately, running the same four test conditions ( So I'm happy to not use @htl and to close the issue on the HypertextLiteral page -- but I guess it needs to be reopened here. In fact, now that I have an html version of ClickCounter to play around with, I can see that an unmatched bracket/parenthesis/curly bracket behind a comment marker breaks the bracket-pair highlighting feature in html as well. That is, both of the issues originally reported above in the @htl context are also being repeated in the exact same way in the |> HTML context. Should I just close this thread and repost the entire thing again with the new heading 'HTML JavaScript comments are being parsed incorrectly'. |
Did you try changing it to
Regardless, this issue you're talking about is neither a Pluto issue nor a HypertextLiteral issue. You seem to be confusing 2 contexts: processing in Julia vs processing in JavaScript. Julia processing happens server side, well before the JavaScript comment is processed. In particular, it's not that JavaScript comments are being parsed incorrectly... they simply aren't being parsed by Julia. The behavior you are experiencing is both expected and correct. |
Argh, sorry! I somehow completely failed to see/realize that the @ needed to be omitted as well. And yes, as you anticipated, with the correct syntax, ie I notice however that within the html block, the expression |
So, the With regard to bracket syntax highlighting, I don't have enough information to assess this. Complete working examples are always the best way to get helpful feedback. |
Thank you for your explanations and continuing patience. So the problem -- for me -- is that, for argument passing, I do want interpolation of Although this appears to create an irreconcilable contradiction, I think it could be achieved if comment stripping was the first operation performed by whatever logic gets first shot at parsing the contents of the cell. However, I accept that this isn't going to happen; I can choose one behavior or the other, but I can't have both. Anyway, thanks again for all your time and consideration. |
Inside a cell that defines a function as @htl code, inside a <script> block, an unmatched parenthesis/bracket/curlybracket behind a // JavaScript comment marker should -- surely? -- be completely ignored. However, it's being detected and parsed in a way that breaks Pluto's bracket-pair highlighting feature for every bracket-pair that the comment lies inside of.
In a presumably related issue:Similarly, inside a cell that defines a function as @htl code, inside a <script> block, if the JavaScript comment marker // is used to comment out a line that contains eg$-expressions. Again, my understanding would be that commenting out a line should stop the cell from evaluating and/or caring about any of these $ -expressions.(moved as requested below)$anything
, the cell will throw an 'UndefVarError: anything not defined' error ifanything
doesn't exist. Corresponding syntax errors are also thrown by otherThe text was updated successfully, but these errors were encountered: