Closed aimozg closed 1 year ago
This is a browser issue, neither a Tweego nor a SugarCube issue.
Parsing of HTML <script>
tag contents in the browser is probably not what most people expect/want due to historical issues that are never going to be changed. Thus, using the <<script>>
macro within a <script>
tag isn't going to work as you'd hope either.
That said. Why are you even attempting to use the <<script>>
macro, which executes JavaScript, within your Story JavaScript, which exists to execute JavaScript?
(Closing this as not a Tweego issue, but feel free to continue the discussion until we get your situation straightened out.)
This is a browser issue, neither a Tweego nor a SugarCube issue.
Tweego escapes <>
in passages, and if it were possible to do same for </script>
it should do it. But from what I understand, it is impossible (cannot escape token, only split, and that requires knowledge of JS context which is definitely not Tweego responsibility).
Still posted the issue in case you have ideas. The only I can think of is to emit a different tag than <script>
with &
-escaped
characters, but that needs checking with the story format code and is an overkill for such an rare case.
That said. Why are you even attempting to use the < Githubissues.
Githubissues is a development platform for aggregating issues.
Describe the bug
</script>
character sequences that occur in JS resources break browser HTML parser, as they are treated as closing tags for<script role="script" id="twine-user-script" type="text/twine-javascript">
, destroying any following content.To Reproduce Compile a Tweego+SugarCube2 project with a JS file containing
Desktop (please complete the following information):
Additional context I don't think it's even possible to escape these at Tweego level (see Restrictions for contents of script elements).