pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
603 stars 165 forks source link

Error 83 using scholarly-metadata.lua in YAML of Rmarkdown #77

Closed katherinelauck closed 4 years ago

katherinelauck commented 4 years ago

I'm running Windows 10 and updated RStudio, pandoc, Rmarkdown, and the latest version of the .lua files in the following YAML.

Trying to knit a .rmd with just the following in it, and scholarly-metadata.lua and author-info-blocks.lua in its directory,

---
title: "My title"
author: 
  - Katherine Lauck:
    email: kslauck@ucdavis.edu
    institute: [davis, pi]
    correspondence: true
  - name: Sarah L. Carroll
    institute: colorado
  - name: Elly Mufliati
    institute: [untan, pi]
  - name: Sadtata Noor Adirahmanta
    institute: bksda
  - name: Novia Sagita
    institute: pi
  - name: Siti Kartikawati
    institute: [untan, pi]
  - name: Adam Miller
    institute: pi
institute:
  - davis: Graduate Group in Ecology, University of California, Davis
  - pi: Planet Indonesia
  - untan: Fakultas Kehutanan, Universitas Tanjungpura
  - bksda: Balai Konservasi Sumber Daya Alam
  - colorado: Graduate Degree Program in Ecology, Colorado State University
output: 
  word_document:
    pandoc_args:
      - '--lua-filter=scholarly-metadata.lua'
      - '--lua-filter=author-info-blocks.lua'
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
\```

## Abstract

blah blah 

note: delete the escape slash after the r setup block before running - sorry, I'm new to github formatting and couldn't figure out how to properly escape that triple tick without the slash remaining in the code block.

Gives me:

Error running filter scholarly-metadata.lua: [string "scholarly-metadata.lua"]:7: unexpected symbol near '<' Error: pandoc document conversion failed with error 83

My interpretation of this error message is that pandoc is successfully opening and reading the .lua files but is expecting a different format. Commenting out the first filter gives the same error for the second filter.

tarleb commented 4 years ago

Thanks for the report! The issue seems to be caused by the first author block. Please try to either indent the lines under your name by two additional spaces

author: 
  - Katherine Lauck:
      email: kslauck@ucdavis.edu
      institute: [davis, pi]
      correspondence: true

or use name as for the other authors.

author: 
  - name: Katherine Lauck
    email: kslauck@ucdavis.edu
    institute: [davis, pi]
    correspondence: true

The error messages are certainly less than ideal, in that they fail to properly hint at possible causes for this problem. I'll take this issue as a reminder to fix this.

katherinelauck commented 4 years ago

Hi tarleb, thanks for your help so far! I tried both of your suggestions by copy paste to make sure I got it right and still got the same error message.

katherinelauck commented 4 years ago

Do you think it's a pandoc problem? Have you been able to reproduce the error message?

jgm commented 4 years ago

Are you sure your scholarly-metadata.lua is correct? From the error message it sounds like you might have downloaded the HTML representation of it rather than the raw. Try looking at it in a text editor.

katherinelauck commented 4 years ago

That is 100% what is going on. Sorry for wasting your time.

katherinelauck commented 4 years ago

It's gorgeous, I tell ya, gorgeous

DS-Rodrigues commented 2 years ago

Hi, thanks for creating this tool. I also get this error message. I am trying to use your .lua files but from GitHub it downloads automatically as .html and from what I can see, these need to be .lua, how can I get the files as .lua? I am using Mac, and I installed pandoc via brew on the terminal. Thanks

tarleb commented 2 years ago

Hi @DS-Rodrigues, the easiest might be to download the zip file of the latest release and to get the files from there. Alternatively, if you view the content of a file on GitHub, then there should be a button Raw somewhere to the top right. A right click and "save content" will download the raw code.

DS-Rodrigues commented 2 years ago

Perfect, it is working now. Thanks so much!