According to the Treaty https://babel.ifarchive.org/babel_rev10.html#format, there are 13 valid <format> values:
> zcode, glulx, tads2, tads3, hugo, alan, adrift, level9, agt, magscrolls, advsys, html, executable
But when you run the "babel" tool on a Twine file, it returns the format "twine," which isn't on this list.
I think it may have been the intention of the signatories to add twine to that list. (Was it?) But I think that's not actually desirable.
HTML, like Z-code, is an output format, which multiple dev systems can generate. ZIL, Inform, Dialog, etc. can all make Z-code files. Similarly, Twine can make HTML, but so can ChoiceScript, Texture, Undum, and Gruescript.
Instead, I think that the Babel tool should be updated to return "html" as the format of Twine files. (I'd be happy to file a PR to that effect.)
Does that sound right to y'all?
2. Adding support for non-Twine HTML by adding metadata to HTML
Now, supposing I did that, I'd then want there to be a way for the babel tool to support HTML files in general, rather than just Twine files specifically.
The way the babel tool currently detects Twine files is by looking for distinctive HTML in each file. Twine 2.x files always include a particular custom element, <tw-storydata>, and the Twine HTML generator adds an "ifid" attribute to that element.
I think it would be more typical for HTML to self-identify using HTML-based metadata standards. For example, we could standardize on a <meta> tag, like this:
1. I think it's true that ChoiceScript games are single HTML files like Twine games. But for web-based works that are split up among several HTML files, what should happen? Should each file have a meta tag with the same IFID value? Just the entrypoint?
2. There are two kinds of Twine files: single stories with a single <tw-storydata> element, and archives which have multiple. The idea behind archives is to allow people to import/export stories easier as well as for backup purposes. It's important that the IFIDs are kept intact in the archive format. In that case, what would you suggest should happen? <meta> is only legal in the <head> element, I think.
A footnote that there are several tools out there that compile Twine stories (tweego, extwee, twine-utils, etc) and if we want behavior to change uniformly, we'll want to update the spec here (and folks who maintain these tools may have differing opinions about this proposal): https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-htmloutput-spec.md
As for archives with multiple <tw-storydata> tags -- or any kind of
package containing multiple games -- the babel tool just doesn't support
that. Someone is welcome to volunteer to figure that out but it's not a
pressing need.
It would be nice if Twine *also* generated a meta tag. (For
single-Twine-game HTML files.) This can be added incrementally into tools
as you get to it.