michal-h21 / make4ht

Build system for tex4ht
131 stars 15 forks source link

feat: allow build directory for temporary files (Fixes #10) #136

Closed rsekman closed 9 months ago

rsekman commented 9 months ago

By passing --output-directory to the TeX engine we can put its intermediate (.aux, .toc, .log, ...) files in a build directory. This implements the feature requested in #10.

This requires making some other functions aware that they need to look in the build directory and interpret paths relative to it.

This is a draft for now because I don't think I have gone all over the places where make4ht touches the file system.

There is also some refactoring that can be done; we should have utility functions to manipulate paths etc.

rsekman commented 9 months ago

@michal-h21 I think I found the cause of

LaTeX says that it cannot write to the log file

mkdirectories was calling lfs.chdir() but not changing back to the original working directory. So the call to latex was being run in build/, not in the root directory. c97f264 fixes this by removing the side effect from mkdirectories.

michal-h21 commented 9 months ago

I think that I've resolved most issues, including in some extensions and filters. I think we will need to go over all uses of par.input or parameters.input in all files, and use the new function mkutils.file_in_builddir to get the file.

I've tried to push to your repo, but Github rejected that, so I will make another pull request on your fork.

michal-h21 commented 9 months ago

@rsekman I hope everything works now. So I merged the code to the main branch.