Epub vs out_file and dest_dir

3 views
Skip to first unread message

Oscar Levin

unread,
Jul 15, 2022, 8:18:49 PM7/15/22
to PreTeXt development
I am very very very close to having epub building in the CLI.  The last step is figuring out the role of the `out_file` and `dest_dir` variables.  This has also bitten me when just using the pretext script to build epub: the output file does not go inside the destination directory.  This is inconsistent with the guides suggestion of what to type (but note that the guide will get updated to use the CLI soon, I would guess).

From what I can gather now, this is controlled by the `get_output_filename` directory.  If an `out_file` is specified, then that function just returns the out_file.  But if it is not, then there is a filename that is derived from the source, and is put inside the dest_dir.  

This is fine for what I want to do, but it strikes me as strange that the out_file needs to include the path to the file, and that if dest_dir is also specified, that gets ignored.  Note that if you are building both epub and kindle, you will want to change the out_file to reflect this, otherwise you will get the same file for both.

Is this a bug?  I know that the `get_output_filename` function is used elsewhere, so obviously this would need to be "fixed" with care.  

At the very least, the help for the pretext script and guide should be updated to make this clear.

Rob Beezer

unread,
Jul 15, 2022, 9:15:03 PM7/15/22
to prete...@googlegroups.com
Dear Oscar,

Maybe "out_file" should be called "out_path". But it is not just a path. Maybe
"out_completely_qualified_filename_including_path". An 'absolute' file name?

Anyway.

Multi-file output (HTML) needs a directory, only.

Single file output can be whatever you want to call it, wherever you want it,
see above.

Single-file output can go in a directory and we will name the file.

Single-file output can go in current working directory and we will name it.

In that order for last three.

Maybe in other words, the two arguments do not combine, and "out_file" assumes a
path (which can be no path at all).

How do you want the CLI to behave?

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com
> <mailto:pretext-dev...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-dev/1ae3c1c7-5694-4110-9526-b3cad2fa85bbn%40googlegroups.com
> <https://groups.google.com/d/msgid/pretext-dev/1ae3c1c7-5694-4110-9526-b3cad2fa85bbn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Oscar Levin

unread,
Jul 15, 2022, 9:24:29 PM7/15/22
to PreTeXt development
For the CLI, we will have an output directory set in the project.ptx manifest, and now I'm just passing out_file=None, which does the right thing (except that we will need to advise the publisher to have a different output directory for kindle than for non-kindle epub).  In fact, this is consistent with the rest of the CLI, that always uses the output file names that core pretext provides.  So from the CLI perspective, now, I have it figured out.  

So if the script is doing what you want it to, then tomorrow I will submit a pull request for the documentation to make this hopefully clearer.

Rob Beezer

unread,
Jul 15, 2022, 11:38:45 PM7/15/22
to prete...@googlegroups.com
Sounds good. Thanks.
Reply all
Reply to author
Forward
0 new messages