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

Pandocomatic fails on file with a "date" field in the YAML metadata

htdebeer opened this issue · comments

Given the input file date-error.md, when I run pandocomatic date-error.md I get the following error message:

An unexpected error has occurred. You can report this bug via https://github.com/htdebeer/pandocomatic/issues/new.
/home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/class_loader.rb:99:in `find': Tried to load unspecified class: Date (Psych::DisallowedClass)
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/class_loader.rb:28:in `load'
        from (eval):2:in `date'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/scalar_scanner.rb:59:in `tokenize'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:65:in `deserialize'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:128:in `visit_Psych_Nodes_Scalar'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/visitor.rb:30:in `visit'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/visitor.rb:6:in `accept'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:343:in `each'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:343:in `each_slice'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:343:in `revive_hash'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/visitor.rb:30:in `visit'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/visitor.rb:6:in `accept'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:318:in `visit_Psych_Nodes_Document'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/visitor.rb:30:in `visit'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/visitor.rb:6:in `accept'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych.rb:335:in `safe_load'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/psych-4.0.3/lib/psych.rb:370:in `load'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/pandocomatic-0.2.8/lib/pandocomatic/pandoc_metadata.rb:190:in `block in extract_metadata'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/pandocomatic-0.2.8/lib/pandocomatic/pandoc_metadata.rb:190:in `map'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/pandocomatic-0.2.8/lib/pandocomatic/pandoc_metadata.rb:190:in `extract_metadata'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/pandocomatic-0.2.8/lib/pandocomatic/pandoc_metadata.rb:60:in `load'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/pandocomatic-0.2.8/lib/pandocomatic/pandoc_metadata.rb:50:in `load_file'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/pandocomatic-0.2.8/lib/pandocomatic/command/convert_file_multiple_command.rb:50:in `initialize'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/pandocomatic-0.2.8/lib/pandocomatic/pandocomatic.rb:85:in `new'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/pandocomatic-0.2.8/lib/pandocomatic/pandocomatic.rb:85:in `run'
        from /home/huub/.rvm/gems/ruby-3.0.0/gems/pandocomatic-0.2.8/bin/pandocomatic:3:in `<top (required)>'
        from /home/huub/.rvm/gems/ruby-3.0.0/bin/pandocomatic:23:in `load'
        from /home/huub/.rvm/gems/ruby-3.0.0/bin/pandocomatic:23:in `<main>'

As a workaround, write the date as a string rather than a date. Thus:

date: '2022-01-05'

rather than:

date: 2022-01-05