pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
611 stars 166 forks source link

scholarly-metadata produces error: "~/.local/share/pandoc/filters/scholarly-metadata.lua:95: not a named object: table: 0x62cafe0" #142

Closed kaarelmand closed 3 years ago

kaarelmand commented 3 years ago

Pandoc fails when trying to run the scholarly-metadata lua filter on a minimal example:

> cat test.md

---

title: "test title"
institute:
  - tst: "test institute"
author: 
  - John Doe:
    institute: [tst]
...

test

I get this traceback:

> pandoc -o test.pdf --lua-filter=scholarly-metadata.lua test.md 

Error running filter ~/.local/share/pandoc/filters/scholarly-metadata.lua:
...~/.local/share/pandoc/filters/scholarly-metadata.lua:95: not a named object: table: 0x6781a80
stack traceback:
    [C]: in function 'error'
    ...~/.local/share/pandoc/filters/scholarly-metadata.lua:95: in function 'to_named_object'
    [string "--[[..."]:119: in function 'pandoc.List.map'
    ...~/.local/share/pandoc/filters/scholarly-metadata.lua:145: in upvalue 'canonicalize'
    ...~/.local/share/pandoc/filters/scholarly-metadata.lua:181: in function <...~/.local/share/pandoc/filters/scholarly-metadata.lua:180>

My Pandoc version is 2.11 (from conda-forge), running on Ubuntu 20.04.

tarleb commented 3 years ago

I think institute: [tst] should be indented by two more spaces.

kaarelmand commented 3 years ago

Oh wow, thanks! That fixed the error; embarrassing mistake on my part.

However, though pandoc runs successfully now, this is what the output looks like (instead of 'John Doe' I get 'true'):

Anything else I might be doing wrong?

kaarelmand commented 3 years ago

Hmm, nevermind, I figured out I need to use the author-info-blocks lua filter as well. I wonder if this should be in the readme file...

tarleb commented 3 years ago

Good idea! Added in 67adc5bc516975d9e66e391bbd4e383aa657e8f4.