If I have an IF game which runs in a Node.js terminal, how would I embed babel metadata?
I tried checking the spec online, but this case isn’t covered.
Thank you for your time!
If I have an IF game which runs in a Node.js terminal, how would I embed babel metadata?
I tried checking the spec online, but this case isn’t covered.
Thank you for your time!
Embedding metadata implies that you’re distributing a file to embed in. I take it that’s just Javascript? (No HTML file in the package?)
That more or less falls under the “executable file” rules.
You can include the text UUID://...//
in a JS comment or literal string. (The spec isn’t clear that this is a common practice for executables. But de facto it is a reasonable thing to do.)
I don’t remember if we have a notion of embedding an entire ifiction record (XML block) in executable files. Obviously you can do that, but I haven’t tested if the babel tool finds it, or if there’s any workflow in use that looks.
The babel-tool does not detect UUID://...//
in an executable.
I created a JS file x.js
like this:
#! /usr/bin/env node
// UUID://D0D26718-3CDF-4395-9B02-7405F99C0CBF//
console.log('hello');
Then I ran the tool on it like this:
$ babel -identify /tmp/x.js
No bibliographic data
IFID: SCRIPT-6F98EFB95D25E82C7DDC1A3BB7813733
executable, 0k, no cover
(That “IFID” is the MD5 of the file.)
EDIT: I think the spec is pretty clear that the only valid IFID for an executable is its MD5, which means that it’s not possible for executables (even scripts) to have a stable IFID over time under Treaty of Babel revision 11.
The only files that are allowed to contain UUID://...//
IDs are HTML, Z-Code, Glulx, Alan, and HTML.
I think it would be nice to have a revision 12 (and a PR to the Babel tool) that would allow executable files (or at least scripts starting with a #!
“shebang”) to include the string UUID://...//
somewhere in the file.
It was plenty-clear, yeah; I was just checking to see if something was figured out which has not been added to the docs yet.
For now, I think I’ll add this to a comment in the *.js
file, just to make sure it’s future-proof, even if this isn’t implemented in the toolset at this time.
This seems like an obvious omission, which I had obviously already corrected in my head. :)