crsh / papaja

papaja (Preparing APA Journal Articles) is an R package that provides document formats to produce complete APA manuscripts from RMarkdown-files (PDF and Word documents) and helper functions that facilitate reporting statistics, tables, and plots.
https://frederikaust.com/papaja_man/
Other
649 stars 132 forks source link

Pandoc error when using a block in metadata #523

Open mutlusun opened 2 years ago

mutlusun commented 2 years ago

Hello,

Thank you again for all your work on papaja! In the recent master version, I found a little error when parsing the template with this metadata:

---
title             : "The title"
shorttitle        : "Title"

author: 
  - name          : "First Äuthor"
    affiliation   : "1"
    corresponding : yes    # Define only one corresponding author
    address       : |
      Postal address
    email         : "my@email.com"
    role:         # Contributorship roles (e.g., CRediT, https://casrai.org/credit/)
      - "Conceptualization"
      - "Writing - Original Draft Preparation"
      - "Writing - Review & Editing"
  - name          : "Ernst-August Doelle"
    affiliation   : "1,2"
    role:
      - "Writing - Review & Editing"
      - "Supervision"

affiliation:
  - id            : "1"
    institution   : "Wilhelm-Wundt-University"
  - id            : "2"
    institution   : "Konstanz Business School"

[...]

The error is:

Error running filter /home/[redacted]/.local/share/renv/cache/v5/R-3.6/x86_64-pc-linux-gnu/papaja/0.1.0.9999/3d0513cc1fe63c86d279f10e8f4a3e9f/papaja/lua/parse_metadata.lua:
Error while trying to get a filter's return value from lua stack.
Could not get Pandoc value: Could not read list: Could not get Block value: Could not read list: Could not get Inline value: Unknown inline type: Plain
Error: pandoc document conversion failed with error 83

The difference is that I have changed the address to use a block, see address: | Postal address. I have used that for some time to indent a rather long address.

To be honest, I'm not really sure whether this is a bug or not and whether it's necessary that this is working. At least, it worked with previous papaja versions. If you see this as a misuse of the address field, I'm comfortable with closing this issue. :)

Best

crsh commented 2 years ago

Thanks for raising this. I have been battling these issues with my limited Lua-knowledge and I'm certainly looking to make this work. It will be a little while before I get around to looking into this unfortunately.

lk1373190 commented 2 years ago

Hi there, I am having the same issue and keep getting the following error message: Error running filter /Library/Frameworks/R.framework/Versions/4.1/Resources/library/papaja/lua/docx_fixes.lua: ...Versions/4.1/Resources/library/papaja/lua/docx_fixes.lua:16: attempt to index a nil value (field '?') stack traceback: ...Versions/4.1/Resources/library/papaja/lua/docx_fixes.lua:16: in function 'Image' Error: pandoc document conversion failed with error 83 Execution halted Any help would be greatly appreciated :) Best wishes, Lucy

crsh commented 2 years ago

Hi Lucy,

although similiar, this is in fact a different problem. Coud you share a minimally reproducible example with me? Is it possible that you are trying to create a Word document that contains a Figure with no caption? What happens if you add a caption?

Cheers, Frederik