Avara
Avara copied to clipboard
Character escape sequences don't work in ALF files
Should be able to use entities like " in strings like description
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.
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?
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.
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 ", it becomes a little problematic when defining strings for variables other than designer, information, or text: <set someVar=""How does "this" work exactly?"">.
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.