quarto-dev / quarto-dev/quarto-cli

Author's roles being `null` errors badly in Lua

Open
#11,057 0 comments 0 reactions 1 assignee View on GitHub

@cderv is already working on this.

Since Oct 14, 2024.

authors bug lua
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

From @roaldarbol in https://github.com/quarto-dev/quarto-cli/discussions/11055#discussioncomment-10934773_

---
title: "Untitled"
format: html
author:
  - name: Some name
    roles: ~
---

Content

This will throw uncatch Lua error

Error running filter C:/Users/chris/DOCUME~1/DEV_R/QUARTO~2/src/resources/filters/main.lua:
...sources\pandoc\datadir\..\..\filters\modules/authors.lua:747: bad argument #1 to 'for iterator' (table expected, got string)
stack traceback:
	...sources\pandoc\datadir\..\..\filters\modules/authors.lua:747: in upvalue 'parseRole'
	...sources\pandoc\datadir\..\..\filters\modules/authors.lua:779: in upvalue 'processAuthorRoles'
	...sources\pandoc\datadir\..\..\filters\modules/authors.lua:1001: in upvalue 'processAuthor'
	...sources\pandoc\datadir\..\..\filters\modules/authors.lua:1079: in function 'modules/authors.processAuthorMeta'
	...QUARTO~2/src/resources/filters/./normalize/normalize.lua:36: in function <...QUARTO~2/src/resources/filters/./normalize/normalize.lua:34>
	[C]: in ?
	[C]: in method 'walk'
	...V_R/QUARTO~2/src/resources/filters/./ast/customnodes.lua:76: in function <...V_R/QUARTO~2/src/resources/filters/./ast/customnodes.lua:65>
	(...tail calls...)
	...V_R/QUARTO~2/src/resources/filters/./ast/customnodes.lua:87: in function 'run_emulated_filter'
	..._R/QUARTO~2/src/resources/filters/./ast/runemulation.lua:82: in local 'callback'
	..._R/QUARTO~2/src/resources/filters/./ast/runemulation.lua:100: in upvalue 'run_emulated_filter_chain'
	..._R/QUARTO~2/src/resources/filters/./ast/runemulation.lua:136: in function <..._R/QUARTO~2/src/resources/filters/./ast/runemulation.lua:133>
stack traceback:
	...V_R/QUARTO~2/src/resources/filters/./ast/customnodes.lua:76: in function <...V_R/QUARTO~2/src/resources/filters/./ast/customnodes.lua:65>
	(...tail calls...)
	...V_R/QUARTO~2/src/resources/filters/./ast/customnodes.lua:87: in function 'run_emulated_filter'
	..._R/QUARTO~2/src/resources/filters/./ast/runemulation.lua:82: in local 'callback'
	..._R/QUARTO~2/src/resources/filters/./ast/runemulation.lua:100: in upvalue 'run_emulated_filter_chain'
	..._R/QUARTO~2/src/resources/filters/./ast/runemulation.lua:136: in function <..._R/QUARTO~2/src/resources/filters/./ast/runemulation.lua:133>

And YAML validation does not help here it seems.

We should probably handle null values for roles correctly, and throw more nicely

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.