htdebeer / pandocomatic

Automate the use of pandoc

Home Page:https://heerdebeer.org/Software/markdown/pandocomatic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feature request] Restore Pandoc's verbose output somehow?

iandol opened this issue · comments

I understand you removed passing pandoc the --verbose option to not conflict with your internal communication. However Pandoc's verbose output can be useful / interesting during compilation. I wonder if there is some way of collecting the verbose output and restoring this output, without causing the bug you previously fixed?

The issue with --verbhose is not something that happens in a regular situation with the --verbose option. E.g, the following input runs fine:

---
pandocomatic_:
  pandoc:
    from: markdown
    to: latex
    output: test.pdf
    verbose: true
...

Hello **World**!

It is easy to prevent by disabling the --verbose option. Because I haven't used this --verbose option myself, I assumed, apparently incorrectly, that this option would not be used often anyway.

However, from your message I gather that this option is used more often. If so, disabling isn't the best option, no.

Looking at paru, I see that I capture the error stream during the conversion, but only print it back to the error stream after the conversion is finished. That's clearly not an issue in simple situations like the example above.

Reproducing the original issue, I see that it occurs when using filters or lua-filters. Somehow, the delayed printing of the verbose output, or the capturing of the output streams is interfering with how pandoc works here.

I'll look into this further, but it might take a while to investigate.

In the meanwhile, as a workaround, if you want to enable --verbose output, you can comment out lines 153-157 in the file lib/pandocomatic/command/convert_file_command.rb and run pandocomatic via the test command like so:

/path/to/repository/pandocomatic/test/pandocomatic.rb -i yourfile.md -o output.ext

Thanks Huub for the workaround, take all the time you need and thanks for the consideration.

Actually, I didn't reproduce the issue. Pandoc failed because I didn't have the filter programs in the right location. Once I installed them properly, everything seems to work as expected.

In the meanwhile, pandoc, pandocomatic, and paru have been altered, which also makes reproducing the issue a bit hairy. Maybe @ppenguin can chime in to see if they can still reproduce the issue with the latest paru/pandocomatic/pandoc? Of course, they should then first enable the --verbose option like I explained in my previous message.

Alternatively, I could add a switch to pandocomatic to enable the --verbose option again. Something like --enable pandoc-verbose. This way, the --verbose option doesn't interfere with regular pandocomatic behavior, but you can switch it on if you so desire. Then, if switching on causes strange behavior, we can look into it further or ignore it.

As an added bonus, we can use this --enable feature to add and test new features.