msprev / panzer

pandoc + styles
BSD 3-Clause "New" or "Revised" License
160 stars 13 forks source link

---strict flag? #10

Closed sergiocorreia closed 9 years ago

sergiocorreia commented 9 years ago

Brainstorming a bit, but is it feasible to set a ---strict flag that will stop on error?

It would require a minor chance in cli.py (stop if unknown is not empty) and in document.py (I'm not sure if changing do_not_stop is enough)

sergiocorreia commented 9 years ago

Also, maybe a ---style flag that overrides the YAML metadata is useful?

For instance, I may want to compile a paper as draft (placing tables and figures at the end) without having to change the markdown file itself.

Cheers, Sergio

msprev commented 9 years ago

Thanks for this. At the moment, panzer tries to go as far as possible with processing unless it encounters a 'critical' level (fatal) error. Is there a particular error that you think should be treated as critical which is not? Or is the idea to treat any error as fatal?

(do_not_stop has a different purpose. With a cleanup script, it should run no matter what errors (fatal or otherwise) happen. This flag is to request that this happens in run_scripts)

On the ---style suggestion, you can do actually this already by passing --metadata=style:MyDraftSyle on the command line. This will override any document setting. You can also pass --metadata=style: to clear style and switch off panzer.

sergiocorreia commented 9 years ago

Thanks for the metadata trick!

About the errors, if I'm debugging a filter or a script, and there is an error, it's convenient if the scripts stops right there so that I immediately know something is wrong.

msprev commented 9 years ago

I've implemented the ---strict command line option. It will cause panzer to exit on the first error. Let me know if you have any problems.