Ifsitegen.py

Here’s my weekend hack:

https://eblong.com/zarf/blorb/ifsitegen.py
or
glk-dev/ifsitegen.py at master · erkyrath/glk-dev · GitHub

This script does essentially the same job as the “Release along with an interpreter” option of Inform 7. The differences are:

  • You can run this on any Z-code or Glulx game file.
  • It generates the playable game page as the primary page, rather than starting with a game information page. (The playable game is at index.html, not play.html.)

This is useful for making Inform 6 games and older games available on a web site. It can also make a playable Glulx file with images, which Inform 7 (as of 6M62) cannot.

File types supported: .z3 through .z8, .ulx, .zblorb, .gblorb

You must install Inform 7 to use this script. (It relies on template files that are distributed as part of Inform 7.) However, you don’t need to run Inform 7.

The simplest way to use this:

python3 ifsitegen.py Game.ulx

This will look for Inform 7 in its default installation location (on your OS). It will use the “Standard” web site template and the “Quixe” or “Parchment” interpreter, depending on the game file type. If you have installed updated templates in your Inform document library, those will be used instead.

The “Standard” template includes the game title and author on the page. You should supply these:

python3 ifsitegen.py --author 'Bob Zod' --title 'Pow!' Game.ulx

If you provide a Blorb file which contains cover art, that will be used on the web page. Otherwise, you can use the --cover argument:

python3 ifsitegen.py --cover my-cover-art.jpeg Game.ulx

If you have installed Inform 7 in a non-standard place, or given it a non-standard name, you must pass this with the -a argument:

python3 ifsitegen.py -a /Applications/Local/I7.app Game.ulx

Similarly, you can use the -l argument to refer to your document library directory.

Default locations:

  • MacOS: /Applications/Inform.app, ~/Library/Inform
  • Windows: C:\Program Files\Inform 7, ~\My Documents\Inform
  • Linux: /usr/local/share/inform7, ~/Inform

You can select a different web site template with the -w option, or a different interpreter template with the -i option:

python3 ifsitegen.py -i Vorple -w Classic Game.ulx

(For more information about Inform’s templates, see chapters 25.10 - 25.14 of the Inform manual.)

The -i and -w options can also refer to a directory or a zip file containing a template:

python3 ifsitegen.py -i ~/Downloads/Quixe-220.zip Game.ulx

Finally, if you have a Glulx game with images, pass the --unpack option to unpack the .gblorb file into separate image files. This is not required! The game will play fine either way. However, --unpack reduces the processing and memory load on the client browser.

10 Likes

I’ve put in the default paths for Windows and Linux, but I’ve only tested this on Mac. If I screwed anything up, let me know.

Love the idea! This will be so much easier than the alternatives we’ve had to suggest before.

The templates in Inform are over 5 years old now. How would you feel about adding an option within the script to download parchment-for-inform7.zip and use it? Maybe even the default? (It would be better if the zip was in the master branch… but if you want to add this then I can switch things around so that it is.)

1 Like

I7’s Quixe is out of date too, but I don’t want to hard-code URLs in the script.

I suppose the argument could accept URLs and download them to the library directory. It’s a bit more work than I want to put in, though.

How about I just add the current links to the documentation and recommend downloading the latest version. Hopefully, it won’t be too long before I7 is updated anyhow.

3 Likes

16 posts were split to a new topic: Broken Parchment for Inform 7 template

This is amazing.

I don’t know too much about how Inform templates work (the Templates folders don’t seem to actually have any HTML files in them, just a manifest file with some HTML in variables?), but would it be possible to have a command line argument that removes the sidebar like in this post?

There are two kinds of templates: web site and interpreter. In the Inform app’s Templates directory, Classic and Standard are web site templates: these contain HTML and CSS. Parchment, Quixe, and Vorple are interpreter templates; they contain JS and CSS, plus (as you note) some HTML snippets in (manifest).txt.

If you want a different layout, you should make a new web site template. I did this (as a sample) here: https://eblong.com/zarf/glulx/quixe/OneColumn.zip .

2 Likes

Side note: a member from the Puny Discord server created this GitHub - joshwarecom/edgecase-parchment. While I was not able to make @zarf’s IFsitegen generate a working game bundle, Edgecase Parchment did work for me. Still no idea if Parchment is the problem here but at least three individuals face the same issue currently. Fingers crossed for a fix, because IFsitegen is definitely way more flexible, as everything can be controlled with command line parameters. Yes, that transcript feature is posh. EDIT: Parchment has been fixed, ifsitegen works like a charm.

Some comments:

  • Could the “Unable to locate template” error messages specify if it’s searching for the web or the interpreter template?
  • The default install location for gnome-inform7 (off the Inform7 site) in Debian/Ubuntu is /usr/share/gnome-inform7/, so it would be good if that was supported.

(I split off the comments about the broken Parchment template to Problems with the Parchment for Inform 7 template. The bug has now been fixed.)

Yep, will look at those. Thanks.

EDIT-ADD: Done.

1 Like

Thanks! I still think the relationship between “website” and “interpreter” is pretty confusing in Inform though, haha. Releasing with a website just creates the information index page, while releasing with an interpreter also releases with a website, and both the index and the play pages use the website template.

So to use a non-default layout for the play page in Inform, you actually have to write Release with a "OneColumn" website and an interpreter (and then delete the index page and rename play.html to index.html to achieve what this script does). Is that about right?