Git Product home page Git Product logo

Comments (4)

sergiocorreia avatar sergiocorreia commented on July 21, 2024

I agree that Python errors should not be allowed to occur.

We could just wrap the YAML reader in a try ... except code, and if it fails, then do nothing but issue a warning message?

from panflute.

ickc avatar ickc commented on July 21, 2024

In addition to a warning message in command-line, how about it returns the options with only 1 key, say, {'yaml-error': True}, so that individual filters can decide how to deal with it? (e.g. One can continue to work with the data while ignoring the options with "sensible defaults".)

By the way, I tested invalid YAML in pandoc and it will do:

$ printf "%s\n" '---' 'title: *unquoted*' '---' '' 'non-empty' | pandoc -f markdown -t native --css=abc.css
pandoc: Could not parse YAML header: did not find expected alphabetic or numeric character "source" (line 3, column 17)
Pandoc (Meta {unMeta = fromList []})
[Para [Str "non-empty"]]

from panflute.

sergiocorreia avatar sergiocorreia commented on July 21, 2024

I wrote the code for the soft error handling, but I think that at least for now the better alternative is not to run the filter at all:

  • It would allow the reader of the output to inspect what went wrong (you can just read the code block)
  • The errors would be harder to spot (e.g. a table might have the wrong title, instead of just appearing as a code block)
  • It would add even more complexity to the YAML filter

from panflute.

ickc avatar ickc commented on July 21, 2024

I finished my filter in ickc/pantable: CSV Tables in Markdown: Pandoc Filter for CSV Tables. It's based on your csv example but eventually breaks compatibility with it.

One potential problem is exactly what you said above: I handle away all errors in the YAML metadata and override them with "sensible defaults".

from panflute.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.