Custom command to compile org files into epub

Hello,

First, sorry for double posting, but I didn’t understood why but my first post got closed, and I had no time to answer to explain why it was, for me, a hugo issue. If you think this issue is off-topic, please let me the time to explain why it may not be.

So I’d like to write a set of “rules” to make hugo produce for every input post .org file (could do the same for mardown files) a .epub file, a .pdf file and a .html file (for e-readers, printers, and web browsers). That way, my users could choose to download the pdf/epub version if they want to read it offline. Since I use extensively maths equations, I’d like to use pandoc and GladTex to generate for me the .epub file, using something like:

pandoc -t json mypost.org | gladtex -d img -P - | pandoc -f json -o mypost.epub

Is it possible to write a “rule” in hugo to automatically run this command for me on every post during the compilation time? I also would like to be able to refer to the other versions in the templates. I saw for example that hakyll as such feature to produce several versions (like one html, one pdf…) of a single file, that can be created with pandoc directly or with a custom unix command (see Hakyll.Core.UnixFilter, I can’t put more links since I’m new in this forum).

Thanks!

The previous post was closed because there was no activity on it for two days. Other than that nothing changes from my answer on that post. It’s not a Hugo problem.

Isn’t that a question that you should ask in the pandoc and/or gladtex support system? I don’t see how Hugo can have any influence on that.

Oh, after two days all post are closed? Harsh politic ^^

Well, for me since Hugo proposes some ways to turn diverse format into html, it would not have been absurd for me to provide a way to let a user customize the conversion process, for example with a custom command line. It could be useful for tons of things, like video/image conversion, creation of more involved output formats like epub/pdf… But I understand that gohugo does not want to deal with that. So hugo will just not be my solution, too bad it looked nice. Thanks!

No. I am afraid it is not possible. There is no way as far as I know to have external commands work in tandem with Hugo during site generation.

Currently there is no plugin system.

You need to look into doing what you need with an external script, maybe after site generation.

P.S. The other topic was closed by me because the way that the question was formulated made it seem OT. Also there is no harsh policy. Topics that are marked as solved are auto-closed 2 days after the last reply.