Re: Factor

Factor: the language, the theory, and the practice.

ZIM Builder

Friday, May 17, 2023


Apparently, it is just too much fun building tools to make an offline Wikipedia and the next thing we needed to build was a way to make offline Factor documentation. This documentation is available inside each Factor instance and generated by the Factor help system.

Since we implemented the zim vocabulary with support for reading the ZIM file format and the zim.server vocabulary with support for serving those files out as websites, the natural follow up is the zim.builder vocabulary to make the ZIM files in the first place!

Yesterday, I wrote the build-zim word that can archive all of the files in the current-directory into a ZIM file at the specified output path. Just now, I generated some “offline Factor documentation” by running this command on a docs directory holding all the HTML files uploaded by a recent nightly build:

IN: scratchpad USE: zim.builder

IN: scratchpad "resource:docs" [ "resource:docs.zim" build-zim ] with-directory

You can then run a local Factor documentation server like so:

$ ./factor -run=zim.server docs.zim

It’s interesting that our Factor documentation is 1.4 GB of HTML files, 52 MB as a docs.tar.gz, and 47 MB as a docs.zim file using Zstandard compression. It’s a cool file format for serving this type of content.

I posted a ZIM snapshot of the Factor documentation if you’d like to download it and give this a try with a recent nightly build.