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

Character escape sequences don't work in ALF files #223

Open
assertivist opened this issue Sep 2, 2022 · 4 comments
Open

Character escape sequences don't work in ALF files #223

assertivist opened this issue Sep 2, 2022 · 4 comments
Labels
alf bug Something isn't working

Comments

@assertivist
Copy link
Member

Should be able to use entities like " in strings like description

@assertivist assertivist added bug Something isn't working alf labels Sep 2, 2022
@rherriman
Copy link
Member

Looking at some Trotsky levels in my recent alf-fixes branch, it looks like this is accomplished by doubling up the quote characters, e.g. "". This kind of sucks but makes sense from an Avarascript perspective. I'm not sure if a code change is necessary, I've already grown to dislike the special handling of the designer, information, and text attributes, so additional preprocessing of those attributes to auto escape " rubs me the wrong way. Tempted to close the issue when I can confirm the behavior, but open to other perspectives.

@rherriman
Copy link
Member

I have confirmed that doubling up the quote works, as that is how quotes are escaped in Avarascript strings. Whether or not that is acceptable in ALF is up for debate, but I'm fine with leaving it for now. Thoughts, @assertivist or @tra?

@tra
Copy link
Contributor

tra commented Oct 23, 2022

I remember seeing in the Avara manual that doubled-up quotes are turned into a single quote. Here's what the manual says:

If you want to include the quote character, use two consecutive quote characters like this:
text = "Feel free to ""quote"" me on this one."

I suppose we could make the HTML entity " do the same thing as that, if that's what you're asking. But I'm okay with supporting the double "" thing too for now for backwards compatibility. I don't feel strongly about this either way.

@rherriman
Copy link
Member

Right, theoretically we could support quote escaping however we want in ALF, so long as we convert it back into proper Avarascript at load time...but I'm not sure that it's worth it.

Such an approach would make quote escaping work differently in script tags than in other elements, which isn't particularly desirable. And in the case of just allowing a single &quot;, it becomes a little problematic when defining strings for variables other than designer, information, or text: <set someVar="&quot;How does &quot;this&quot; work exactly?&quot;">.

This issue was created because we thought getting double quotes in Avarascript strings was now impossible, but it turns out that wasn't the case--it's just accomplished in a way that is unintuitive for those coming from other languages. But I can live with that, particularly when making changes starts to feel like a solution in search of a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alf bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants