Is it possible to create new Inform7 “phrases” that contain “escaped” double-quotes?
The new Vorple allows one to inject new HTML code segment into the webpage.
The syntax is similar to: open HTML tag “div” called “buttonCode”
I’d like to parallel that when creating a phrase to erase the HTML code segment.
Unfortunately; Inform7 doesn’t like double quotes in phrases, but will accept two consecutive single quotes.
Here is some test code I set up to demonstrate the concept.
[code]“Erasing an HTML code segment: tag.class” by Gary
[This is a test harness for trying ways to set up a command to erase what was added via:
open HTML tag “div” called “buttonCode”;]
To erase HTML tag ‘‘div’’ called ‘‘buttonCode’’:
[Doesn’t do anything yest. Just trying to mock up the phrase.]
[Note that the double quotes are actually two single quotes, which Inform7 appears to permit.]
say “The HTML tag to be erased is tag=‘div’ and class=‘buttonCode’.”.
When play begins:
[Doesn’t do anything yest. Just trying to mock up the phrase.]
[Note that the double quotes are actually two single quotes, which Inform7 appears to permit.]
erase HTML tag ‘‘div’’ called ‘‘buttonCode’’.
To erase HTML tag (tagname - text) called (classname - text):
say "The HTML tag to be erased is tag='[tagname]' and class='[classname]'.".
When play begins:
erase HTML tag "div" called "buttonCode".
In the new VORPLE there is a set of commands that allows the user to control the creation of HTML code.
One is of the form, open HTML tag “[element]” called “[class]”.
where: [element] is a valid HTML element and [class] is an HTML class name specified by the user.
I’m trying to parallel the syntax when adding a programming command to erase the HTML code formed by the noted command.
One reason is that while the user can create the code and embed active elements, javascript/jQuery is the only way to get rid of them. For instance; one might not want user-programmed buttons hanging around after their usefulness is over. The other is that I’m trying to do this in a way that I can easily explain to others and maintaining the “symmetry” of the coding language will make that easier.
Thanks, Juhana. You and the group have really been patient and helpful. I really appreciate that.
I think I’m actually getting to understand how to approach extending the syntax now. Before diving into programming an adventure, I like to write myself a library of Inform7 “primitives”. This allows me to concentrate on writing the actual Inform7 adventure and not get drawn off-topic by pausing to program extensions/commands.
Next step is to tighten up all the code for the above “primitive” library. The objective is to not add any commands that I can do with what is already available and to keep any new commands “Vorple-like” in their syntax, if possible.