michal-h21 / make4ht

Build system for tex4ht
137 stars 15 forks source link

Put build files somewhere else #10

Closed sevagh closed 6 years ago

sevagh commented 6 years ago

Hello!

I'm using make4ht to generate html from tex. When I use make4ht -d build myproj.tex, it puts myproj.css and myproj.html into build/ but leaves all the temporary/build files in the CWD: 4ct, 4tc, aux, dvi, idv, lg, log, tmp, xref

Is there a flag for putting those files elsewhere? Or a pull request that you're interested in?

michal-h21 commented 6 years ago

The -d option works only for the generated output files - html, css or images. It doesn't handle the temporary files. They are in fact quite important when you work on the document, I would remove them only in the last step, when the document is done.

It is possible to remove these files using the match function in the build file, clean.mk4:

local mkutils = require "mkutils"

if mode=="final" then
  Make:htlatex{}
  Make:htlatex{}
  Make:htlatex{}
  Make:match("tmp$", function(filename )
    local basename = mkutils.remove_extension(filename)
    for _, ext in ipairs {"aux", "xref", "4ct", "4tc", "dvi", "idv", "lg", "log", "tmp" } do
      local filename = basename .. "." .. ext
      print("Removing: " .. filename)
      os.remove(filename)
    end
  end)
end

Compile the file using

make4ht -um final -e clean.mk4 -d build myproj.tex
sevagh commented 6 years ago

Thanks for the example.