lvignoli / typst-action

Typst GitHub action
MIT License
52 stars 10 forks source link

Feature Request: Allow for Passing Directories to Action #3

Open DeveloperPaul123 opened 1 year ago

DeveloperPaul123 commented 1 year ago

It would be nice to be able to pass a directory with *.typ files or a list of typ files to be compiled and have the action generate separate PDFs for each of them. Supporting wildcards would be nice too if possible (i.e. <dir>/*.typ).

lvignoli commented 1 year ago

As of v1.0.2 (which is also the new v1 tag), one can pass a new line separated list of .typ files and all of them will be compiled. There are no checks for errors along the compilation, no support for directory, no support for glob expansion.

lvignoli commented 1 year ago

I am a bit puzzled by how to handle #2 now that there is the possibility of multiple files. I guess a syntax could be

source_file : |
   foo.typ bar.pdf
   baz.typ
   fizz.typ
   buzz.typ buzzy.pdf

But that's a bit harder to handle, and I would like the bash script to remain readable. Maybe using python or another scripting language is the best way to go for the building script.

DeveloperPaul123 commented 1 year ago

@lvignoli Could you have a second parameter input as another list of output file names and then map them 1 to 1 to the input file list?

lvignoli commented 1 year ago

I am unsure of how sound passing a directory is.

A typical Typst project is broken into several files, beginning with a template file. Typst needs a specific target root file to start compilation.

Supporting directories would only improve the specific use case of compiling many standalone single files. This seems peculiar, and probably be addressed by generated the list of target files before the Typst action job/step, passing it as an input.

For these reasons, I would rather not support directories nor globbing—for now.

NicoWeio commented 9 months ago

I understand that you don't feel comfortable supporting this. To all the readers who are open to a hacky implementation, though, take a look at my fork.