Skip to content

scholarly-metadata Lua filter gives invalid YAML error #552

@benmarwick

Description

@benmarwick

I'm really enjoying Quarto and excited to shift from Rmd to Qmd in my writing and teaching. I use these Lua filters frequently: scholarly-metadata.lua and author-info-blocks.lua. When I use these with Qmd I get "Validation of YAML front matter failed".

These work great with Rmd, for example this MWE works as expected:

---
title: "Testing Lua filters with Rmd"
author:
  - Jane Doe:
      institute:
        - fosg
        - fop
  - John Q. Doe:
      institute: fosg
  - Peder Ås:
      institute: fosg
  - Juan Pérez:
      institute:
        - name: Acme Corporation
  - Max Mustermann
institute:
  - fosg:
      name: Formatting Open Science Group
      address: 23 Science Street, Eureka, Mississippi, USA
  - fop: Federation of Planets
output: 
    bookdown::word_document2:
      pandoc_args:
      - --lua-filter=scholarly-metadata.lua
      - --lua-filter=author-info-blocks.lua
      - --lua-filter=pagebreak.lua
---

Example yml is from https://github.com/pandoc/lua-filters/tree/master/scholarly-metadata

Here's the output:

image

But when I try the same filters in a Qmd document, following the docs, I get an error about invalid YAML:

---
title: "Testing Lua filters with Qmd"
author:
  - Jane Doe:
      institute:
        - fosg
        - fop
  - John Q. Doe:
      institute: fosg
  - Peder Ås:
      institute: fosg
  - Juan Pérez:
      institute:
        - name: Acme Corporation
  - Max Mustermann
institute:
  - fosg:
      name: Formatting Open Science Group
      address: 23 Science Street, Eureka, Mississippi, USA
  - fop: Federation of Planets
format: 
  docx
filters: 
  - scholarly-metadata.lua
  - author-info-blocks.lua
---

Example yml is from https://github.com/pandoc/lua-filters/tree/master/scholarly-metadata

Here's the output in the Render tab:

ERROR: Validation of YAML front matter failed.
ERROR: In file author-info-blocks.qmd
(line 17, column 5 through line 19, column 58) Array entry 1 with value fosg:
      name: Formatting Open Science Group
      address: 23 Science Street, Eureka, Mississippi, USA failed to be a string.
16: institute:
17:   - fosg:
        ~~~~~
18:       name: Formatting Open Science Group
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19:       address: 23 Science Street, Eureka, Mississippi, USA
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20:   - fop: Federation of Planets
✖ The value fosg:
      name: Formatting Open Science Group
      address: 23 Science Street, Eureka, Mississippi, USA is object.
ℹ The error happened in location institute:0.

ERROR: In file author-info-blocks.qmd
(line 20, columns 5--30) Array entry 2 with value fop: Federation of Planets failed to be a string.
19:       address: 23 Science Street, Eureka, Mississippi, USA
20:   - fop: Federation of Planets
        ~~~~~~~~~~~~~~~~~~~~~~~~~
21: format: 
✖ The value fop: Federation of Planets is object.
ℹ The error happened in location institute:1.

ERROR: Render failed due to invalid YAML.

Here's my session info:

Quarto version 0.9.80
Pandoc version 2.17.1.1

RStudio 2022.02.1+461 "Prairie Trillium" Release (8aaa5d470dd82d615130dbf663ace5c7992d48e3, 2022-03-17) for macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] knitr_1.37.4      magrittr_2.0.2    usethis_2.1.5     devtools_2.4.3   
 [5] pkgload_1.2.4     here_1.0.1        R6_2.5.1          rlang_1.0.2      
 [9] fastmap_1.1.0     tools_4.1.2       pkgbuild_1.3.1    xfun_0.30        
[13] sessioninfo_1.2.2 cli_3.2.0         git2r_0.29.0      withr_2.5.0      
[17] htmltools_0.5.2   ellipsis_0.3.2    remotes_2.4.2     yaml_2.3.5       
[21] rprojroot_2.0.2   digest_0.6.29     lifecycle_1.0.1   bookdown_0.24    
[25] crayon_1.5.0      brio_1.1.3        processx_3.5.2    purrr_0.3.4      
[29] callr_3.7.0       fs_1.5.2          ps_1.6.0          testthat_3.1.2   
[33] glue_1.6.2        memoise_2.0.1     cachem_1.0.6      evaluate_0.15    
[37] rmarkdown_2.12    compiler_4.1.2    desc_1.4.1        prettyunits_1.1.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions