sile-typesetter / casile

The CaSILE toolkit, a book publishing workflow employing SILE and other wizardry.
GNU Affero General Public License v3.0
54 stars 6 forks source link

Adding comby to the docker image #155

Closed iilyak closed 1 year ago

iilyak commented 1 year ago

I am on windows WSL and using ./configure requires a lot of things to be installed.

Therefore I am unable to rebuild docker image myself yet (however I can use the image as a base).

I am trying to use images in markdown however they are rendered on top of the text. So I want to wrap them in \float{}. In order to do it I want to define a sile_hook and use comby to do rewrites.

define sile_hook ?=
    cat - \
    | comby '\img[:[1]]{:[2]}' '\float{\img[:[1]]{:[2]}}' -stdin -stdout
endef

The problem is I cannot get comby installed into the image. The libev and pcre versions on arch linux do not wrk with comby binary. I'll probably would need to build it from source inside the image.

I will definitely do build comby (or redo the Dockerfile using ubuntu). However I've noticed that quite a few things are done using sed/awk and others. The https://github.com/comby-tools/comby can be used for that purpose.

Please close the issue if you don't find comby useful as one of casile dependencies.

alerque commented 1 year ago

This is probably the most advanced question I've gotten on SILE — which tells me you've given it a serious shot already. Please do keep posting when you hit rough edges or can't figure out how something is supposed to work. Since myself and the 3 publishing houses I've setup workflows for are the main consumers to date and there is little or no documentation for most of the current features I'm sure it's not easy to get along. I'd be happy to answer questions and improve things as they come up.

As you noticed, the dependency list for this project is huge and I've only worked out all the kinks on Arch Linux. I'd be happy for that to expand to other distros, but it Ubuntu would be a very hard one to pull off since many of the dependencies are too old there. Nix might be a much easier one, and that would bring it to Windows & macOS too.

I don't want to stuff anything in the official Docker that isn't used, but it should be easy enough to figure out how to get comby in there for your own usage. I'll look into it.

alerque commented 1 year ago

It looks like there is an AUR package for comby, so that gives us a good starting point. You could easily build that inside the CaSILE image, but I'll make it one step easier: I just built it and pushed the package to my Arch user repo. That should make it super easy to get into an image based on CaSILE because the image already has my repository enabled by default, so all that remains is to pacman -S comby it (refreshing the package repository to see the latest index of course).

You could just install it at run time by changing up the entry point, but I would suggest building an image with your tooling and running that to build your project instead:

#syntax=docker/dockerfile:1.2
FROM ghcr.io/sile-typesetter/casile:v0.10.17
RUN pacman --needed --noconfirm -Syq comby && yes | pacman -Sccq
ENTRYPOINT [ "casile-entry.zsh" ]

After building this image and tagging as something you can use later, you should be able to run the image as if it was CaSILE, but it also has comby available.

$ docker build . -t casilewcomby
...
$ docker run -it casilewcomby --version
casile v0.10.17
$ docker run -it --entrypoint zsh casilewcomby -c "comby --version"
1.8.1

Note this solution will work best if you then keep the Docker image you built around for future use. Rebuilding it later will be a slightly brittle proposition because you may eventually run into a situation where the comby package is too new to just stuff in an old CaSILE base image. In that event you'd need to pacman -Syu to update all the packages in the image first, which runs the risk of something else being newer that the CaSILE version is expecting.

alerque commented 1 year ago

I'll take than thumbs up as a "this is probably solved" and close the issue for now, but please do comment back if this is not resolved for you and I'll reopen. Also do open issues for other problems or even questions "how do I do X" that you run across. Frankly those kind of questions would help me understand what the documentation priorities are.